[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: wireless lan config



> don't know how well it [quickswitch] integrates the iwconfig stuff

well, the version i downloaded (0.8 i think) didn't integrate it at all,
but it was pretty straightforward to add.  below is my "diff -c", in case
anyone wants it (if you don't know what to do with this, man patch).  i
basically just added support for iwconfig's essid and key arguments...

YMMV, etc, but it seems to work for me.  have fun!

...derFlieN

NeilFred Picciotto
fred (at) derf (dot) net


------ "diff -c" patch follows ------
*** switchto.bak	Thu Aug 16 02:25:04 2001
--- switchto	Thu Aug 16 04:18:39 2001
***************
*** 76,81 ****
--- 76,84 ----
  	$EXECPRE && execpre();
  
  	# Do the job
+ 	# added by neilfred:
+ 	($ESSID || $KEY) && configureWireless();
+ 	# end added by neilfred
  	configuredevice();
  	$GATEWAY && noroute() && setroute();
  	($HOSTNAME || $FQHOSTNAME) && sethostname();
***************
*** 194,199 ****
--- 197,214 ----
  	}
  }
  
+ # added by neilfred:
+ sub configureWireless {
+ 	$ESSID && eval {
+ 		doCommand ( "Setting up wireless ESSID...\n",
+ 			"$IWCONFIG $DEVICE essid $ESSID" );
+ 	};
+ 	$KEY && eval {
+ 		doCommand ( "Setting up wireless key...\n",
+ 			"$IWCONFIG $DEVICE key $KEY" );
+ 	};
+ }
+ # end added by neilfred
  
  sub doCommand {
  	my ($_msg, $_cmd) = @_;
***************
*** 290,295 ****
--- 305,323 ----
  		$_cmd = 1;
  		$VERBOSE && print "Got Gateway Address $GATEWAY\n";
  	};
+ 	# added by neilfred:
+ 	($ARGS =~ m/\s+essid:(\S+)?/) && eval {
+ 		!($ESSID=$1) && humanerr("Invalid ESSID.\n");
+ 		$ESSID =~ s/_/ /;
+ 		$_cmd = 1;
+ 		$VERBOSE && print "Got ESSID $ESSID\n";
+ 	};
+ 	($ARGS =~ m/\s+key:([0-9a-fA-F]*)/) && eval {
+ 		!($KEY=$1) && humanerr("Invalid key.\n");
+ 		$_cmd = 1;
+ 		$VERBOSE && print "Got key $KEY\n";
+ 	};
+ 	# end added by neilfred
  	($ARGS =~ m/\s+host:(\S+)?/) && eval {
  		!($HOSTNAME=$1) && humanerr ("Invalid host name.\n");
  		$_cmd = 1;
***************
*** 350,355 ****
--- 378,386 ----
  sub setConfigVars {
  	$DEVICE = $settings->{config}{device} || "$DEFETH";
  	$IFCONFIG = $settings->{config}{ifconfig} || "/sbin/ifconfig";
+ 	# added by neilfred:
+ 	$IWCONFIG = $settings->{config}{iwconfig} || "/usr/local/sbin/iwconfig";
+ 	# end added by neilfred
  	$DHCPCONFIG = $settings->{config}{dhcpconfig} || "/sbin/pump -i";
  	$NETSTAT = $settings->{config}{netstat} || "/bin/netstat";
  	$ROUTE = $settings->{config}{route} || "/sbin/route";
***************
*** 376,381 ****
--- 407,416 ----
  	$FQHOSTNAME = $settings->{$match}{FQhostname};
  	$NETMASK = $settings->{$match}{netmask} || "255.255.255.0";
  	$GATEWAY = $settings->{$match}{gateway};
+ 	# added by neilfred:
+ 	$ESSID = $settings->{$match}{essid};
+ 	$KEY = $settings->{$match}{key};
+ 	# end added by neilfred
  	$DOMAINNAME = $settings->{$match}{domain};
  	$SEARCH = $settings->{$match}{search};
  	$DNS1 = $settings->{$match}{dns1};
------ end of "diff -c" patch ------




Reply to: