OpenWrt Forum Archive

Topic: wpa (psk aes+tkip) problem

The content of this topic has been archived on 26 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi i'm trying to set up a virtual interface n client mode using wpa on kamikaze 2.4 bcm on a wrt54gl router.
This is the content of my /etc/config/wireless

config wifi-device  wl0
        option type     broadcom
        option channel  6

config wifi-iface
        option device   wl0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option hidden   0
        option encryption wep
        option key      1111111123

config wifi-iface
        option device   wl0
        option network  wan
        option mode     sta
        option ssid     External Network
        option encryption psk
        option key      myKey

When i reboot doing ps -x i see:

  634 root        460 S   /usr/sbin/nas -P /var/run/nas.wl0.pid -H 34954 -l br-

is it correct?

and doing iwconfig i see:

lo        no wireless extensions.

eth0      no wireless extensions.

eth0.0    no wireless extensions.

eth0.1    no wireless extensions.

br-wan    no wireless extensions.

br-lan    no wireless extensions.

wl0       IEEE 802.11-DS  ESSID:"Rete Wireless CU"  
          Mode:Master  Frequency:2.437 GHz  Tx-Power:19 dBm   
          Link Noise level:-90 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:27  Invalid misc:0   Missed beacon:0

wl0.1     no wireless extensions.

It seems that iwconfig get corrupted when i add the second interface.

Is there a solution to accomplish this?

Try this, my own notes...it's for wpa in station mode on a wgt634u, a broadcom device with an atheros wifi card.  This may not exactly apply, but should help get you started.  The madwifi wiki has a good set of tutorials as well.  http://madwifi.org/wiki/UserDocs

Generate your wpa/psk key:

wpa_passphrase your_essid_here your_wpa_key_here

It will print out what you see below, the network { ... }.  All you need is the PSK portion.
Copy and paste that into /etc/wpa.conf.

Edit /etc/wpa.conf:

network={
       ssid="joe"
       proto=WPA
       key_mgmt=WPA-PSK
       pairwise=TKIP
       group=TKIP
       psk=-----this should be your wpa key-----
}


Now try to connect...type these commands, replacing as necessary:

wlanconfig ath0 create wlandev wifi0 wlanmode sta
iwconfig ath0 essid "joe"
ifconfig ath0  192.168.0.101 up
/usr/sbin/wpa_supplicant -dd -Dmadwifi -iath0 -c/etc/wpa.conf

That last one should print a bunch of information.  If you don't see the word, DISCONNECTED or some other
errors, you are probably up and running in station mode, using wpa. If you don't see any errors, especially
things about a missing driver, continue, otherwise skip to the next section.

If you get an error complaining about a driver not being found, you need to modify a file:

vi trunk/package/wpa_supplicant/files/config.mipsel

# Driver interface for madwifi driver
CONFIG_DRIVER_MADWIFI=y
# Change include directories to match with the local setup
#CFLAGS += -I../madwifi/wpa
CFLAGS += -I/home/joe/madwifi-0.9.2.1

I guessed here and got it right.  I had to download the source code for madwifi-ng.  the cflags path
is the path to where i extracted that code.  There may be a better way to do this, but it works at least.

After you modify that file, you'll need to recompile wpa-supplicant:

make package/wpa-supplicant-clean V=99 && make package/wpa-supplicant-compile V=99

Then you'll need to remove wpa-supplicant from your device and reinstall:

ipkg remove wpa-supplicant
ipkg install wpa-supplicant

You'll probably have to force the install (see ipkg doc) because the md5sum will be incorrect (i think).  You might need to destroy the interface as well if it doesn't go up right.  If needed, issue this before trying again:

wlanconfig ath0 destroy

Good luck.

sneakywombat thanks for your help but i've a broadcom wifi card, so no atheros/madwifi drivers. But good news, i've solved the problem

HOW TO SOLVE:

The problem is in the nas invocation that is wrong. I'll try to found the script that invokes nas and make a patch for openwrt development branch.

First i had to configure wireless interfaces with /etc/config/wireless

config wifi-device  wl0
        option type     broadcom
        option channel  6

config wifi-iface
        option device   wl0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option hidden   1
        option encryption wep
        option key      1111111123

config wifi-iface
        option device   wl0
        option network  wan
        option mode     sta
        option ssid     MYESSID

Then reboot and run the correct nas command :

nas -P /var/run/nas.wl0.pid -H 34954 -l br-wan -i wl0 -S -m 4 -k MYPASSWORD -s MYESSID -w 4 &

After that my virtual interface in sta mode got associated and it works!!!!

ps: i hope to release a patch that invokes nas correctly soon.

Hey Goshawk,

I'm trying to get routed client mode (no AP for now) working in WPA-PSK (TKIP) and can't seem to get anywhere.
Would you be able to post the following info?  Sorry I forgot to include wlconfig, but it is there in repeater mode.
Is there anything else you had to do, such as modify the firewall scripts or resolv.conf?

root@OpenWrt:~# cat /etc/config/wireless
config wifi-device  wl0
        option type     broadcom
        option channel  2
# disable radio to prevent an open ap after reflashing:
        option disabled 0

config wifi-iface
        option device           wl0
        option network  wan
        option mode             sta
        option ssid             Foo
        option hidden           0
        option encryption       psk
        option key              footastic
root@OpenWrt:~# cat /etc/config/network
#### VLAN configuration
config switch eth0
        option vlan0    "1 2 3 4 5*"
        option vlan1    "0 5"


#### Loopback configuration
config interface loopback
        option ifname   "lo"
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0


#### LAN configuration
config interface lan
#       option type     bridge
        option ifname   "eth0.0"
        option proto    'static'
        option ipaddr   '192.168.0.1'
        option netmask  '255.255.255.0'
        option gateway  ''
        option dns      ''


#### WAN configuration
config interface        wan
        option type     bridge
        option ifname   "eth0.1"
        option proto    static
        option ipaddr   '192.168.1.5'
        option netmask  '255.255.255.0'
        option gateway  '192.168.1.1'
        option dns      '192.168.1.1'
root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 br-wan
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0.0
default         192.168.1.1     0.0.0.0         UG    0      0        0 br-wan
root@OpenWrt:~# ifconfig
br-wan    Link encap:Ethernet  HWaddr 00:13:10:3D:67:CA
          inet addr:192.168.1.5  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:705 errors:0 dropped:0 overruns:0 frame:0
          TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:67188 (65.6 KiB)  TX bytes:5446 (5.3 KiB)

eth0      Link encap:Ethernet  HWaddr 00:13:10:3D:67:CA
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:911 errors:0 dropped:0 overruns:0 frame:0
          TX packets:941 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:108573 (106.0 KiB)  TX bytes:133652 (130.5 KiB)
          Interrupt:5

eth0.0    Link encap:Ethernet  HWaddr 00:13:10:3D:67:CA
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:915 errors:0 dropped:0 overruns:0 frame:0
          TX packets:831 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:92539 (90.3 KiB)  TX bytes:117507 (114.7 KiB)

eth0.1    Link encap:Ethernet  HWaddr 00:13:10:3D:67:CA
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:5874 (5.7 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:83 errors:0 dropped:0 overruns:0 frame:0
          TX packets:83 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6911 (6.7 KiB)  TX bytes:6911 (6.7 KiB)

wl0       Link encap:Ethernet  HWaddr 00:13:10:3D:67:CC
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:552 errors:0 dropped:0 overruns:0 frame:17607
          TX packets:0 errors:12 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:62376 (60.9 KiB)  TX bytes:0 (0.0 B)
          Interrupt:4 Base address:0x1000

(Last edited by KillaB on 24 Mar 2007, 17:43)

@sneakywombat:
Thanks for your short manual to compile wpa_supplicant against madwifi-ng. But it does not work for me - I tried madwifi-0.9.2.1, madwifi-0.9.3 and latest madwifi-ng snapshot and getting this errors:

Sorry for hijacking thread, will add this to wiki smile

driver_madwifi.c:27:28: warning: include/compat.h: No such file or directory
driver_madwifi.c:28:32: warning: net80211/ieee80211.h: No such file or directory
driver_madwifi.c:34:39: warning: net80211/ieee80211_crypto.h: No such file or directory
driver_madwifi.c:35:38: warning: net80211/ieee80211_ioctl.h: No such file or directory
driver_madwifi.c: In function 'set80211priv':
driver_madwifi.c:111: error: 'IEEE80211_IOCTL_SETPARAM' undeclared (first use in this function)
driver_madwifi.c:111: error: (Each undeclared identifier is reported only once
driver_madwifi.c:111: error: for each function it appears in.)
driver_madwifi.c:112: error: 'IEEE80211_IOCTL_CHANLIST' undeclared (first use in this function)
driver_madwifi.c: In function 'set80211param':
driver_madwifi.c:155: error: 'IEEE80211_IOCTL_SETPARAM' undeclared (first use in this function)
driver_madwifi.c: In function 'wpa_driver_madwifi_set_wpa_ie':
driver_madwifi.c:175: error: 'IEEE80211_IOCTL_SETOPTIE' undeclared (first use in this function)
driver_madwifi.c: In function 'wpa_driver_madwifi_del_key':
driver_madwifi.c:186: error: storage size of 'wk' isn't known
driver_madwifi.c:192: error: 'IEEE80211_ADDR_LEN' undeclared (first use in this function)
driver_madwifi.c:194: error: 'IEEE80211_IOCTL_DELKEY' undeclared (first use in this function)
driver_madwifi.c:186: warning: unused variable 'wk'
driver_madwifi.c: In function 'wpa_driver_madwifi_set_key':
driver_madwifi.c:204: error: storage size of 'wk' isn't known
driver_madwifi.c:226: error: 'IEEE80211_CIPHER_WEP' undeclared (first use in this function)
driver_madwifi.c:230: error: 'IEEE80211_CIPHER_TKIP' undeclared (first use in this function)
driver_madwifi.c:234: error: 'IEEE80211_CIPHER_AES_CCM' undeclared (first use in this function)
driver_madwifi.c:259: error: 'IEEE80211_KEY_RECV' undeclared (first use in this function)
driver_madwifi.c:262: error: 'IEEE80211_KEY_GROUP' undeclared (first use in this function)
driver_madwifi.c:264: error: 'IEEE80211_KEY_XMIT' undeclared (first use in this function)
driver_madwifi.c:264: error: 'IEEE80211_KEY_DEFAULT' undeclared (first use in this function)
driver_madwifi.c:265: error: 'IEEE80211_ADDR_LEN' undeclared (first use in this function)
driver_madwifi.c:285: error: 'IEEE80211_IOCTL_SETKEY' undeclared (first use in this function)
driver_madwifi.c:204: warning: unused variable 'wk'
driver_madwifi.c: In function 'wpa_driver_madwifi_set_countermeasures':
driver_madwifi.c:293: error: 'IEEE80211_PARAM_COUNTERMEASURES' undeclared (first use in this function)
driver_madwifi.c: In function 'wpa_driver_madwifi_set_drop_unencrypted':
driver_madwifi.c:302: error: 'IEEE80211_PARAM_DROPUNENCRYPTED' undeclared (first use in this function)
driver_madwifi.c: In function 'wpa_driver_madwifi_deauthenticate':
driver_madwifi.c:309: error: storage size of 'mlme' isn't known
driver_madwifi.c:312: error: 'IEEE80211_MLME_DEAUTH' undeclared (first use in this function)
driver_madwifi.c:314: error: 'IEEE80211_ADDR_LEN' undeclared (first use in this function)
driver_madwifi.c:315: error: 'IEEE80211_IOCTL_SETMLME' undeclared (first use in this function)
driver_madwifi.c:309: warning: unused variable 'mlme'
driver_madwifi.c: In function 'wpa_driver_madwifi_disassociate':
driver_madwifi.c:322: error: storage size of 'mlme' isn't known
driver_madwifi.c:325: error: 'IEEE80211_MLME_DISASSOC' undeclared (first use in this function)
driver_madwifi.c:327: error: 'IEEE80211_ADDR_LEN' undeclared (first use in this function)
driver_madwifi.c:328: error: 'IEEE80211_IOCTL_SETMLME' undeclared (first use in this function)
driver_madwifi.c:322: warning: unused variable 'mlme'
driver_madwifi.c: In function 'wpa_driver_madwifi_associate':
driver_madwifi.c:336: error: storage size of 'mlme' isn't known
driver_madwifi.c:359: error: 'IEEE80211_PARAM_PRIVACY' undeclared (first use in this function)
driver_madwifi.c:363: error: 'IEEE80211_PARAM_WPA' undeclared (first use in this function)
driver_madwifi.c:372: error: 'IEEE80211_PARAM_ROAMING' undeclared (first use in this function)
driver_madwifi.c:385: error: 'IEEE80211_MLME_ASSOC' undeclared (first use in this function)
driver_madwifi.c:386: error: 'IEEE80211_ADDR_LEN' undeclared (first use in this function)
driver_madwifi.c:387: error: 'IEEE80211_IOCTL_SETMLME' undeclared (first use in this function)
driver_madwifi.c:336: warning: unused variable 'mlme'
driver_madwifi.c: In function 'wpa_driver_madwifi_set_auth_alg':
driver_madwifi.c:406: error: 'IEEE80211_AUTH_AUTO' undeclared (first use in this function)
driver_madwifi.c:408: error: 'IEEE80211_AUTH_SHARED' undeclared (first use in this function)
driver_madwifi.c:410: error: 'IEEE80211_AUTH_OPEN' undeclared (first use in this function)
driver_madwifi.c:412: error: 'IEEE80211_PARAM_AUTHMODE' undeclared (first use in this function)
driver_madwifi.c: In function 'wpa_driver_madwifi_init':
driver_madwifi.c:496: error: 'IEEE80211_PARAM_ROAMING' undeclared (first use in this function)
driver_madwifi.c:502: error: 'IEEE80211_PARAM_WPA' undeclared (first use in this function)
driver_madwifi.c: In function 'wpa_driver_madwifi_deinit':
driver_madwifi.c:528: error: 'IEEE80211_PARAM_ROAMING' undeclared (first use in this function)
driver_madwifi.c:532: error: 'IEEE80211_PARAM_PRIVACY' undeclared (first use in this function)
driver_madwifi.c:536: error: 'IEEE80211_PARAM_WPA' undeclared (first use in this function)
make[4]: *** [driver_madwifi.o] Error 1
make[4]: Leaving directory `/home/maintain/wrtmgmt/compilefarm/kamikaze_r6634/build_mips/wpa_supplicant-0.5.7'
make[3]: *** [/home/maintain/wrtmgmt/compilefarm/kamikaze_r6634/build_mips/wpa_supplicant-0.5.7/.built] Error 2
make[3]: Leaving directory `/home/maintain/wrtmgmt/compilefarm/kamikaze_r6634/package/wpa_supplicant'
make[2]: *** [wpa_supplicant-compile] Error 2
make[2]: Leaving directory `/home/maintain/wrtmgmt/compilefarm/kamikaze_r6634/package'
make[1]: *** [package/compile] Error 2
make[1]: Leaving directory `/home/maintain/wrtmgmt/compilefarm/kamikaze_r6634'
make: *** [world] Error 2

(My used kamikaze revision: r6634)

I think that the problem is here:

driver_madwifi.c:27:28: warning: include/compat.h: No such file or directory
driver_madwifi.c:28:32: warning: net80211/ieee80211.h: No such file or directory
driver_madwifi.c:34:39: warning: net80211/ieee80211_crypto.h: No such file or directory
driver_madwifi.c:35:38: warning: net80211/ieee80211_ioctl.h: No such file or directory

But CFLAGS variable is extended to the correct path where those files are located:

CFLAGS += -I/home/maintain/wrtmgmt/compilefarm/kamikaze_r6634/madwifi-0.9.2.1

Could someone give me some help on this plz?

--- SOLVED ---
OpenWRT revision 6713 + madwifi-ng of 03/16/2007 compiled probably smile

vi trunk/package/wpa_supplicant/files/config.mips <--- For Meraki Mini
CONFIG_DRIVER_MADWIFI=y
CFLAGS += -I<PATH>

-----------------

(Last edited by tux on 27 Mar 2007, 10:00)

The discussion might have continued from here.