WPA in adhoc mode
Sam Leffler
sam at freebsd.org
Wed Aug 6 15:38:17 UTC 2008
Johann Hugo wrote:
> I'm trying to setup WPA between two Atheros wifi adapters in adhoc mode, but I
> cannot get it to work. Any hints to get it to work ?
>
> According to the "wpa_supplicant Reference Manual 0.4.x" it should be
> possible:
> ---------------------------------------------
> IEEE 802.11 operation mode (Infrastucture/IBSS).
> 0 = infrastructure (Managed) mode, i.e., associate with an AP.
> 1 = IBSS (ad-hoc, peer-to-peer)
> Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP) and
> key_mgmt=WPA-NONE (ï¬xed group key TKIP/CCMP). In addition, ap_scan has to be
> set to 2 for IBSS. WPA-None requires following network block options:
> proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP
> (or CCMP, but not both), and psk must also be set (either directly or using
> ASCII passphrase).
> --------------------------------------------
>
> I'm running 7.0-STABLE, build on 30 Jul 2008.
> hw.ath.hal.version: 0.9.20.3
>
> ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> ether 00:80:48:50:9d:dd
> inet6 fe80::280:48ff:fe50:9ddd%ath0 prefixlen 64 scopeid 0x1
> inet6 fd9c:6829:597c:20:280:48ff:fe50:9ddd prefixlen 64
> inet6 fd9c:6829:597c:20:: prefixlen 64 anycast
> media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <adhoc>
> status: associated
> ssid ptamesh channel 13 (2472 Mhz 11g) bssid 02:15:6d:53:39:75
> authmode OPEN privacy OFF txpower 31.5 scanvalid 60 bgscan
> bgscanintvl 300 bgscanidle 250 roam:rssi11g 7 roam:rate11g 5
> protmode CTS burst
>
> mesh-9ddd:~ # more /etc/wpa_supplicant.conf
> ap_scan=2
>
> network={
> ssid="ptamesh"
> mode=1
> proto=WPA
> key_mgmt=WPA-NONE
> pairwise=NONE
> group=TKIP
> psk="mesh-ipv6"
> }
>
> mesh-9ddd:~ # wpa_supplicant -d -i ath0 -c /etc/wpa_supplicant.conf
> Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'default'
> ctrl_interface 'N/A' bridge 'N/A'
> Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
> Reading configuration file '/etc/wpa_supplicant.conf'
> ap_scan=2
> Priority group 0
> id=0 ssid='ptamesh'
> Initializing interface (2) 'ath0'
> EAPOL: SUPP_PAE entering state DISCONNECTED
> EAPOL: KEY_RX entering state NO_KEY_RECEIVE
> EAPOL: SUPP_BE entering state INITIALIZE
> EAP: EAP entering state DISABLED
> EAPOL: External notification - portEnabled=0
> EAPOL: External notification - portValid=0
> Own MAC address: 00:80:48:50:9d:dd
> wpa_driver_bsd_set_wpa: enabled=1
> wpa_driver_bsd_set_wpa_internal: wpa=3 privacy=1
> wpa_driver_bsd_del_key: keyidx=0
> wpa_driver_bsd_del_key: keyidx=1
> wpa_driver_bsd_del_key: keyidx=2
> wpa_driver_bsd_del_key: keyidx=3
> wpa_driver_bsd_set_countermeasures: enabled=0
> wpa_driver_bsd_set_drop_unencrypted: enabled=1
> Setting scan request: 0 sec 100000 usec
> Added interface ath0
> State: DISCONNECTED -> SCANNING
> Trying to associate with SSID 'ptamesh'
> Cancelling scan request
> WPA: clearing own WPA/RSN IE
> Automatic auth_alg selection: 0x1
> wpa_driver_bsd_set_auth_alg alg 0x1 authmode 1
> WPA: No WPA/RSN IE available from association info
> WPA: Set cipher suites based on configuration
> WPA: Selected cipher suites: group 8 pairwise 1 key_mgmt 16 proto 1
> WPA: clearing AP WPA IE
> WPA: clearing AP RSN IE
> WPA: using GTK TKIP
> WPA: using PTK NONE
> WPA: using KEY_MGMT WPA-NONE
> WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50
> f2 02 01 00 00 50 f2 00 01 00 00 50 f2 00
> No keys have been configured - skip key clearing
> wpa_driver_bsd_set_key: alg=TKIP addr=ff:ff:ff:ff:ff:ff key_idx=0 set_tx=1
> seq_len=6 key_len=32
> wpa_driver_bsd_set_drop_unencrypted: enabled=1
> State: SCANNING -> ASSOCIATING
> wpa_driver_bsd_associate: ssid 'ptamesh' wpa ie len 24 pairwise 0 group 2 key
> mgmt 4
> ioctl[SIOCS80211, op 22, len 24]: Invalid argument
> Association request to the driver failed
> wpa_driver_bsd_set_key: alg=TKIP addr=ff:ff:ff:ff:ff:ff key_idx=0 set_tx=1
> seq_len=6 key_len=32
> Cancelling authentication timeout
> State: ASSOCIATING -> COMPLETED
> CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (auth) [id=-1
> id_str=]
> EAPOL: External notification - portControl=ForceAuthorized
>
Looks like the driver is being told to associate which fails because the
device is in adhoc mode--and so it returns an error and wpa_supplicant
aborts the work. You might try disabling the request in the
wpa_supplicant driver.
I've never tried this config. If you can't get it work please file a PR
so the issue isn't lost.
Sam
More information about the freebsd-mobile
mailing list