Skip to contentSkip to conversation

nl80211: prevent additions to old station flags API

RFC New Johannes Berg 1 participant 1 message Apr 6, 2012 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

RFC 1/1 nl80211: prevent additions to old station flags API

From: Johannes Berg <[email protected]>

We don't really want/need to maintain the old
station flags API any more, so refuse changes
to new (not yet defined) flags from the old
flags API.

---
 include/linux/nl80211.h |    2 ++
 net/wireless/nl80211.c  |   10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
include/linux/nl80211.h +2 -0
@@ -1587,6 +1587,8 @@ enum nl80211_sta_flags {
 	NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
 };
 
+#define NL80211_STA_FLAG_MAX_OLD_API	NL80211_STA_FLAG_TDLS_PEER
+
 /**
  * struct nl80211_sta_flag_update - station flags mask/set
  * @mask: mask of station flags to set
net/wireless/nl80211.c +8 -2
@@ -2357,10 +2357,16 @@ static int parse_station_flags(struct ge
 		return -EINVAL;
 	}
 
-	for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++)
-		if (flags[flag])
+	for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) {
+		if (flags[flag]) {
 			params->sta_flags_set |= (1<<flag);
 
+			/* no longer support new API additions in old API */
+			if (flag > NL80211_STA_FLAG_MAX_OLD_API)
+				return -EINVAL;
+		}
+	}
+
 	return 0;
 }