#---------------------------------------------------------------------------- # /etc/rc.d/rc120.net - loading driver for netword card # was file /etc/rc.d/rc120.eth # # Creation: 29.03.2000 fm # Last Update: $Id$ #---------------------------------------------------------------------------- begin_script NET "loading network drivers ..." # Loading base drivers if available (otherwise they aren't needed) netdrivers=/var/run/netdrivers.conf >$netdrivers [ "$NET_DRV_N" -eq 0 ] || for idx in `seq 1 $NET_DRV_N` do eval drv='$NET_DRV_'$idx eval opt='$NET_DRV_'$idx'_OPTION' oldeth=`ip link show | sed -n 's/^[0-9]\{1,\}: \([a-z]\{2,\}[0-9]\{1,\}\).*/\1/p'` case $drv in cs89x0) do_modprobe $drv $opt if [ $? != 0 ] then echo $SCRIPT" module cs89x0 failed, retrying with reset!" >>/bootmsg.txt flag=0 opt1= for var in $opt do [ "$var" = "-o" ] && flag=1 var1=`echo $var | sed '/io=/s/.$/1/' | sed '/io=/s/.,/1,/g'` opt1=`echo $opt1 $var1` done [ $flag = 1 ] && opt=`echo $opt1` || opt=`echo -o cs8920 $opt1` do_modprobe cs89x0 $opt if [ $? != 0 ] then echo $SCRIPT" module cs89x0 failed!" >>/bootmsg.txt else echo $SCRIPT" module cs89x0 loaded with reset" >>/bootmsg.txt fi fi ;; ath_pci) # basic configuration for this driver is done in ath_pci-helper # to allow the creation of VAPs . /etc/rc.d/ath_pci-helper ;; cdcether) do_modprobe $cdc_ether $opt ;; xen) do_modprobe xen_netfront ;; *) if [ -f /etc/rc.d/wlan_pre-helper ] then . /etc/rc.d/wlan_pre-helper fi do_modprobe $drv $opt if [ -f /etc/rc.d/wlan_post-helper ] then . /etc/rc.d/wlan_post-helper fi ;; esac neweth=`ip link show | sed -n 's/^[0-9]\{1,\}: \([a-z]\{2,\}[0-9]\{1,\}\).*/\1/p'` for i in $oldeth do neweth=`echo $neweth | sed "s/$i//"` done for i in $neweth do echo "${i}=${drv}" >>$netdrivers done # Move wlan Devices to wlan%d namespace if [ -x /sbin/iwconfig ] then #search for lowest possible wlan%d wlan_next=0 for i in `ip link show | sed -n 's/.*\(wlan[0-9]\{1,\}\).*/\1/p'` do j=`echo $i | sed 's/wlan//'` wlan_next=`expr $j + 1` done #move wlan-devices for i in `iwconfig 2>/dev/null | sed -n '/^\([ea]th\|ra\)[0-9]/s/ .*$//p'` do j=wlan${wlan_next} ip link set $i down ip link set $i name $j sed "s/^$i=/$j=/" $netdrivers >/tmp/$$netdrivers.txt cp /tmp/$$netdrivers.txt $netdrivers wlan_next=`expr $wlan_next + 1` done # Close gaps # should be hyperfluid in this context because i dont think there is a wlan-driver which registeres a wlan and a lan-device at once eth_next=0 for i in `ip link show | sed -n 's/.*\(eth[0-9]\{1,\}\).*/\1/p'` do j=`echo $i | sed 's/eth//'` if [ $j != $eth_next ] then j=eth${eth_next} ip link set $i down ip link set $i name $j sed "s/^$i=/$j=/" $netdrivers >/tmp/$$netdrivers.txt cp /tmp/$$netdrivers.txt $netdrivers fi eth_next=`expr $eth_next + 1` done # remove temporary file if [ -f /tmp/$$netdrivers.txt ] then rm /tmp/$$netdrivers.txt fi fi done end_script