Skip to contentSkip to conversation

mac80211: fix handling of 4-address-mode in ieee80211_change_iface

PATCH Superseded Felix Fietkau 2 participants 3 messages Apr 26, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix handling of 4-address-mode in ieee80211_change_iface

A misplaced interface type check bails out too early if the interface is not in monitor mode. This patch moves it to the right place, so that it only covers changes to the monitor flags.

---

net/mac80211/cfg.c +3 -3
@@ -97,9 +97,6 @@ static int ieee80211_change_iface(struct
 					    params->mesh_id_len,
 					    params->mesh_id);
 
-	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
-		return 0;
-
 	if (type == NL80211_IFTYPE_AP_VLAN &&
 	    params && params->use_4addr == 0)
 		rcu_assign_pointer(sdata->u.vlan.sta, NULL);
@@ -107,6 +104,9 @@ static int ieee80211_change_iface(struct
 		 params && params->use_4addr >= 0)
 		sdata->u.mgd.use_4addr = params->use_4addr;
 
+	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
+		return 0;
+
 	sdata->u.mntr_flags = *flags;
 	return 0;
 }
#1 lore raw
Quoted 3 lines · Felix Fietkau

A misplaced interface type check bails out too early if the interface is not in monitor mode. This patch moves it to the right place, so that it only covers changes to the monitor flags.

...

net/mac80211/cfg.c static int ieee80211_change_iface(struct · line 112

Quoted 6 lines
net/mac80211/cfg.c +3 -0
+	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
+		return 0;
+
 	sdata->u.mntr_flags = *flags;
 	return 0;
 }

Perhaps you could write it in a more readable way:

       if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags)
               sdata->u.mntr_flags = *flags;

       return 0;

Just an idea, not an objection.

Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw

PATCH v2 1/1 mac80211: fix handling of 4-address-mode in ieee80211_change_iface

A misplaced interface type check bails out too early if the interface is not in monitor mode. This patch moves it to the right place, so that it only covers changes to the monitor flags.

---

net/mac80211/cfg.c +3 -4
@@ -97,9 +97,6 @@ static int ieee80211_change_iface(struct
 					    params->mesh_id_len,
 					    params->mesh_id);
 
-	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
-		return 0;
-
 	if (type == NL80211_IFTYPE_AP_VLAN &&
 	    params && params->use_4addr == 0)
 		rcu_assign_pointer(sdata->u.vlan.sta, NULL);
@@ -107,7 +104,9 @@ static int ieee80211_change_iface(struct
 		 params && params->use_4addr >= 0)
 		sdata->u.mgd.use_4addr = params->use_4addr;
 
-	sdata->u.mntr_flags = *flags;
+	if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags)
+		sdata->u.mntr_flags = *flags;
+
 	return 0;
 }