Hi, Thomas

I have completed the patches to allow setting of non-forwarding entity in
mesh.

The command *"iw mesh0 set mesh_param mesh_forwarding 0"* ensures that the
mesh node not forwarding packets to others.

Anyway, if this is set before other nodes joining the mesh, the mesh node
need to initiate the communication (such as DHCP request) before
communication is go through for single hop communication.

Feel free to comment. Let me know.

Regards,
Chun-Yeow

>From 895678d14ca3ad41dcf0befb3a718645b93eb88f Mon Sep 17 00:00:00 2001
From: Chun-Yeow Yeoh <[email protected]>
Date: Wed, 18 Jan 2012 00:10:32 +0800
Subject: [PATCH] {nl,cfg,mac}80211: Support non-forwarding entity in Mesh

Signed-off-by: Chun-Yeow Yeoh <[email protected]>
---
 include/linux/nl80211.h       |    4 ++++
 include/net/cfg80211.h        |    1 +
 net/mac80211/cfg.c            |    2 ++
 net/mac80211/debugfs_netdev.c |    2 ++
 net/mac80211/mesh_hwmp.c      |    2 +-
 net/mac80211/rx.c             |    3 +++
 net/wireless/mesh.c           |    1 +
 net/wireless/nl80211.c        |    5 +++++
 8 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index a187606..c2c3538 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -2098,6 +2098,9 @@ enum nl80211_mntr_flags {
  * TUs) during which a mesh STA can send only one Action frame containing a
  * 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_AFTER_LAST: internal use
@@ -2122,6 +2125,7 @@ enum nl80211_meshconf_params {
  NL80211_MESHCONF_HWMP_RANN_INTERVAL,
  NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
  NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
+ NL80211_MESHCONF_FORWARDING,

  /* keep last */
  __NL80211_MESHCONF_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3de1c39..8f78acb 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -791,6 +791,7 @@ struct mesh_config {
  * mesh gate, but not necessarily using the gate announcement protocol.
  * Still keeping the same nomenclature to be in sync with the spec. */
  bool  dot11MeshGateAnnouncementProtocol;
+ bool dot11MeshForwarding;
 };

 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 393b2a4..6252bee 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1299,6 +1299,8 @@ static int ieee80211_update_mesh_config(struct wiphy
*wiphy,
  conf->dot11MeshHWMPRannInterval =
  nconf->dot11MeshHWMPRannInterval;
  }
+ if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask))
+ conf->dot11MeshForwarding = nconf->dot11MeshForwarding;
  return 0;
 }

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 8df2891..46fb0db 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -421,6 +421,8 @@ IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol,
  u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC);
 IEEE80211_IF_FILE(dot11MeshHWMPRannInterval,
  u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC);
+IEEE80211_IF_FILE(dot11MeshForwarding,
+ u.mesh.mshcfg.dot11MeshForwarding, DEC);
 #endif


diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 73abb75..cae4071 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,
  ifmsh->mshstats.dropped_frames_ttl++;
  }

- if (forward) {
+ if (forward && ifmsh->mshcfg.dot11MeshForwarding) {
  u32 preq_id;
  u8 hopcount, flags;

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7d22641..1df471b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1968,6 +1968,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data
*rx)
  return RX_DROP_MONITOR;
  }

+ if (!ifmsh->mshcfg.dot11MeshForwarding)
+ goto out;
+
  fwd_skb = skb_copy(skb, GFP_ATOMIC);
  if (!fwd_skb) {
  if (net_ratelimit())
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 8c550df..9d3e3b6 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -55,6 +55,7 @@ const struct mesh_config default_mesh_config = {
  .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT,
  .dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL,
  .dot11MeshGateAnnouncementProtocol = false,
+ .dot11MeshForwarding = true,
 };

 const struct mesh_setup default_mesh_setup = {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ba43966..d88ec25 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3205,6 +3205,8 @@ static int nl80211_get_mesh_config(struct sk_buff
*skb,
  cur_params.dot11MeshHWMPRannInterval);
  NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
  cur_params.dot11MeshGateAnnouncementProtocol);
+ NLA_PUT_U8(msg, NL80211_MESHCONF_FORWARDING,
+ cur_params.dot11MeshForwarding);
  nla_nest_end(msg, pinfoattr);
  genlmsg_end(msg, hdr);
  return genlmsg_reply(msg, info);
@@ -3236,6 +3238,7 @@ static const struct nla_policy
nl80211_meshconf_params_policy[NL80211_MESHCONF_A
  [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 },
  [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 },
  [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 },
+ [NL80211_MESHCONF_FORWARDING] = { .type = NLA_U8 },
 };

 static const struct nla_policy
@@ -3325,6 +3328,8 @@ do {\
  dot11MeshGateAnnouncementProtocol, mask,
  NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
  nla_get_u8);
+ FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding,
+ mask, NL80211_MESHCONF_FORWARDING, nla_get_u8);
  if (mask_out)
  *mask_out = mask;

--
1.7.0.4

*
--------------------------------------------------------------------------------------------
*

>From d2b42624ad5106dd3b49917e346f0485f30f5f14 Mon Sep 17 00:00:00 2001
From: Chun-Yeow Yeoh <[email protected]>
Date: Wed, 18 Jan 2012 00:36:34 +0800
Subject: [PATCH] Support non-forwarding entity in Mesh

Signed-off-by: Chun-Yeow Yeoh <[email protected]>
---
 mesh.c    |    5 +++++
 nl80211.h |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/mesh.c b/mesh.c
index dc8f49c..f815f4c 100644
--- a/mesh.c
+++ b/mesh.c
@@ -177,6 +177,11 @@ const static struct mesh_param_descr
_mesh_param_descrs[] =
  _my_nla_put_u16, _parse_u16, _print_u16},
  {"mesh_gate_announcements", NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
  _my_nla_put_u8, _parse_u8, _print_u8},
+ {"mesh_hwmp_perr_min_interval",
+ NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
+ _my_nla_put_u16, _parse_u16, _print_u16_in_TUs},
+ {"mesh_forwarding", NL80211_MESHCONF_FORWARDING,
+ _my_nla_put_u8, _parse_u8_as_bool, _print_u8},
 };

 static void print_all_mesh_param_descr(void)
diff --git a/nl80211.h b/nl80211.h
index a187606..7d3d992 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -2098,6 +2098,10 @@ enum nl80211_mntr_flags {
  * TUs) during which a mesh STA can send only one Action frame containing a
  * 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_AFTER_LAST: internal use
@@ -2122,6 +2126,7 @@ enum nl80211_meshconf_params {
  NL80211_MESHCONF_HWMP_RANN_INTERVAL,
  NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
  NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
+ NL80211_MESHCONF_FORWARDING,

  /* keep last */
  __NL80211_MESHCONF_ATTR_AFTER_LAST,
-- 
1.7.0.4

Attachment: iw-dot11MeshForwarding.patch
Description: Binary data

Attachment: dot11MeshForwarding.patch
Description: Binary data

_______________________________________________
Devel mailing list
[email protected]
http://open80211s.com/mailman/listinfo/devel

Reply via email to