aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Cardona <javier@cozybit.com>2010-12-03 03:20:40 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-06 16:01:28 -0500
commit45904f21655cf4f0ae7d0fab5906fe51bf56ecf4 (patch)
treefd023d65b881b6cfcf1529eed7c1ad2523c166e1
parentb9e61f11f47035e3b4545b51fb547fef48eb3096 (diff)
nl80211/mac80211: define and allow configuring mesh element TTL
The TTL in path selection information elements is different from the mesh ttl used in mesh data frames. Version 7.03 of the 11s draft calls this ttl 'Element TTL'. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/linux/nl80211.h4
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/mac80211/cfg.c2
-rw-r--r--net/mac80211/debugfs_netdev.c2
-rw-r--r--net/mac80211/mesh.c1
-rw-r--r--net/mac80211/mesh.h2
-rw-r--r--net/mac80211/mesh_hwmp.c9
-rw-r--r--net/mac80211/mesh_pathtbl.c7
-rw-r--r--net/wireless/nl80211.c5
9 files changed, 27 insertions, 7 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 5cfa579df476..9e541452d805 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1547,6 +1547,9 @@ enum nl80211_mntr_flags {
1547 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh 1547 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
1548 * point. 1548 * point.
1549 * 1549 *
1550 * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
1551 * source mesh point for path selection elements.
1552 *
1550 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically 1553 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
1551 * open peer links when we detect compatible mesh peers. 1554 * open peer links when we detect compatible mesh peers.
1552 * 1555 *
@@ -1593,6 +1596,7 @@ enum nl80211_meshconf_params {
1593 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, 1596 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
1594 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 1597 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1595 NL80211_MESHCONF_HWMP_ROOTMODE, 1598 NL80211_MESHCONF_HWMP_ROOTMODE,
1599 NL80211_MESHCONF_ELEMENT_TTL,
1596 1600
1597 /* keep last */ 1601 /* keep last */
1598 __NL80211_MESHCONF_ATTR_AFTER_LAST, 1602 __NL80211_MESHCONF_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 6b2af7aeddd3..93a4b2068334 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -624,6 +624,8 @@ struct mesh_config {
624 u16 dot11MeshMaxPeerLinks; 624 u16 dot11MeshMaxPeerLinks;
625 u8 dot11MeshMaxRetries; 625 u8 dot11MeshMaxRetries;
626 u8 dot11MeshTTL; 626 u8 dot11MeshTTL;
627 /* ttl used in path selection information elements */
628 u8 element_ttl;
627 bool auto_open_plinks; 629 bool auto_open_plinks;
628 /* HWMP parameters */ 630 /* HWMP parameters */
629 u8 dot11MeshHWMPmaxPREQretries; 631 u8 dot11MeshHWMPmaxPREQretries;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index db134b500caa..ce6936890c26 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1024,6 +1024,8 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy,
1024 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; 1024 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
1025 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) 1025 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
1026 conf->dot11MeshTTL = nconf->dot11MeshTTL; 1026 conf->dot11MeshTTL = nconf->dot11MeshTTL;
1027 if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask))
1028 conf->dot11MeshTTL = nconf->element_ttl;
1027 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) 1029 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
1028 conf->auto_open_plinks = nconf->auto_open_plinks; 1030 conf->auto_open_plinks = nconf->auto_open_plinks;
1029 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) 1031 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index cbdf36d7841c..2dabdf7680d0 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -251,6 +251,7 @@ IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
251IEEE80211_IF_FILE(dot11MeshHoldingTimeout, 251IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
252 u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); 252 u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
253IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); 253IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
254IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC);
254IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); 255IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
255IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, 256IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
256 u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); 257 u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
@@ -355,6 +356,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
355 MESHPARAMS_ADD(dot11MeshConfirmTimeout); 356 MESHPARAMS_ADD(dot11MeshConfirmTimeout);
356 MESHPARAMS_ADD(dot11MeshHoldingTimeout); 357 MESHPARAMS_ADD(dot11MeshHoldingTimeout);
357 MESHPARAMS_ADD(dot11MeshTTL); 358 MESHPARAMS_ADD(dot11MeshTTL);
359 MESHPARAMS_ADD(element_ttl);
358 MESHPARAMS_ADD(auto_open_plinks); 360 MESHPARAMS_ADD(auto_open_plinks);
359 MESHPARAMS_ADD(dot11MeshMaxPeerLinks); 361 MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
360 MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout); 362 MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index c8a4f19ed13b..78a36c79bdcc 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -668,6 +668,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
668 ifmsh->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T; 668 ifmsh->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T;
669 ifmsh->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR; 669 ifmsh->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR;
670 ifmsh->mshcfg.dot11MeshTTL = MESH_TTL; 670 ifmsh->mshcfg.dot11MeshTTL = MESH_TTL;
671 ifmsh->mshcfg.element_ttl = MESH_DEFAULT_ELEMENT_TTL;
671 ifmsh->mshcfg.auto_open_plinks = true; 672 ifmsh->mshcfg.auto_open_plinks = true;
672 ifmsh->mshcfg.dot11MeshMaxPeerLinks = 673 ifmsh->mshcfg.dot11MeshMaxPeerLinks =
673 MESH_MAX_ESTAB_PLINKS; 674 MESH_MAX_ESTAB_PLINKS;
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 58e741128968..182942eeac4d 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -216,6 +216,8 @@ struct mesh_rmc {
216#define PERR_RCODE_NO_ROUTE 12 216#define PERR_RCODE_NO_ROUTE 12
217#define PERR_RCODE_DEST_UNREACH 13 217#define PERR_RCODE_DEST_UNREACH 13
218 218
219#define MESH_DEFAULT_ELEMENT_TTL 31
220
219/* Public interfaces */ 221/* Public interfaces */
220/* Various */ 222/* Various */
221int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, 223int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 829e08a657d0..5bf64d7112b3 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -232,7 +232,7 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
232 *pos++ = WLAN_EID_PERR; 232 *pos++ = WLAN_EID_PERR;
233 *pos++ = ie_len; 233 *pos++ = ie_len;
234 /* ttl */ 234 /* ttl */
235 *pos++ = MESH_TTL; 235 *pos++ = ttl;
236 /* number of destinations */ 236 /* number of destinations */
237 *pos++ = 1; 237 *pos++ = 1;
238 /* 238 /*
@@ -522,7 +522,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
522 522
523 if (reply) { 523 if (reply) {
524 lifetime = PREQ_IE_LIFETIME(preq_elem); 524 lifetime = PREQ_IE_LIFETIME(preq_elem);
525 ttl = ifmsh->mshcfg.dot11MeshTTL; 525 ttl = ifmsh->mshcfg.element_ttl;
526 if (ttl != 0) { 526 if (ttl != 0) {
527 mhwmp_dbg("replying to the PREQ\n"); 527 mhwmp_dbg("replying to the PREQ\n");
528 mesh_path_sel_frame_tx(MPATH_PREP, 0, target_addr, 528 mesh_path_sel_frame_tx(MPATH_PREP, 0, target_addr,
@@ -877,7 +877,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
877 sdata->u.mesh.last_sn_update = jiffies; 877 sdata->u.mesh.last_sn_update = jiffies;
878 } 878 }
879 lifetime = default_lifetime(sdata); 879 lifetime = default_lifetime(sdata);
880 ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; 880 ttl = sdata->u.mesh.mshcfg.element_ttl;
881 if (ttl == 0) { 881 if (ttl == 0) {
882 sdata->u.mesh.mshstats.dropped_frames_ttl++; 882 sdata->u.mesh.mshstats.dropped_frames_ttl++;
883 spin_unlock_bh(&mpath->state_lock); 883 spin_unlock_bh(&mpath->state_lock);
@@ -1013,5 +1013,6 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
1013 mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr, 1013 mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr,
1014 cpu_to_le32(++ifmsh->sn), 1014 cpu_to_le32(++ifmsh->sn),
1015 0, NULL, 0, broadcast_addr, 1015 0, NULL, 0, broadcast_addr,
1016 0, MESH_TTL, 0, 0, 0, sdata); 1016 0, sdata->u.mesh.mshcfg.element_ttl,
1017 0, 0, 0, sdata);
1017} 1018}
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 349e466cf08b..8d65b47d9837 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -467,8 +467,8 @@ void mesh_plink_broken(struct sta_info *sta)
467 mpath->flags &= ~MESH_PATH_ACTIVE; 467 mpath->flags &= ~MESH_PATH_ACTIVE;
468 ++mpath->sn; 468 ++mpath->sn;
469 spin_unlock_bh(&mpath->state_lock); 469 spin_unlock_bh(&mpath->state_lock);
470 mesh_path_error_tx(MESH_TTL, mpath->dst, 470 mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl,
471 cpu_to_le32(mpath->sn), 471 mpath->dst, cpu_to_le32(mpath->sn),
472 cpu_to_le16(PERR_RCODE_DEST_UNREACH), 472 cpu_to_le16(PERR_RCODE_DEST_UNREACH),
473 bcast, sdata); 473 bcast, sdata);
474 } else 474 } else
@@ -614,7 +614,8 @@ void mesh_path_discard_frame(struct sk_buff *skb,
614 mpath = mesh_path_lookup(da, sdata); 614 mpath = mesh_path_lookup(da, sdata);
615 if (mpath) 615 if (mpath)
616 sn = ++mpath->sn; 616 sn = ++mpath->sn;
617 mesh_path_error_tx(MESH_TTL, skb->data, cpu_to_le32(sn), 617 mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, skb->data,
618 cpu_to_le32(sn),
618 cpu_to_le16(PERR_RCODE_NO_ROUTE), ra, sdata); 619 cpu_to_le16(PERR_RCODE_NO_ROUTE), ra, sdata);
619 } 620 }
620 621
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 960be4e650f0..0b90cab5da2f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2582,6 +2582,8 @@ static int nl80211_get_mesh_params(struct sk_buff *skb,
2582 cur_params.dot11MeshMaxRetries); 2582 cur_params.dot11MeshMaxRetries);
2583 NLA_PUT_U8(msg, NL80211_MESHCONF_TTL, 2583 NLA_PUT_U8(msg, NL80211_MESHCONF_TTL,
2584 cur_params.dot11MeshTTL); 2584 cur_params.dot11MeshTTL);
2585 NLA_PUT_U8(msg, NL80211_MESHCONF_ELEMENT_TTL,
2586 cur_params.element_ttl);
2585 NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, 2587 NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS,
2586 cur_params.auto_open_plinks); 2588 cur_params.auto_open_plinks);
2587 NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, 2589 NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
@@ -2623,6 +2625,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A
2623 [NL80211_MESHCONF_MAX_PEER_LINKS] = { .type = NLA_U16 }, 2625 [NL80211_MESHCONF_MAX_PEER_LINKS] = { .type = NLA_U16 },
2624 [NL80211_MESHCONF_MAX_RETRIES] = { .type = NLA_U8 }, 2626 [NL80211_MESHCONF_MAX_RETRIES] = { .type = NLA_U8 },
2625 [NL80211_MESHCONF_TTL] = { .type = NLA_U8 }, 2627 [NL80211_MESHCONF_TTL] = { .type = NLA_U8 },
2628 [NL80211_MESHCONF_ELEMENT_TTL] = { .type = NLA_U8 },
2626 [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 }, 2629 [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 },
2627 2630
2628 [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 }, 2631 [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 },
@@ -2670,6 +2673,8 @@ static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info)
2670 mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8); 2673 mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8);
2671 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL, 2674 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL,
2672 mask, NL80211_MESHCONF_TTL, nla_get_u8); 2675 mask, NL80211_MESHCONF_TTL, nla_get_u8);
2676 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, element_ttl,
2677 mask, NL80211_MESHCONF_ELEMENT_TTL, nla_get_u8);
2673 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks, 2678 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks,
2674 mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8); 2679 mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8);
2675 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries, 2680 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries,