Re: U of S wireless and linux FIX???

From: Rob <rob.merritt_at_no.spam.please>
Date: Mon Feb 26 2007 - 01:08:37 CST

Ok I finally grasped Bran's problem after trying to render support Friday.
sure enough wpa_supplicant works fine (with the G card) and gets a 172.16.x.x
address. Then when a gw address of 128.233.56.62 (at least in engineering)
the route command barfs and no gateway is set. I hacked around this with a one
line change to dhclient-script:

            for router in $new_routers; do
#usask
#Got this from dave Hall, tells route gw cmd where the out of band IP is
   route add -host $router dev $interface
#usask
                route add default dev $interface gw $router $metric_arg
            done

I had started a more elegant solution of about 20 lines of code to calc min max
ip range in a subnet and compare it to the router IP. but since the one liner
works and doesn't impair dhcp function in a normal inband router IP set up I
gave up.

here is the code (hooched from google) for interest sake:

            for router in $new_routers; do
#usask

ip_to_int() {
  IFS=.
  set -f
  set -- $1
  REPLY=$(($1 << 24 | $2 << 16 | $3 << 8 | $4))
}

int_to_ip() {
  REPLY=$(($1>>24)).$(($1>>16&0xff)).$(($1>>8&0xff)).$(($1&0xff))

}

mask=255.255.255.128
ip_to_int "$new_ip_address" && inet=$REPLY
ip_to_int "$mask" && imask=$REPLY

imin=$(($inet & $imask))
imax=$(($inet | $imask^0xffffffff))

int_to_ip "$imin" && min=$REPLY
int_to_ip "$imax" && max=$REPLY

ip_to_int "$router" && irnet=$REPLY
int_to_ip "$irnet" && rnet=$REPLY

if [ $irnet -le $imin -o $irnet -ge $imax ]; then
#here irnet (router) is not in the ipaddrs network
   route add -host $router dev $interface
fi

#usask
                route add default dev $interface gw $router $metric_arg
            done

wpa_supplicant.conf I used:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=0

network={
        ssid="uofs"
        key_mgmt=IEEE8021X
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        eap=PEAP
# identity="nsid" <-uncomment this if you havent apt-get(ted) wpa_gui
# password="password" <-as above
# ca_cert="/etc/ssl/sslcert/cacert.pem" <-this didn't help
        phase2="auth=MSCHAPV2"
}
Received on Mon Feb 26 01:09:18 2007

This archive was generated by hypermail 2.1.8 : Mon Feb 26 2007 - 01:09:23 CST