Commit 94f90656 authored by Chun-Yeow Yeoh's avatar Chun-Yeow Yeoh Committed by John W. Linville

{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: default avatarChun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2da8f419
...@@ -2104,6 +2104,9 @@ enum nl80211_mntr_flags { ...@@ -2104,6 +2104,9 @@ enum nl80211_mntr_flags {
* TUs) during which a mesh STA can send only one Action frame containing a * TUs) during which a mesh STA can send only one Action frame containing a
* PERR element. * PERR element.
* *
* @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding
* or forwarding entity (default is TRUE - forwarding entity)
*
* @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
* *
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
...@@ -2128,6 +2131,7 @@ enum nl80211_meshconf_params { ...@@ -2128,6 +2131,7 @@ enum nl80211_meshconf_params {
NL80211_MESHCONF_HWMP_RANN_INTERVAL, NL80211_MESHCONF_HWMP_RANN_INTERVAL,
NL80211_MESHCONF_GATE_ANNOUNCEMENTS, NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
NL80211_MESHCONF_FORWARDING,
/* keep last */ /* keep last */
__NL80211_MESHCONF_ATTR_AFTER_LAST, __NL80211_MESHCONF_ATTR_AFTER_LAST,
......
...@@ -798,6 +798,7 @@ struct mesh_config { ...@@ -798,6 +798,7 @@ struct mesh_config {
* mesh gate, but not necessarily using the gate announcement protocol. * mesh gate, but not necessarily using the gate announcement protocol.
* Still keeping the same nomenclature to be in sync with the spec. */ * Still keeping the same nomenclature to be in sync with the spec. */
bool dot11MeshGateAnnouncementProtocol; bool dot11MeshGateAnnouncementProtocol;
bool dot11MeshForwarding;
}; };
/** /**
......
...@@ -1346,6 +1346,8 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, ...@@ -1346,6 +1346,8 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,
conf->dot11MeshHWMPRannInterval = conf->dot11MeshHWMPRannInterval =
nconf->dot11MeshHWMPRannInterval; nconf->dot11MeshHWMPRannInterval;
} }
if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask))
conf->dot11MeshForwarding = nconf->dot11MeshForwarding;
return 0; return 0;
} }
......
...@@ -422,6 +422,7 @@ IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol, ...@@ -422,6 +422,7 @@ IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol,
u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC); u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC);
IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, IEEE80211_IF_FILE(dot11MeshHWMPRannInterval,
u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC);
IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC);
#endif #endif
......
...@@ -575,7 +575,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, ...@@ -575,7 +575,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
ifmsh->mshstats.dropped_frames_ttl++; ifmsh->mshstats.dropped_frames_ttl++;
} }
if (forward) { if (forward && ifmsh->mshcfg.dot11MeshForwarding) {
u32 preq_id; u32 preq_id;
u8 hopcount, flags; u8 hopcount, flags;
......
...@@ -55,6 +55,7 @@ const struct mesh_config default_mesh_config = { ...@@ -55,6 +55,7 @@ const struct mesh_config default_mesh_config = {
.min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT,
.dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL, .dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL,
.dot11MeshGateAnnouncementProtocol = false, .dot11MeshGateAnnouncementProtocol = false,
.dot11MeshForwarding = true,
}; };
const struct mesh_setup default_mesh_setup = { const struct mesh_setup default_mesh_setup = {
......
...@@ -3258,6 +3258,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, ...@@ -3258,6 +3258,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
cur_params.dot11MeshHWMPRannInterval); cur_params.dot11MeshHWMPRannInterval);
NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
cur_params.dot11MeshGateAnnouncementProtocol); cur_params.dot11MeshGateAnnouncementProtocol);
NLA_PUT_U8(msg, NL80211_MESHCONF_FORWARDING,
cur_params.dot11MeshForwarding);
nla_nest_end(msg, pinfoattr); nla_nest_end(msg, pinfoattr);
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
return genlmsg_reply(msg, info); return genlmsg_reply(msg, info);
...@@ -3289,6 +3291,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A ...@@ -3289,6 +3291,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A
[NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 },
[NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 },
[NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 }, [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 },
[NL80211_MESHCONF_FORWARDING] = { .type = NLA_U8 },
}; };
static const struct nla_policy static const struct nla_policy
...@@ -3378,6 +3381,8 @@ do {\ ...@@ -3378,6 +3381,8 @@ do {\
dot11MeshGateAnnouncementProtocol, mask, dot11MeshGateAnnouncementProtocol, mask,
NL80211_MESHCONF_GATE_ANNOUNCEMENTS, NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
nla_get_u8); nla_get_u8);
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding,
mask, NL80211_MESHCONF_FORWARDING, nla_get_u8);
if (mask_out) if (mask_out)
*mask_out = mask; *mask_out = mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment