Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 25742 - configure wireless options in /etc/conf.d/net
Summary: configure wireless options in /etc/conf.d/net
Status: RESOLVED DUPLICATE of bug 52653
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 16649 66472
  Show dependency tree
 
Reported: 2003-08-01 21:13 UTC by Benoit Chesneau
Modified: 2005-07-17 13:06 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch net.eth0 in /etc/init.d (patch-net.eth0,2.16 KB, patch)
2003-08-01 21:14 UTC, Benoit Chesneau
Details | Diff
Patch against net.eth0 to add wlan_IFACE and iwpriv_IFACE support. (net.wlan0.diff,2.07 KB, patch)
2004-02-25 06:51 UTC, Stephen Bennett (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benoit Chesneau 2003-08-01 21:13:40 UTC
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.
Comment 1 Benoit Chesneau 2003-08-01 21:14:33 UTC
Created attachment 15355 [details, diff]
Patch net.eth0 in /etc/init.d
Comment 2 Martin Holzer (RETIRED) gentoo-dev 2003-10-29 14:27:06 UTC
w-lan gets more and more popular

how about this ?
Comment 3 Stephen Bennett (RETIRED) gentoo-dev 2004-02-25 06:50:28 UTC
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.
Comment 4 Stephen Bennett (RETIRED) gentoo-dev 2004-02-25 06:51:44 UTC
Created attachment 26324 [details, diff]
Patch against net.eth0 to add wlan_IFACE and iwpriv_IFACE support.
Comment 5 Stephen Bennett (RETIRED) gentoo-dev 2004-02-25 07:13:58 UTC
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" ]
Comment 6 Stephen Bennett (RETIRED) gentoo-dev 2004-02-25 07:16:49 UTC
Sorry about that. I realised I left some debugging statements in that patch, and I'm still getting to grips with how Bugzilla works.
Comment 7 Henrik Brix Andersen 2004-10-21 02:00:01 UTC

*** This bug has been marked as a duplicate of 52653 ***