From 08969144ad9ee0446a3478dee12fbb65249071e9 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 26 Apr 2010 23:07:44 +0000 Subject: [PATCH] mac80211: add ap isolate support git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21178 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/800-cfg80211_ap_isolate.patch | 66 +++++++++++++++++++ .../patches/801-mac80211_ap_isolate.patch | 16 +++++ .../patches/802-mac80211_cfg_fix.patch | 23 +++++++ 3 files changed, 105 insertions(+) create mode 100644 package/mac80211/patches/800-cfg80211_ap_isolate.patch create mode 100644 package/mac80211/patches/801-mac80211_ap_isolate.patch create mode 100644 package/mac80211/patches/802-mac80211_cfg_fix.patch diff --git a/package/mac80211/patches/800-cfg80211_ap_isolate.patch b/package/mac80211/patches/800-cfg80211_ap_isolate.patch new file mode 100644 index 000000000..c9a241ace --- /dev/null +++ b/package/mac80211/patches/800-cfg80211_ap_isolate.patch @@ -0,0 +1,66 @@ +--- a/include/linux/nl80211.h ++++ b/include/linux/nl80211.h +@@ -709,6 +709,9 @@ enum nl80211_commands { + * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE, + * NL80211_CMD_DISASSOCIATE. + * ++ * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations ++ * connected to this BSS. ++ * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +@@ -864,6 +867,8 @@ enum nl80211_attrs { + + NL80211_ATTR_LOCAL_STATE_CHANGE, + ++ NL80211_ATTR_AP_ISOLATE, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -512,6 +512,7 @@ struct mpath_info { + * @basic_rates: basic rates in IEEE 802.11 format + * (or NULL for no change) + * @basic_rates_len: number of basic rates ++ * @ap_isolate: do not forward packets between connected stations + */ + struct bss_parameters { + int use_cts_prot; +@@ -519,6 +520,7 @@ struct bss_parameters { + int use_short_slot_time; + u8 *basic_rates; + u8 basic_rates_len; ++ int ap_isolate; + }; + + struct mesh_config { +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -154,6 +154,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_PS_STATE] = { .type = NLA_U32 }, + [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, + [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG }, ++ [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 }, + }; + + /* policy for the attributes */ +@@ -2449,6 +2450,7 @@ static int nl80211_set_bss(struct sk_buf + params.use_cts_prot = -1; + params.use_short_preamble = -1; + params.use_short_slot_time = -1; ++ params.ap_isolate = -1; + + if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) + params.use_cts_prot = +@@ -2465,6 +2467,8 @@ static int nl80211_set_bss(struct sk_buf + params.basic_rates_len = + nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); + } ++ if (info->attrs[NL80211_ATTR_AP_ISOLATE]) ++ params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); + + rtnl_lock(); + diff --git a/package/mac80211/patches/801-mac80211_ap_isolate.patch b/package/mac80211/patches/801-mac80211_ap_isolate.patch new file mode 100644 index 000000000..9bcf1029d --- /dev/null +++ b/package/mac80211/patches/801-mac80211_ap_isolate.patch @@ -0,0 +1,16 @@ +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1115,6 +1115,13 @@ static int ieee80211_change_bss(struct w + changed |= BSS_CHANGED_BASIC_RATES; + } + ++ if (params->ap_isolate >= 0) { ++ if (params->ap_isolate) ++ sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; ++ else ++ sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; ++ } ++ + ieee80211_bss_info_change_notify(sdata, changed); + + return 0; diff --git a/package/mac80211/patches/802-mac80211_cfg_fix.patch b/package/mac80211/patches/802-mac80211_cfg_fix.patch new file mode 100644 index 000000000..0ed0b6bd4 --- /dev/null +++ b/package/mac80211/patches/802-mac80211_cfg_fix.patch @@ -0,0 +1,23 @@ +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -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; + } + -- 2.20.1