I had to pass some options to my wireless card to connect to my access point with a password. I use iwconfig provided by wireless-tools ebuild to do this. I would like that each time I reboot their options would be passed. I decide to extend arguments set in /etc/conf.d/net. With this system, each interface could have this own options. Their aguments allow to pass essid, frequence, channel, mode,rate and key to the wireless card. For example to set eth0 : iwessid_eth0="" to set essid iwkey_eth0="" to set key iwfreq_eth0="" to set frequence iwchannel_eth0="" to set channel iwmode_eth0="" to set mode iwrate_eth0="" to set rate Find enclosed a patch to default net.eth0 in /etc/init/d Reproducible: Always Steps to Reproduce: 1. 2. 3.
Created attachment 15355 [details, diff] Patch net.eth0 in /etc/init.d
w-lan gets more and more popular how about this ?
Possibly a more elegant solution: instead of seperate lines in /etc/conf.d/net for essid, key, etc., have two extra parameters: wlan_IFACE and iwpriv_IFACE, for options to be passed to iwconfig and iwpriv respectively. This also allows for driver-specific options to iwpriv to be set at boot.
Created attachment 26324 [details, diff] Patch against net.eth0 to add wlan_IFACE and iwpriv_IFACE support.
Comment on attachment 26324 [details, diff] Patch against net.eth0 to add wlan_IFACE and iwpriv_IFACE support. --- /etc/init.d/net.eth0 2004-02-25 14:40:52.000000000 +0000 +++ net.wlan0 2004-02-25 15:10:07.247461312 +0000 @@ -29,6 +29,8 @@ # No reason to check these multiple times in the file iface="${1/\./_}" iface_IFACE="$(eval echo \$\{iface_${iface}\})" + wlan_IFACE="$(eval echo \$\{wlan_${iface}\})" + iwpriv_IFACE="$(eval echo \$\{iwpriv_${iface}\})" dhcpcd_IFACE="$(eval echo \$\{dhcpcd_${iface}\})" inet6_IFACE="$(eval echo \$\{inet6_${iface}\})" alias_IFACE="$(eval echo \$\{alias_${iface}\})" @@ -57,6 +59,50 @@ eend ${retval} "Failed to bring ${IFACE} up" return ${retval} } + + # Deal with the wireless-specific parameters. Note that + # these don't need dealing with in stop(). + + # Are we dealing with a wlan interface? + if [ -n "${wlan_IFACE}" ] + then + ebegin "Setting wireless parameters for ${IFACE}" + + # Do we have wireless-tools installed? + if [ ! -x /usr/sbin/iwconfig ] + then + eerror "wlan_${IFACE} was set, but iwconfig was not found or not executable." + eerror "emerge wireless-tools to fix this." + eend 1 "Failed to set wireless parameters for ${ IFACE}" + return 1 + fi + + /usr/sbin/iwconfig ${IFACE} ${wlan_IFACE} || { + retval=$? + eend ${retval} "Failed to set wireless parameter s for ${IFACE}" + return ${retval} + } + fi + + # Do we have to deal with iwpriv? + if [ -n "${iwpriv_IFACE}" ] + then + ebegin "Setting iwpriv parameters for ${IFACE}" + + if [ ! -x /usr/sbin/iwpriv ] + then + eerror "iwpriv_${IFACE} was set, but iwpriv was not found or not executable." + eerror "emerge wireless-tools to fix this." + eend 1 "Failed to set iwpriv parameters for ${IF ACE}" + return 1 + fi + + /usr/sbin/iwpriv ${IFACE} ${iwpriv_IFACE} || { + retval=$? + eend ${retval} "Failed to set iwpriv parameters for ${IFACE}" + return ${retval} + } + fi else # Check that eth0 was not brough up by the kernel ... if [ "${status_IFACE}" != "up" ]
Sorry about that. I realised I left some debugging statements in that patch, and I'm still getting to grips with how Bugzilla works.
*** This bug has been marked as a duplicate of 52653 ***