[pkg-wpa-devel] Bug#737109: hostapd: Bridged interface dropped from bridge

Mark Hindley mark at hindley.org.uk
Thu Jan 30 10:44:18 UTC 2014


Package: hostapd
Version: 1:1.0-3+b1
Severity: normal
Tags: patch

Dear Maintainer,

I am using hostapd in a bridged wlan/eth setup. The wifi card is 

 00:08.0 Ethernet controller: Atheros Communications Inc. AR5212/AR5213 Wireless Network Adapter (rev 01)

Hostapd config:

	interface=wlan0
	bridge=br0
	driver=nl80211
	logger_syslog=-1
	logger_syslog_level=1
	logger_stdout=-1
	logger_stdout_level=2
	dump_file=/tmp/hostapd.dump
	ctrl_interface=/var/run/hostapd
	ctrl_interface_group=0
	ssid=XXXX
	hw_mode=g
	channel=5
	beacon_int=100
	dtim_period=2
	max_num_sta=255
	rts_threshold=2347
	fragm_threshold=2346
	macaddr_acl=0
	auth_algs=1
	ignore_broadcast_ssid=0
	wme_enabled=1
	wme_ac_bk_cwmin=4
	wme_ac_bk_cwmax=10
	wme_ac_bk_aifs=7
	wme_ac_bk_txop_limit=0
	wme_ac_bk_acm=0
	wme_ac_be_aifs=3
	wme_ac_be_cwmin=4
	wme_ac_be_cwmax=10
	wme_ac_be_txop_limit=0
	wme_ac_be_acm=0
	wme_ac_vi_aifs=2
	wme_ac_vi_cwmin=3
	wme_ac_vi_cwmax=4
	wme_ac_vi_txop_limit=94
	wme_ac_vi_acm=0
	wme_ac_vo_aifs=2
	wme_ac_vo_cwmin=2
	wme_ac_vo_cwmax=3
	wme_ac_vo_txop_limit=47
	wme_ac_vo_acm=0
	ap_max_inactivity=300
	eapol_key_index_workaround=0
	eap_server=0
	own_ip_addr=127.0.0.1
	wpa=3
	wpa_passphrase=XXXXXX
	wpa_key_mgmt=WPA-PSK
	wpa_pairwise=TKIP
	rsn_pairwise=CCMP

When using hostapd/stable, clients using the wlan are sometimes suddenly 
unable to communicate through the bridge and wlan0 is no longer present 
in the output of brctl show br0. 

At the same time syslog shows:

/var/log/syslog.2.gz:Jan 19 11:31:07 titan kernel: device wlan0.sta1 entered promiscuous mode
/var/log/syslog.2.gz:Jan 19 11:31:07 titan kernel: br0: port 3(wlan0.sta1) entering forwarding state
/var/log/syslog.2.gz:Jan 19 11:31:07 titan kernel: br0: port 3(wlan0.sta1) entering forwarding state
/var/log/syslog.2.gz:Jan 19 11:31:11 titan ntpd[3468]: Listen normally on 19 wlan0.sta1 fe80::20f:3dff:feaa:96f0 UDP 123
/var/log/syslog.2.gz:Jan 19 11:31:18 titan kernel: wlan0.sta1: no IPv6 routers present
/var/log/syslog.2.gz:Jan 19 11:31:22 titan kernel: br0: port 3(wlan0.sta1) entering forwarding state
/var/log/syslog.2.gz:Jan 19 11:31:22 titan kernel: device wlan0.sta1 left promiscuous mode
/var/log/syslog.2.gz:Jan 19 11:31:22 titan kernel: br0: port 3(wlan0.sta1) entering disabled state
/var/log/syslog.2.gz:Jan 19 11:31:24 titan ntpd[3468]: Deleting interface #19 wlan0.sta1, fe80::20f:3dff:feaa:96f0#123, interface stats: received=0, sent=0, dropped=0, active_time=13 secs

Wireless traffic across the bridge can be restored by adding wlan0 back 
to the bridge with brctl addif br0 wlan0

There is a similar ticket in the OpenWRT lists at 
https://dev.openwrt.org/ticket/9257

Their fix is https://dev.openwrt.org/changeset/26724

I have rebuilt hostapd with an updated version of the same patch and it 
also seems to fix the problem for me. Perhaps you would consider including it?

My patch below. The only change I made to the OpenWRT version was to 
reflect the move of drv->ioctl_sock to drv->global->ioctl_sock and to 
refresh the line numbers.

Best wishes

Mark

Description: Port of patch from OpenWRT
(https://dev.openwrt.org/browser/trunk/package/hostapd/patches/730-fix_wds_bridge_handling.patch?rev=26724)
to fix Bridge on wireless AP loses wlan0 when WDS station disassociates
Author: Mark Hindley <mark at hindley.org.uk>
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6528,6 +6528,9 @@
 		linux_set_iface_flags(drv->global->ioctl_sock, name, 1);
 		return i802_set_sta_vlan(priv, addr, name, 0);
 	} else {
+		if (bridge_ifname)
+			linux_br_del_if(drv->global->ioctl_sock, bridge_ifname, name);
+
 		i802_set_sta_vlan(priv, addr, bss->ifname, 0);
 		return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN,
 						    name);
@@ -6887,14 +6890,14 @@
 		return -1;
 
 #ifdef HOSTAPD
-	if (bss->added_if_into_bridge) {
+	if (type == WPA_IF_AP_BSS && bss->added_if_into_bridge) {
 		if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
 				    bss->ifname) < 0)
 			wpa_printf(MSG_INFO, "nl80211: Failed to remove "
 				   "interface %s from bridge %s: %s",
 				   bss->ifname, bss->brname, strerror(errno));
 	}
-	if (bss->added_bridge) {
+	if (type == WPA_IF_AP_BSS && bss->added_bridge) {
 		if (linux_br_del(drv->global->ioctl_sock, bss->brname) < 0)
 			wpa_printf(MSG_INFO, "nl80211: Failed to remove "
 				   "bridge %s: %s",

-- System Information:
Debian Release: 7.3
  APT prefers stable
  APT policy: (900, 'stable'), (400, 'testing')
Architecture: i386 (i586)

Kernel: Linux 2.6.35.4-mk6 (PREEMPT)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages hostapd depends on:
ii  initscripts       2.88dsf-41+deb7u1
ii  libc6             2.13-38
ii  libnl-3-200       3.2.7-4
ii  libnl-genl-3-200  3.2.7-4
ii  libssl1.0.0       1.0.1e-2+deb7u3
ii  lsb-base          4.1+Debian8+deb7u1

hostapd recommends no packages.

hostapd suggests no packages.

-- Configuration Files:
/etc/hostapd/hostapd.conf changed

-- no debconf information



More information about the Pkg-wpa-devel mailing list