Skip to content

Commit 45904f2

Browse files
Javier Cardonalinvjw
authored andcommitted
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 <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent b9e61f1 commit 45904f2

File tree

9 files changed

+27
-7
lines changed

9 files changed

+27
-7
lines changed

include/linux/nl80211.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,9 @@ enum nl80211_mntr_flags {
15471547
* @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
15481548
* point.
15491549
*
1550+
* @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
1551+
* source mesh point for path selection elements.
1552+
*
15501553
* @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
15511554
* open peer links when we detect compatible mesh peers.
15521555
*
@@ -1593,6 +1596,7 @@ enum nl80211_meshconf_params {
15931596
NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
15941597
NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
15951598
NL80211_MESHCONF_HWMP_ROOTMODE,
1599+
NL80211_MESHCONF_ELEMENT_TTL,
15961600

15971601
/* keep last */
15981602
__NL80211_MESHCONF_ATTR_AFTER_LAST,

include/net/cfg80211.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ struct mesh_config {
624624
u16 dot11MeshMaxPeerLinks;
625625
u8 dot11MeshMaxRetries;
626626
u8 dot11MeshTTL;
627+
/* ttl used in path selection information elements */
628+
u8 element_ttl;
627629
bool auto_open_plinks;
628630
/* HWMP parameters */
629631
u8 dot11MeshHWMPmaxPREQretries;

net/mac80211/cfg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,8 @@ static int ieee80211_set_mesh_params(struct wiphy *wiphy,
10241024
conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
10251025
if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
10261026
conf->dot11MeshTTL = nconf->dot11MeshTTL;
1027+
if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask))
1028+
conf->dot11MeshTTL = nconf->element_ttl;
10271029
if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
10281030
conf->auto_open_plinks = nconf->auto_open_plinks;
10291031
if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))

net/mac80211/debugfs_netdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
251251
IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
252252
u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
253253
IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
254+
IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC);
254255
IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
255256
IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
256257
u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
@@ -355,6 +356,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
355356
MESHPARAMS_ADD(dot11MeshConfirmTimeout);
356357
MESHPARAMS_ADD(dot11MeshHoldingTimeout);
357358
MESHPARAMS_ADD(dot11MeshTTL);
359+
MESHPARAMS_ADD(element_ttl);
358360
MESHPARAMS_ADD(auto_open_plinks);
359361
MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
360362
MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);

net/mac80211/mesh.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
668668
ifmsh->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T;
669669
ifmsh->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR;
670670
ifmsh->mshcfg.dot11MeshTTL = MESH_TTL;
671+
ifmsh->mshcfg.element_ttl = MESH_DEFAULT_ELEMENT_TTL;
671672
ifmsh->mshcfg.auto_open_plinks = true;
672673
ifmsh->mshcfg.dot11MeshMaxPeerLinks =
673674
MESH_MAX_ESTAB_PLINKS;

net/mac80211/mesh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ struct mesh_rmc {
216216
#define PERR_RCODE_NO_ROUTE 12
217217
#define PERR_RCODE_DEST_UNREACH 13
218218

219+
#define MESH_DEFAULT_ELEMENT_TTL 31
220+
219221
/* Public interfaces */
220222
/* Various */
221223
int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,

net/mac80211/mesh_hwmp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
232232
*pos++ = WLAN_EID_PERR;
233233
*pos++ = ie_len;
234234
/* ttl */
235-
*pos++ = MESH_TTL;
235+
*pos++ = ttl;
236236
/* number of destinations */
237237
*pos++ = 1;
238238
/*
@@ -522,7 +522,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
522522

523523
if (reply) {
524524
lifetime = PREQ_IE_LIFETIME(preq_elem);
525-
ttl = ifmsh->mshcfg.dot11MeshTTL;
525+
ttl = ifmsh->mshcfg.element_ttl;
526526
if (ttl != 0) {
527527
mhwmp_dbg("replying to the PREQ\n");
528528
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)
877877
sdata->u.mesh.last_sn_update = jiffies;
878878
}
879879
lifetime = default_lifetime(sdata);
880-
ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
880+
ttl = sdata->u.mesh.mshcfg.element_ttl;
881881
if (ttl == 0) {
882882
sdata->u.mesh.mshstats.dropped_frames_ttl++;
883883
spin_unlock_bh(&mpath->state_lock);
@@ -1013,5 +1013,6 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
10131013
mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr,
10141014
cpu_to_le32(++ifmsh->sn),
10151015
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);
10171018
}

net/mac80211/mesh_pathtbl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ void mesh_plink_broken(struct sta_info *sta)
467467
mpath->flags &= ~MESH_PATH_ACTIVE;
468468
++mpath->sn;
469469
spin_unlock_bh(&mpath->state_lock);
470-
mesh_path_error_tx(MESH_TTL, mpath->dst,
471-
cpu_to_le32(mpath->sn),
470+
mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl,
471+
mpath->dst, cpu_to_le32(mpath->sn),
472472
cpu_to_le16(PERR_RCODE_DEST_UNREACH),
473473
bcast, sdata);
474474
} else
@@ -614,7 +614,8 @@ void mesh_path_discard_frame(struct sk_buff *skb,
614614
mpath = mesh_path_lookup(da, sdata);
615615
if (mpath)
616616
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),
618619
cpu_to_le16(PERR_RCODE_NO_ROUTE), ra, sdata);
619620
}
620621

net/wireless/nl80211.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,6 +2582,8 @@ static int nl80211_get_mesh_params(struct sk_buff *skb,
25822582
cur_params.dot11MeshMaxRetries);
25832583
NLA_PUT_U8(msg, NL80211_MESHCONF_TTL,
25842584
cur_params.dot11MeshTTL);
2585+
NLA_PUT_U8(msg, NL80211_MESHCONF_ELEMENT_TTL,
2586+
cur_params.element_ttl);
25852587
NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS,
25862588
cur_params.auto_open_plinks);
25872589
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
26232625
[NL80211_MESHCONF_MAX_PEER_LINKS] = { .type = NLA_U16 },
26242626
[NL80211_MESHCONF_MAX_RETRIES] = { .type = NLA_U8 },
26252627
[NL80211_MESHCONF_TTL] = { .type = NLA_U8 },
2628+
[NL80211_MESHCONF_ELEMENT_TTL] = { .type = NLA_U8 },
26262629
[NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 },
26272630

26282631
[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)
26702673
mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8);
26712674
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL,
26722675
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);
26732678
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks,
26742679
mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8);
26752680
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries,

0 commit comments

Comments
 (0)