Changeset 1071
- Timestamp:
- 03/27/07 08:50:23 (2 years ago)
- Files:
-
- trunk/ATTACHMENTS/wpa-service/wpa-service (added)
- trunk/ATTACHMENTS/wpa-service/wpa-service-iface (modified) (1 diff)
- trunk/ATTACHMENTS/wpa-service/wpa_actions-script (modified) (5 diffs)
- trunk/ATTACHMENTS/wpa-service/wpa_service.conf (modified) (1 diff)
- trunk/wpa-service.txt (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ATTACHMENTS/wpa-service/wpa-service-iface
r1063 r1071 1 1 ONBOOT="yes" 2 SERVICE="wpa-service 2"2 SERVICE="wpa-service" 3 3 VERBOSE="NO" 4 4 . /etc/sysconfig/wpa_supplicant/wpa_service.conf 5 5 6 IP_FUNCTION="if_plugd"7 6 # Here you have to define which wpa driver wpa_supplicant will use for 8 7 #this interface 9 8 WPA_DRIVER="madwifi" 10 11 # To avoid boot freezing with this service12 # one cycle each 5 seconds13 WPA_MAX_WAIT=1014 # or fork anyway in the background:15 FORK_SERVICE="yes"trunk/ATTACHMENTS/wpa-service/wpa_actions-script
r1063 r1071 3 3 IFACE=$1 4 4 EVENT=$2 5 6 . /etc/sysconfig/wpa_supplicant/wpa_service.conf 5 7 6 8 NETWORKDIR=/etc/sysconfig/wpa_supplicant … … 9 11 . /etc/sysconfig/rc 10 12 . $rc_functions 11 #. $IFCONFIG13 . $IFCONFIG 12 14 13 #. /etc/rc.d/init.d/functions15 . /etc/rc.d/init.d/functions 14 16 . /etc/sysconfig/network-devices/ifconfig.$IFACE/wpa-service 17 15 18 16 19 function verbose { … … 28 31 } 29 32 30 function ctrl_iface { 31 verbose -n "$WPA_CLIENT_NAME -i$IFACE $@ :" 32 RET=`$WPA_CLIENT_NAME -i$IFACE $@` &> /dev/null 33 test_fail $? 33 function get_ssid { 34 RET=`$WPA_CLIENT_NAME -i$IFACE status | grep ^ssid= | cut -f2- -d=` &> /dev/null 34 35 } 35 36 36 37 if [ "$EVENT" == "CONNECTED" ]; then 37 ctrl_iface status38 test_fail $?39 SSID=`echo $RET | grep ^ssid= | cut -f2- -d=`38 get_ssid 39 SSID=$RET 40 verbose '' "SSID is $SSID" 40 41 # configure network, signal DHCP client, etc. 41 42 # If special networks definition exist, use it … … 56 57 if [ "$EVENT" == "DISCONNECTED" ]; then 57 58 # remove network configuration, if needed 58 ctrl_iface status 59 test_fail $? 60 SSID=`echo $RET | grep ^ssid= | cut -f2- -d=` 59 get_ssid 60 SSID=$RET 61 61 # configure network, signal DHCP client, etc. 62 62 # If special networks definition exist, use it … … 65 65 $SERVICESDIR/$SERVICE $IFACE down 66 66 else 67 IFCONFIG="$NETWORKDIR/AUTO" 68 . $IFCONFIG 69 export IFCONFIG 67 70 $SERVICESDIR/$SERVICE $IFACE down 68 71 fi trunk/ATTACHMENTS/wpa-service/wpa_service.conf
r1063 r1071 17 17 18 18 WPA_ACTION_FILE=$WPA_CONFIG_DIR/wpa_actions 19 IFPLUGD_WRAPPER=$WPA_CONFIG_DIR/ifplugd_wrapper20 19 21 20 # This is what need wpa_supplicant trunk/wpa-service.txt
r1063 r1071 1 1 AUTHOR: Eloi Primaux eloi AT bliscat dot org 2 2 3 DATE: 200 6-10-133 DATE: 2007-02-14 4 4 5 5 LICENSE: GNU Free Documentation License Version 2 6 6 7 SYNOPSIS: Setting up a wifi interface using wpa_supplicant and LFS IP services 7 SYNOPSIS: Setting up a wifi interface using wpa_supplicant and LFS IP 8 services 8 9 9 10 DESCRIPTION: … … 11 12 ATTACHMENTS: 12 13 13 http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa_service.conf 14 http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-rcscript 15 http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-service2 16 http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-service-iface 17 http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa_actions-script 18 http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/ifplugd_wrapper-script 14 http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/wpa-service/wpa_service.conf 15 http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/wpa-service/wpa-rcscript 16 http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/wpa-service/wpa-service 17 http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/wpa-service/wpa-service-iface 18 http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/wpa-service/wpa_actions-script 19 19 20 20 21 21 PREREQUISITES: 22 22 23 - A working LFS-6.1 system or newer with wireless capabilities23 - A working LFS-6.1.1 system or newer with wireless capabilities 24 24 - Almost two networks services like ipv4-static/dhcpcd installed 25 - wpa_supplicant and wireless drivers25 - wpa_supplicant (>=0.5.7) and wireless drivers 26 26 27 27 HINT: … … 32 32 0.a) wpa_supplicant 'The core' 33 33 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 34 This is NOT an usual step if you omit something here you won't be able to attach 34 This is NOT an usual step if you omit something here you won't be able 35 to attach 35 36 your device to any access point 36 37 37 Please use the 0. 4.8 version or newer and NOT the 0.4.7, available at:38 Please use the 0.5.7 version or newer, available at: 38 39 link: http://hostap.epitest.fi/wpa_supplicant 39 40 40 Again, i strongly recommend you to read its README before doing anything. 41 wpa_supplicant may need the source of your drivers then edit the .config file 42 as described in the README and set all constants according to your system. 41 Again, i strongly recommend you to read its README before doing 42 anything. 43 wpa_supplicant may need the source of your drivers then edit the .config 44 file 45 as described in the README and set all constants according to your 46 system. 43 47 also when ready install it by executing : 44 48 … … 47 51 make install 48 52 49 0.b) ifplugd a daemon which monitor your interface (optional)50 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~51 This external program is not required but can drastically simplify our life52 because it won't crash wpa_supplicant53 information can be found here54 http://0pointer.de/lennart/projects/ifplugd55 and ifplugd (0.28) can be downloaded from:56 http://0pointer.de/lennart/projects/ifplugd/ifplugd-0.28.tar.gz57 58 installation59 As this package is made with the GNU autotools you should run60 ./configure inside the distribution directory for configuring the source tree.61 After that you should run make for compilation62 and make install (as root) for installation of ifplugd.63 64 ./configure --prefix=/usr --sysconfdir=/etc65 make66 make install67 68 The installation scripts create an init script in ${sysconfdir}/init.d/ifplugd, however no /etc/rc?.d/ links are created for it.69 70 ifplugd request two links if you intend to use it out of wpa-service:71 72 ln -nsf /etc/sysconfdir/network-devices/{ifup,ifdown} /sbin73 74 53 1) This Hints 75 54 ~~~~~~~~~~~~~ 76 wpa_supplicant is designed to be a "daemon" program that runs in the background 55 wpa_supplicant is designed to be a "daemon" program that runs in the 56 background 77 57 and acts as the back-end component controlling the wireless connection. 78 58 wpa_supplicant supports separate front-end programs and a text-based 79 59 front-end (wpa_cli) is included with wpa_supplicant. 80 60 81 1.1) Install Files and Directories 61 1.1) Install Files and Directories (this is only a proposal) 82 62 83 63 install -d /etc/sysconfig/wpa_supplicant … … 90 70 ln -nsf /etc/rc.d/init.d/wpa /etc/rc.d/rc0.d/K85wpa 91 71 92 install -m755 wpa_actions-script /etc/sysconfig/wpa_supplicant/wpa_actions 93 install -m755 ifplugd_wrapper-script /etc/sysconfig/wpa_supplicant/ifplugd_wrapper 94 install -m755 wpa-service2 /etc/sysconfig/network-devices/services 72 install -m755 73 wpa_actions-script /etc/sysconfig/wpa_supplicant/wpa_actions 74 install -m755 75 ifplugd_wrapper-script /etc/sysconfig/wpa_supplicant/ifplugd_wrapper 76 install -m755 wpa-service /etc/sysconfig/network-devices/services 95 77 96 78 install -d /etc/sysconfig/network-devices/ifconfig.<IFACE> 97 install -m644 wpa-service-iface /etc/sysconfig/network-devices/ifconfig.<IFACE>/wpa-service 98 79 install -m644 80 wpa-service-iface /etc/sysconfig/network-devices/ifconfig.<IFACE>/wpa-service 81 82 were <IFACE> is your interface 99 83 100 84 2) Network Configuration 101 85 ~~~~~~~~~~~~~~~~~~~~~~~~ 102 2.1) Choosing the network configuration method103 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~104 86 105 87 All configurations go in the wpa-service-iface 106 107 wpa-service 0.2 can be use to only set up one time or continuously manage your 108 interface. 109 This is done by three functions: 110 - wait_for_up --> a stupid loop waiting for the interface to be ready 111 - wait_for_events --> wpa_supplicant internal 'action' function (wpa-cli -a) 112 - if_plugd --> an external daemon 113 114 This choice is done by setting IP_FUNCTION in the wpa-service-iface file 115 116 In the case of a static computer, the first function should be used 117 wait_for_up: 118 (+)the advantages are : less request to the wpa_supplicant daemon 119 only one daemon is running : wpa_supplicant. 120 (-)disadvantages : if network change, you will lost connection 121 122 wait_for_events: 123 (+)the advantages are : dynamic network configuration 124 only one daemon is running : wpa_supplicant. 125 (-)disadvantages : wpa_supplicant crashes under too much pings 126 from wpa_cli , thus you will lost connection 127 128 if_plugd: 129 (+)the advantages are : dynamic network configuration 130 less request to the wpa_supplicant daemon 131 more reliable and can also be use for wired interface 132 (-)disadvantages : require an external daemon 88 which is located 89 at /etc/sysconfig/network-device/ifconfig.<IFACE>/wpa-service 90 133 91 134 i encourage people to use the wait_for_events function, because errors reports 135 will go to wpa_supplicant developers ;) 136 137 but if you want a more reliable network, use the if_plugd function. 138 139 2.2) Network configurations with any of the three functions: 92 2.1) Network configurations with any of the three functions: 140 93 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 141 94 142 wpa-service can set up your network according to it's SSID, this means that if 143 the SSID "DHCP network" manage ip via a dhcp server, wpa-service will use the 144 SSID file descriptor to set up you network when connecting to the SSID network. 145 146 Those ssid descriptors are named with the name of the SSID they describe, 95 wpa-service can set up your network according to it's SSID, this means 96 that if 97 the SSID "DHCP network" manage ip via a dhcp server, wpa-service will 98 use the 99 SSID file descriptor to set up you network when connecting to the SSID 100 network. 101 102 Those ssid descriptors are named with the name of the SSID they 103 describe, 147 104 and took place in the /etc/sysconfig/wpa_supplicant directory. 148 105 149 the "AzErTy" SSID descriptor will be /etc/sysconfig/wpa_supplicant/AzeRtY 106 the "AzErTy" SSID descriptor will 107 be /etc/sysconfig/wpa_supplicant/AzeRtY 150 108 151 109 2.1) SSID descriptor syntax: 152 An SSID descriptor is a regular network configuration file as used in LFS system 153 it means that if SSID "IPV4" use ipv4-static, the the descriptor "IPV4" will be 110 An SSID descriptor is a regular network configuration file as used in 111 LFS system 112 it means that if SSID "IPV4" use ipv4-static, the the descriptor "IPV4" 113 will be 154 114 155 115 cat > /etc/sysconfig/wpa_supplicant/IPV4 << "EOF" … … 162 122 EOF 163 123 164 orif the "DHCP" SSID use dhcp :124 and if the "DHCP" SSID use dhcp : 165 125 166 126 cat > /etc/sysconfig/wpa_supplicant/DHCP << "EOF" … … 168 128 SERVICE="dhcpcd" 169 129 DHCP_START="-o" 170 DHCP_STOP="-k -o" 130 DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by 131 dhcpcd 171 132 172 133 # Set PRINTIP="yes" to have the script print … … 179 140 EOF 180 141 181 for convenience, wpa_actions fall back to /etc/sysconfig/wpa_supplicant/AUTO 142 for convenience, wpa_actions fall back 143 to /etc/sysconfig/wpa_supplicant/AUTO 182 144 when no SSID descriptor is available, 183 145 … … 189 151 SERVICE="dhcpcd" 190 152 DHCP_START="-o" 191 DHCP_STOP="-k -o" 153 DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by 154 dhcpcd 192 155 193 156 # Set PRINTIP="yes" to have the script print … … 202 165 203 166 204 205 206 207 167 3) The wpa_supplicant.conf (The network keys description) 208 168 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 210 170 The wpa_supplicant README and wiki explain the composition of this file. 211 171 212 3.a) File syntax 213 ~~~~~~~~~~~~~~~~ 214 The file syntax is the wpa_supplicant.conf file syntax, it is specific to the 215 wpa_supplicant program and only depend of the programmer choice, thus instead of 216 explaining you of how this file is read, i will show you a set of command to 172 The file syntax is the wpa_supplicant.conf file syntax, it is specific 173 to the 174 wpa_supplicant program and only depend of the programmer choice, thus 175 instead of 176 explaining you of how this file is read, i will show you a set of 177 command to 217 178 create a config file with wpa_supplicant. 218 179 219 180 in a bash shell execute: 220 181 221 wpa_passphrase <ssid> [passphrase] > wpa_supplicant.conf 222 223 Where <ssid> is the name of the access point and where [pasphrase] is your ... 182 wpa_passphrase <ssid> [passphrase] >> wpa_supplicant.conf 183 184 Where <ssid> is the name of the access point and where [pasphrase] is 185 your ... 224 186 pass-phrase. 225 187 … … 230 192 ssid="ssid" 231 193 #psk="passphrase" 232 psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726 194 195 psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726 233 196 } 234 197 235 Please quote correctly the strings containing the space characters 236 237 you will directly see that you can define more than one network in this file, 198 you will directly see that you can define more than one network in this 199 file, 238 200 that's why wpa_supplicant is very nice: it chooses automatically in its 239 configuration file the best (aka secure and available) network to connect. 240 241 But at this time your network need to be tuned: 242 243 open a new console and launch in the foreground wpa_supplicant in debug mode: 201 configuration file the best (aka secure and available) network to 202 connect. 203 204 4) Geting over troubles (and tunning your network) 205 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 207 open a new console and launch in the foreground wpa_supplicant in debug 208 mode: 244 209 245 210 wpa_supplicant -g/var/run/wpa_supplicant-global \ … … 248 213 this will make wpa_supplicant to output anything to us. 249 214 250 Now start the wpa_cli : 251 252 wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan[X] "" [driver] \ 215 Now start the wpa_cli in another console: 216 217 wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan[X] 218 "" [driver] \ 253 219 /var/run/wpa_supplicant 254 220 255 Where wlan[X] is the device name of your network interface and where [driver] is 221 Where wlan[X] is the device name of your network interface and where 222 [driver] is 256 223 the name of your driver 257 224 … … 262 229 /var/run/wpa_supplicant 263 230 264 if it fail, please have a look to the output of the wpa_supplicant daemon 231 if it fail, please have a look to the output of the wpa_supplicant 232 daemon 265 233 266 234 wpa_cli -iwlan[X] -p/var/run/wpa_supplicant … … 318 286 group=CCMP 319 287 #psk="passphrase" 320 psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726 288 289 psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726 321 290 } 322 291 … … 336 305 wpa_supplicant -dmadwifi -iath0 -c./wpa_supplicant.conf -dd 337 306 338 If you see something like SUCCESS it's done, kill it again and copy the config 307 If you see something like SUCCESS it's done, kill it again and copy the 308 config 339 309 file to a secure directory: 340 310 … … 345 315 346 316 347 6) The End317 5) The End 348 318 ~~~~~~~~~~ 349 319 execute: … … 353 323 /etc/rc.d/init.d/network start 354 324 355 if there is no errors, and your system is connected, then you can safely restart 325 if there is no errors, and your system is connected, then you can safely 326 restart 356 327 your computer to see it setting up your wireless card during boot time. 357 328 … … 368 339 2006 03 16 added some words to help wpa-supplicant.conf writing 369 340 2006 03 18 fix wrong paths 370 2006 03 31 Rewritten and try to match the LFS-standard thank's to archaic's help 341 2006 03 31 Rewritten and try to match the LFS-standard thank's to 342 archaic's help 371 343 2006 04 01 fix incomplete find commands 372 344 2006 10 15 wpa-service 0.2 373 345 2006 02 14 some typo fix in scripts, removed ifplugd support, and 346 wait_for_up function
