diff mbox

4addr: fix reconnecting client on connection lost

Message ID 1467723643-19694-1-git-send-email-matthias.may@neratec.com
State Changes Requested
Headers show

Commit Message

Matthias May July 5, 2016, 1 p.m. UTC
When a 4addr client suddenly looses its connection (no deauth/deassoc)
the AP still thinks it is connected.
If the client reconnects before the AP timeoutes the client, traffic
cannot flow.

Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
when the client completes association.

Signed-off-by: Matthias May <matthias.may@neratec.com>
---
 src/ap/ieee802_11.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jouni Malinen July 23, 2016, 6:01 p.m. UTC | #1
On Tue, Jul 05, 2016 at 03:00:43PM +0200, Matthias May wrote:
> When a 4addr client suddenly looses its connection (no deauth/deassoc)
> the AP still thinks it is connected.
> If the client reconnects before the AP timeoutes the client, traffic
> cannot flow.
> 
> Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
> when the client completes association.

> diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
> @@ -2829,6 +2829,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
>  		new_assoc = 0;
>  	sta->flags |= WLAN_STA_ASSOC;
>  	sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
> +	sta->flags &= ~WLAN_STA_WDS;

This looks a bit strange taken into account this same handle_assoc_cb()
function is using the WLAN_STA_WDS flag just below this:

    if (sta->flags & WLAN_STA_WDS) {
	int ret;
	char ifname_wds[IFNAMSIZ + 1];

	ret = hostapd_set_wds_sta(hapd, ifname_wds, sta->addr,
		      sta->aid, 1);
	if (!ret)
	    hostapd_set_wds_encryption(hapd, sta, ifname_wds);
    }


All that would become dead code if this patch were applied. Is this code
really supposed to be removed? If so, these lines should be deleted as
well. If not, this issue would likely need to be fixed in some other
manner.
Matthias May July 24, 2016, 9:03 p.m. UTC | #2
On 07/23/2016 08:01 PM, Jouni Malinen wrote:
> On Tue, Jul 05, 2016 at 03:00:43PM +0200, Matthias May wrote:
>> When a 4addr client suddenly looses its connection (no deauth/deassoc)
>> the AP still thinks it is connected.
>> If the client reconnects before the AP timeoutes the client, traffic
>> cannot flow.
>>
>> Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
>> when the client completes association.
> 
>> diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
>> @@ -2829,6 +2829,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
>>  		new_assoc = 0;
>>  	sta->flags |= WLAN_STA_ASSOC;
>>  	sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
>> +	sta->flags &= ~WLAN_STA_WDS;
> 
> This looks a bit strange taken into account this same handle_assoc_cb()
> function is using the WLAN_STA_WDS flag just below this:
> 
>     if (sta->flags & WLAN_STA_WDS) {
> 	int ret;
> 	char ifname_wds[IFNAMSIZ + 1];
> 
> 	ret = hostapd_set_wds_sta(hapd, ifname_wds, sta->addr,
> 		      sta->aid, 1);
> 	if (!ret)
> 	    hostapd_set_wds_encryption(hapd, sta, ifname_wds);
>     }
> 
> 
> All that would become dead code if this patch were applied. Is this code
> really supposed to be removed? If so, these lines should be deleted as
> well. If not, this issue would likely need to be fixed in some other
> manner.
>  
> 

Yes this looks a bit strange.

ieee802_11_rx_from_unknown is the function which sets WLAN_STA_WDS bit
once the WLAN_STA_ASSOC is set.
Wouldn't this mean that this is already dead code now?

BR
Matthias
diff mbox

Patch

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 11f12f9..3262ae1 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2829,6 +2829,7 @@  static void handle_assoc_cb(struct hostapd_data *hapd,
 		new_assoc = 0;
 	sta->flags |= WLAN_STA_ASSOC;
 	sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
+	sta->flags &= ~WLAN_STA_WDS;
 	if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
 	    sta->auth_alg == WLAN_AUTH_FT) {
 		/*