diff options
author | Chun-Yeow Yeoh <yeohchunyeow@gmail.com> | 2012-01-20 12:02:16 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-27 14:56:56 -0500 |
commit | 94f9065648a2645b28187b44ec7778c30cf58758 (patch) | |
tree | 734ee883e3fbd99de04240da97716d773d64bb6d | |
parent | 2da8f419e78a0ebccc91c095328278fe668a7932 (diff) |
{nl,cfg,mac}80211: Add support of setting non-forwarding entity in Mesh
A mesh node that joins the mesh network is by default a forwarding entity. This patch allows
the mesh node to set as non-forwarding entity. Whenever dot11MeshForwarding is set to 0, the
mesh node can prevent itself from forwarding the traffic which is not destined to him.
Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 4 | ||||
-rw-r--r-- | include/net/cfg80211.h | 1 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 2 | ||||
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 1 | ||||
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 2 | ||||
-rw-r--r-- | net/wireless/mesh.c | 1 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 5 |
7 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 0f5ff3739820..4f98fae13307 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -2104,6 +2104,9 @@ enum nl80211_mntr_flags { | |||
2104 | * TUs) during which a mesh STA can send only one Action frame containing a | 2104 | * TUs) during which a mesh STA can send only one Action frame containing a |
2105 | * PERR element. | 2105 | * PERR element. |
2106 | * | 2106 | * |
2107 | * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding | ||
2108 | * or forwarding entity (default is TRUE - forwarding entity) | ||
2109 | * | ||
2107 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | 2110 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute |
2108 | * | 2111 | * |
2109 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | 2112 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use |
@@ -2128,6 +2131,7 @@ enum nl80211_meshconf_params { | |||
2128 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | 2131 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, |
2129 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, | 2132 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, |
2130 | NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, | 2133 | NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, |
2134 | NL80211_MESHCONF_FORWARDING, | ||
2131 | 2135 | ||
2132 | /* keep last */ | 2136 | /* keep last */ |
2133 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | 2137 | __NL80211_MESHCONF_ATTR_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 208a7b5f8d49..281899167d2d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -798,6 +798,7 @@ struct mesh_config { | |||
798 | * mesh gate, but not necessarily using the gate announcement protocol. | 798 | * mesh gate, but not necessarily using the gate announcement protocol. |
799 | * Still keeping the same nomenclature to be in sync with the spec. */ | 799 | * Still keeping the same nomenclature to be in sync with the spec. */ |
800 | bool dot11MeshGateAnnouncementProtocol; | 800 | bool dot11MeshGateAnnouncementProtocol; |
801 | bool dot11MeshForwarding; | ||
801 | }; | 802 | }; |
802 | 803 | ||
803 | /** | 804 | /** |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 74c9301681e5..98460783c2d3 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1346,6 +1346,8 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, | |||
1346 | conf->dot11MeshHWMPRannInterval = | 1346 | conf->dot11MeshHWMPRannInterval = |
1347 | nconf->dot11MeshHWMPRannInterval; | 1347 | nconf->dot11MeshHWMPRannInterval; |
1348 | } | 1348 | } |
1349 | if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask)) | ||
1350 | conf->dot11MeshForwarding = nconf->dot11MeshForwarding; | ||
1349 | return 0; | 1351 | return 0; |
1350 | } | 1352 | } |
1351 | 1353 | ||
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 176c08ffb13c..81d12e65a23c 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -422,6 +422,7 @@ IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol, | |||
422 | u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC); | 422 | u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC); |
423 | IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, | 423 | IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, |
424 | u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); | 424 | u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); |
425 | IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC); | ||
425 | #endif | 426 | #endif |
426 | 427 | ||
427 | 428 | ||
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 73abb7524b2c..cae407136ae0 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -575,7 +575,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
575 | ifmsh->mshstats.dropped_frames_ttl++; | 575 | ifmsh->mshstats.dropped_frames_ttl++; |
576 | } | 576 | } |
577 | 577 | ||
578 | if (forward) { | 578 | if (forward && ifmsh->mshcfg.dot11MeshForwarding) { |
579 | u32 preq_id; | 579 | u32 preq_id; |
580 | u8 hopcount, flags; | 580 | u8 hopcount, flags; |
581 | 581 | ||
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 8c550df13037..9d3e3b6bfcf4 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -55,6 +55,7 @@ const struct mesh_config default_mesh_config = { | |||
55 | .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, | 55 | .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, |
56 | .dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL, | 56 | .dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL, |
57 | .dot11MeshGateAnnouncementProtocol = false, | 57 | .dot11MeshGateAnnouncementProtocol = false, |
58 | .dot11MeshForwarding = true, | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | const struct mesh_setup default_mesh_setup = { | 61 | const struct mesh_setup default_mesh_setup = { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5cefd74ab47d..c42173f947ef 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3258,6 +3258,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, | |||
3258 | cur_params.dot11MeshHWMPRannInterval); | 3258 | cur_params.dot11MeshHWMPRannInterval); |
3259 | NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, | 3259 | NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, |
3260 | cur_params.dot11MeshGateAnnouncementProtocol); | 3260 | cur_params.dot11MeshGateAnnouncementProtocol); |
3261 | NLA_PUT_U8(msg, NL80211_MESHCONF_FORWARDING, | ||
3262 | cur_params.dot11MeshForwarding); | ||
3261 | nla_nest_end(msg, pinfoattr); | 3263 | nla_nest_end(msg, pinfoattr); |
3262 | genlmsg_end(msg, hdr); | 3264 | genlmsg_end(msg, hdr); |
3263 | return genlmsg_reply(msg, info); | 3265 | return genlmsg_reply(msg, info); |
@@ -3289,6 +3291,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A | |||
3289 | [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, | 3291 | [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, |
3290 | [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, | 3292 | [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, |
3291 | [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 }, | 3293 | [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 }, |
3294 | [NL80211_MESHCONF_FORWARDING] = { .type = NLA_U8 }, | ||
3292 | }; | 3295 | }; |
3293 | 3296 | ||
3294 | static const struct nla_policy | 3297 | static const struct nla_policy |
@@ -3378,6 +3381,8 @@ do {\ | |||
3378 | dot11MeshGateAnnouncementProtocol, mask, | 3381 | dot11MeshGateAnnouncementProtocol, mask, |
3379 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, | 3382 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, |
3380 | nla_get_u8); | 3383 | nla_get_u8); |
3384 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, | ||
3385 | mask, NL80211_MESHCONF_FORWARDING, nla_get_u8); | ||
3381 | if (mask_out) | 3386 | if (mask_out) |
3382 | *mask_out = mask; | 3387 | *mask_out = mask; |
3383 | 3388 | ||