Debian Bug report logs - #600589
hostapd+bridge doesn't work if hostapd is not run as a daemon in squeeze

version graph

Package: hostapd; Maintainer for hostapd is Debian wpasupplicant Maintainers <wpa@packages.debian.org>; Source for hostapd is src:wpa (PTS, buildd, popcon).

Reported by: FEJES Jozsef <jozsef.fejes@gmail.com>

Date: Mon, 18 Oct 2010 12:24:49 UTC

Severity: normal

Found in version 0.6.10-2

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel@lists.alioth.debian.org>:
Bug#600589; Package hostapd. (Mon, 18 Oct 2010 12:24:52 GMT) (full text, mbox, link).


Acknowledgement sent to FEJES Jozsef <jozsef.fejes@gmail.com>:
New Bug report received and forwarded. Copy sent to Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel@lists.alioth.debian.org>. (Mon, 18 Oct 2010 12:24:52 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: FEJES Jozsef <jozsef.fejes@gmail.com>
To: submit@bugs.debian.org
Subject: hostapd+bridge doesn't work if hostapd is not run as a daemon in squeeze
Date: Mon, 18 Oct 2010 14:23:56 +0200
Package: hostapd
Version: 0.6.10-2

I'm using a very common setup: I want to bridge eth0 + wlan0 (b43
wireless card). When I run hostapd as a daemon, it works fine. But
when I run it from /etc/network/interfaces with the hostapd stanza, it
doesn't work.

Symptoms: in the syslog I see that there's an association and a few
seconds later a "deauthenticated due to a local deauth request"
message. With an increased log level I see an "EAPOL-key timeout"
message. If I do "ifdown wlan0" then "ifup wlan0" then it starts
working.

Why it matters: I upgraded to a 2.6.35 custom kernel. When the
networking is being set up, I get a not supported error, it can't add
wlan0 to the bridge. I read that it happens because with newer
kernels, the wifi adapter needs to be in master mode already. I can't
do that with a "pre-up iwconfig wlan0 mode master" line because it
says "Set Mode" (8B06) : SET failed on device wlan0 ; Invalid
argument". The only way I know to put the card into master mode is if
I run hostapd. I suspect one might say that custom kernels are not
supported, but running hostapd in non-daemon mode sure is. With a .32
kernel the easy workaround is to run it as a daemon mode, but it
doesn't apply with .35, and it should be fixed sooner or later.

It seems to me that hostapd only works if it is run after the bridge
is set up. My old config worked because networking was set up before
hostapd was run, the bridge was already working when hostapd started.
With the new kernel, I can't do the bridge first because of the not
supported error. So hostapd is run first, it puts the card into master
mode, then the bridge is brought up, and it doesn't work, then I can
restart hostapd with ifdown-ifup, and then it works, because it starts
after the bridge.

If there was a way to put the card into master mode without hostapd,
then I could run hostapd as a daemon with the newer kernel, too,
however the bug would still be there. But I can't setup master mode
with iwconfig, how does hostapd do it anyway?

And why doesn't it work if it is started before the bridge is created?




Information forwarded to debian-bugs-dist@lists.debian.org, Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel@lists.alioth.debian.org>:
Bug#600589; Package hostapd. (Sat, 23 Oct 2010 07:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to FEJES Jozsef <fejes@joco.name>:
Extra info received and forwarded to list. Copy sent to Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel@lists.alioth.debian.org>. (Sat, 23 Oct 2010 07:27:03 GMT) (full text, mbox, link).


Message #10 received at 600589@bugs.debian.org (full text, mbox, reply):

From: FEJES Jozsef <fejes@joco.name>
To: 600589@bugs.debian.org
Subject: Re: hostapd+bridge doesn't work if hostapd is not run as a daemon in squeeze
Date: Sat, 23 Oct 2010 08:50:19 +0200
So basically, if I do bridge first, then run hostapd as a daemon, it 
used to work, but with a newer kernel it doesn't, because the bridge 
needs wlan0 to be in master mode already, which is the job of hostapd. 
If I do hostapd first via /etc/network/interfaces, then the bridge from 
the same file, then everything starts up without an error, but I can't 
do WPA, only after I restart hostapd.

I found a workaround for the first case: "iwconfig wlan0 mode master" 
doesn't work, but "pre-up iw dev wlan0 set type __ap" does the job. It 
sets the card to master mode, then the bridge can be set up, then 
hostapd starts as a daemon and everything is working fine again.

So now the real problem remains, the second case: if hostapd is run from 
/etc/network/interfaces and I set up a bridge in the same file, then 
hostapd either doesn't receive EAPOL responses or sends the EAPOL 
requests to the wrong place and I get EAPOL timeouts in the syslog. 
Bottom line: no WPA.

Check this interfaces file:

iface eth0 inet manual
iface wlan0 inet manual
  hostapd /etc/hostapd/hostapd.conf
iface br0 inet static
  bridge-ports eth0 wlan0

I'm guessing what it does is this: bring up eth0, then run hostapd in 
the pre-up stage, then bring up wlan0, then bring up the bridge. The 
problem could be that hostapd doesn't see the bridge when it starts up, 
or some property of the bridge or wlan0 changes after it started up.

I grabbed myself a hostapd source code, so if you could give some 
pointers where to look, I'd be glad to help. How do I debug where it 
sends EAPOL requests? How do I debug where it expects EAPOL responses from?




Information forwarded to debian-bugs-dist@lists.debian.org, Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel@lists.alioth.debian.org>:
Bug#600589; Package hostapd. (Sat, 05 Feb 2011 10:48:03 GMT) (full text, mbox, link).


Acknowledgement sent to Michael Karcher <debian@mkarcher.dialup.fu-berlin.de>:
Extra info received and forwarded to list. Copy sent to Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel@lists.alioth.debian.org>. (Sat, 05 Feb 2011 10:48:03 GMT) (full text, mbox, link).


Message #15 received at 600589@bugs.debian.org (full text, mbox, reply):

From: Michael Karcher <debian@mkarcher.dialup.fu-berlin.de>
To: 600589@bugs.debian.org
Subject: hostapd + bridge for post 2.6.32
Date: Sat, 05 Feb 2011 12:45:59 +0100
Hello,

your upgraded kernel is the cause of the problem: As bridging WLAN STA
interfaces (not access point) does not work, the WLAN interface can only
be part of a bridge when it already is in master mode from 2.6.33
onwards. So this does not apply to the default squeeze kernel.

If you first start hostapd and then add to the bridge, the addition to
the bridge works, but as soon as you add the WLAN to the bridge, the
EAPOL replies are received on the bridge interface instead of the WLAN
interface. If the bridge was not set up before you start the bridge,
hostapd fails to monitor the bridge interface for EAPOL replies, and
thus won't receive them, even if the bridge is created later on.

There are two possible solutions:
1) create bridge first, then start hostapd, then add the interfaces to
the bridge (difficult to implement as creation + adding interfaces is
done in the same ifupdown script in debian)
2) Upgrade to hostapd v0.7.1 or later. These versions of hostapd deal
better with newer kernels in that they can add the interface to the
bridge by themselves. hostapd v0.7.3 is available in experimental.

The following interfaces works for me with hostapd from experimental:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

auto lo eth0 wlan0 br0
iface lo inet loopback

iface eth0 inet manual
iface wlan0 inet manual

iface br0 inet dhcp
	bridge_fd 0
	# hostapd will add wlan0 to the bridge... don't list it here
	bridge_ports eth0
	bridge_hw 00:0f:b5:80:d3:25
	hostapd /etc/hostapd/hostapd.conf

And in /etc/hostapd/hostapd.conf I have

interface=wlan0
bridge=br0

Regards,
  Michael Karcher





Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Jul 15 23:16:50 2024; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.