# hosapd madwifi wpa2 drops connection and then won't reauth

## smellyfis

so i am having some weird problems.

i can connect to my ap for a period of time and then it drops the connection and then when i try to connect to it again it doesnot let me

i've tried from both windows xp and my ps3 and it happens the same on both of them

if i do a complete restart it works fine again for a period of time then drops again

kernel: gentoo-sources-2.6.25-r5

madwifi: trunk (because the one in portage (0.9.4) doesn't work at all)

hostapd: 0.6.3-r1

/etc/conf.d/net

```
depend_br0 () {

        need net.eth0 net.ath0

        }

bridge_br0=( "ath0" "eth0" )

config_br0=("192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" )

#config_br0=("192.168.0.1")

#routes_br0=("default via 192.168.0.1")

#RC_NEED_br0=("net.eth0" "net.ath0")

#config_ath0=("192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255" )

config_eth1=("dhcp")

config_eth0=("null")

config_ath0=("null")

dhcpcd_eth1="-N"

dns_domain_eth0="lostorienteerer.net"

dns_domain_lo="lostorienteerer.net"

dns_domain_eth1="lostorienteerer.net"

modules_ath0=("iwconfig")

mode_ath0="master"

essid_ath0="myssid"

channel_ath0="4"

```

/etc/hosapd/hostapd.conf

```
interface=ath0

bridge=br0

driver=madwifi

logger_syslog=-1

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=2

dump_file=/tmp/hostapd.dump

#ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

ssid=myssid

eapol_key_index_workaround=1

eap_server=0

macaddr_acl=0

#accept_mac_file=/etc/hostapd/hostapd.accept

deny_mac_file=/etc/hostapd/hostapd.deny

auth_algs=3

#ignore_broadcast_ssid=0

#own_ip_addr=127.0.0.1

wpa=3

wpa_passphrase=secret

#wpa_psk_file=/etc/hostapd/hostapd.wpa_psk

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP CCMP

#nas_identifier=lostorienteerer.net

```

main problem with 

hostapd -d /etc/hostapd/hostapd.conf

```
Configuration file: /etc/hostapd/hostapd.conf

ctrl_interface_group=0

Configure bridge br0 for EAPOL traffic.

madwifi_set_iface_flags: dev_up=0

madwifi_set_privacy: enabled=0

BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)

SIOCGIWRANGE: WE(compiled)=22 WE(source)=18 enc_capa=0xf

ath0: IEEE 802.11 Fetching hardware channel/rate support not supported.

Flushing old station entries

madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3

Deauthenticate all stations

madwifi_set_privacy: enabled=0

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=0

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=1

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=2

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=3

Using interface ath0 with hwaddr 00:13:02:ac:e6:85 and ssid 'myssid'

SSID - hexdump_ascii(len=7):

     62 61 74 63 61 76 65                              myssid

PSK (ASCII passphrase) - hexdump_ascii(len=6):

     6b 31 74 74 79 42 30 78                           secret

PSK (from passphrase) - hexdump(len=32): 8b 22 16 99 46 62 b7 32 5f c3 6f 3d 0f 19 e6 77 ab 27 2b b8 57 4d 83 8e ee 71 10 c8 21 26 39 db

madwifi_set_ieee8021x: enabled=1

madwifi_configure_wpa: group key cipher=1

madwifi_configure_wpa: pairwise key ciphers=0xa

madwifi_configure_wpa: key management algorithms=0x2

madwifi_configure_wpa: rsn capabilities=0x0

madwifi_configure_wpa: enable WPA=0x3

WPA: group state machine entering state GTK_INIT (VLAN-ID 0)

GMK - hexdump(len=32): [REMOVED]

GTK - hexdump(len=32): [REMOVED]

WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)

madwifi_set_key: alg=TKIP addr=00:00:00:00:00:00 key_idx=1

madwifi_set_privacy: enabled=1

madwifi_set_iface_flags: dev_up=1

ath0: Setup of interface done.

l2_packet_receive - recvfrom: Network is down

l2_packet_receive - recvfrom: Network is down

ath0: STA 00:13:02:ac:e6:85 IEEE 802.11: associated

  New STA

ath0: STA 00:13:02:ac:e6:85 WPA: event 1 notification

madwifi_del_key: addr=00:13:02:ac:e6:85 key_idx=0

ath0: STA 00:13:02:ac:e6:85 WPA: start authentication

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state INITIALIZE

madwifi_del_key: addr=00:13:02:ac:e6:85 key_idx=0

madwifi_set_sta_authorized: addr=00:13:02:ac:e6:85 authorized=0

ath0: STA 00:13:02:ac:e6:85 IEEE 802.1X: unauthorizing port

WPA: 00:13:02:ac:e6:85 WPA_PTK_GROUP entering state IDLE

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state AUTHENTICATION

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state AUTHENTICATION2

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state INITPSK

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state PTKSTART

ath0: STA 00:13:02:ac:e6:85 WPA: sending 1/4 msg of 4-Way Handshake

WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8 kde_len=0 keyidx=0 encr=0)

ath0: STA 00:13:02:ac:e6:85 WPA: EAPOL-Key timeout

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state PTKSTART

ath0: STA 00:13:02:ac:e6:85 WPA: sending 1/4 msg of 4-Way Handshake

WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8 kde_len=0 keyidx=0 encr=0)

ath0: STA 00:13:02:ac:e6:85 WPA: EAPOL-Key timeout

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state PTKSTART

ath0: STA 00:13:02:ac:e6:85 WPA: sending 1/4 msg of 4-Way Handshake

WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8 kde_len=0 keyidx=0 encr=0)

ath0: STA 00:13:02:ac:e6:85 WPA: EAPOL-Key timeout

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state PTKSTART

ath0: STA 00:13:02:ac:e6:85 WPA: sending 1/4 msg of 4-Way Handshake

WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8 kde_len=0 keyidx=0 encr=0)

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state DISCONNECT

hostapd_wpa_auth_disconnect: WPA authenticator requests disconnect: STA 00:13:02:ac:e6:85 reason 2

madwifi_sta_deauth: addr=00:13:02:ac:e6:85 reason_code=2

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state DISCONNECTED

WPA: 00:13:02:ac:e6:85 WPA_PTK entering state INITIALIZE

madwifi_del_key: addr=00:13:02:ac:e6:85 key_idx=0

ioctl[IEEE80211_IOCTL_DELKEY]: No such file or directory

madwifi_del_key: Failed to delete key (addr 00:13:02:ac:e6:85 key_idx 0)

madwifi_set_sta_authorized: addr=00:13:02:ac:e6:85 authorized=0

ioctl[IEEE80211_IOCTL_SETMLME]: No such file or directory

madwifi_set_sta_authorized: Failed to unauthorize STA 00:13:02:ac:e6:85

ath0: STA 00:13:02:ac:e6:85 IEEE 802.1X: unauthorizing port

Could not set station 00:13:02:ac:e6:85 flags for kernel driver (errno=29).

ath0: STA 00:13:02:ac:e6:85 IEEE 802.11: deauthenticated due to local deauth request

Custom wireless event: 'STA-TRAFFIC-STAT

mac=00:13:02:ac:e6:85

rx_packets=0

rx_bytes=0

tx_packets=0

tx_bytes=0

'

ath0: STA 00:13:02:ac:e6:85 IEEE 802.11: disassociated

```

any help is apprieciated and i am sorry for the long post but since my apache server is on the same machine i never know when i might have to take it up or down

----------

## smellyfis

bump!

it would be nice for some help i don't know what i have wrong

i thank you in advance

----------

## Ion Silverbolt

If you get this problem from XP, then it's not a Gentoo problem.  Sounds like a hardware problem to me. Either the wifi card or the router. You might check into a firmware update for the router.

----------

## pappy_mcfae

Try a different kernel version, like something in the .22 family. That family supports wireless very well, especially if you are using ndiswrapper.

Blessed be!

Pappy

----------

## smellyfis

i can't use ndiswrapper because i need the card to work in master mode because it is my wireless router

after awhile i get a timeout error something like in my dmesg NETDEV WATCHDOG wifi0 TIMEOUT

well it is the routers problem and the wifi card because mhy desktop is my router which is where the wlan card is not working right from

the not being able to authinticate is a xp problem but after a while my ps3 loses connection and then can't authinticate even after /etc/init.d/xxx restart where xxx is every program related to my router eg iptables dnsmasq net.ath0 net.br0 hostapd

----------

## pappy_mcfae

Be that as it may, getting wireless going can be very tricky. There are so many kernel versions out there that simply suck at wireless, it is better to try a kernel that doesn't suck as much, if only to be assured that you problem isn't hardware based. From my experience, and from what I have read in the forums here and other places, the .22 kernels give the best wireless support.

Therefore, it would be wise to start out with a kernel that supports your hardware, and move on to where the hardware stops being supported.

Good luck

Blessed be!

Pappy

----------

## Simba7

I agree 100%. After I *DOWNGRADED* my server to .25, I basically lost all AP functionality without it locking up on me.

I'll try *UPGRADING* my server to .22 and see what happens. I'd really like to get my card working as an AP again.

Does the .22 series have the rather major kernel bug (the one that involves becoming root after compiling and executing a program)? Also, can I use linux-headers-2.6.23 with a .22 kernel?

----------

## pappy_mcfae

 *Simba7 wrote:*   

> I agree 100%. After I *DOWNGRADED* my server to .25, I basically lost all AP functionality without it locking up on me.
> 
> I'll try *UPGRADING* my server to .22 and see what happens. I'd really like to get my card working as an AP again.
> 
> Does the .22 series have the rather major kernel bug (the one that involves becoming root after compiling and executing a program)? Also, can I use linux-headers-2.6.23 with a .22 kernel?

 

If you are talking about the root exploitation bug, 2.6.22.19 and 2.6.22-gentoo-r10 are both immunized to it. 

I use 2.6.25-r4 linux-headers, with 2.6.22-gentoo-r10 all the time, and I have no problems at all...at least anything caused by header problems.

Blessed be!

Pappy

----------

## smellyfis

so i changed to a .22 kernel (gentoo-2.6.22-r :Cool:  and i still got the same NETDEV WATCHDOG wif0 TIMEOUT ERROR

it always seemed to happen when the cron did a test so i changed from vixie-cron to fcron no difference so i changed back to to a newer kernel 2.6.25-r6

and got the same netdev error so i took hostap out of the of the picture (rebooted with it NOT in boot stuff) still timed out after a while so i updated to the latest madwifi revision (been using svn because portage one doesn't install properlly)  and still get the problem

----------

## smellyfis

oh this is what dmesg looks like

```

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

NETDEV WATCHDOG: wifi0: transmit timed out

```

and if i go to ttys12 (where myu log shows it is every 10 seconds

----------

