aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-11-10 14:10:05 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 17:02:10 -0500
commitf14543ee4d0681df1377b976cba704557ba220d3 (patch)
treef148485869f6638030207c069742c1918647be6a /net/mac80211/cfg.c
parent8b787643ca0a5130c647109d77fe512f89cfa611 (diff)
mac80211: implement support for 4-address frames for AP and client mode
In some situations it might be useful to run a network with an Access Point and multiple clients, but with each client bridged to a network behind it. For this to work, both the client and the AP need to transmit 4-address frames, containing both source and destination MAC addresses. With this patch, you can configure a client to communicate using only 4-address frames for data traffic. On the AP side you can enable 4-address frames for individual clients by isolating them in separate AP VLANs which are configured in 4-address mode. Such an AP VLAN will be limited to one client only, and this client will be used as the destination for all traffic on its interface, regardless of the destination MAC address in the packet headers. The advantage of this mode compared to regular WDS mode is that it's easier to configure and does not require a static list of peer MAC addresses on any side. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 56319b51d170..576b86f81d1b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -36,6 +36,24 @@ static bool nl80211_type_check(enum nl80211_iftype type)
36 } 36 }
37} 37}
38 38
39static bool nl80211_params_check(enum nl80211_iftype type,
40 struct vif_params *params)
41{
42 if (!nl80211_type_check(type))
43 return false;
44
45 if (params->use_4addr > 0) {
46 switch(type) {
47 case NL80211_IFTYPE_AP_VLAN:
48 case NL80211_IFTYPE_STATION:
49 break;
50 default:
51 return false;
52 }
53 }
54 return true;
55}
56
39static int ieee80211_add_iface(struct wiphy *wiphy, char *name, 57static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
40 enum nl80211_iftype type, u32 *flags, 58 enum nl80211_iftype type, u32 *flags,
41 struct vif_params *params) 59 struct vif_params *params)
@@ -45,7 +63,7 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
45 struct ieee80211_sub_if_data *sdata; 63 struct ieee80211_sub_if_data *sdata;
46 int err; 64 int err;
47 65
48 if (!nl80211_type_check(type)) 66 if (!nl80211_params_check(type, params))
49 return -EINVAL; 67 return -EINVAL;
50 68
51 err = ieee80211_if_add(local, name, &dev, type, params); 69 err = ieee80211_if_add(local, name, &dev, type, params);
@@ -75,7 +93,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
75 if (netif_running(dev)) 93 if (netif_running(dev))
76 return -EBUSY; 94 return -EBUSY;
77 95
78 if (!nl80211_type_check(type)) 96 if (!nl80211_params_check(type, params))
79 return -EINVAL; 97 return -EINVAL;
80 98
81 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 99 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -89,6 +107,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
89 params->mesh_id_len, 107 params->mesh_id_len,
90 params->mesh_id); 108 params->mesh_id);
91 109
110 if (params->use_4addr >= 0)
111 sdata->use_4addr = !!params->use_4addr;
112
92 if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags) 113 if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
93 return 0; 114 return 0;
94 115
@@ -806,6 +827,13 @@ static int ieee80211_change_station(struct wiphy *wiphy,
806 return -EINVAL; 827 return -EINVAL;
807 } 828 }
808 829
830 if (vlansdata->use_4addr) {
831 if (vlansdata->u.vlan.sta)
832 return -EBUSY;
833
834 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
835 }
836
809 sta->sdata = vlansdata; 837 sta->sdata = vlansdata;
810 ieee80211_send_layer2_update(sta); 838 ieee80211_send_layer2_update(sta);
811 } 839 }