diff options
author | monthadar <monthadar@FreeBSD.org> | 2012-05-01 16:05:09 +0000 |
---|---|---|
committer | monthadar <monthadar@FreeBSD.org> | 2012-05-01 16:05:09 +0000 |
commit | 44ee994da682f487df396c7a1751fb8060995d0b (patch) | |
tree | d0481231bcb8a1511f9a13bfd9865822412f8c49 /sys/net80211/ieee80211_hwmp.c | |
parent | 84762f9912d819ed0724d0a481965e50a463957e (diff) | |
download | FreeBSD-src-44ee994da682f487df396c7a1751fb8060995d0b.zip FreeBSD-src-44ee994da682f487df396c7a1751fb8060995d0b.tar.gz |
* Added a mesh max PREQ retires sysctl that governous how many times
we try to discover an address;
* Added a mesh net travelse time across an MBSS, which is used to enforce
discovery rate check;
Approved by: adrian
Diffstat (limited to 'sys/net80211/ieee80211_hwmp.c')
-rw-r--r-- | sys/net80211/ieee80211_hwmp.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 54e3c39..3e06ab8 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -154,7 +154,8 @@ struct ieee80211_hwmp_route { ieee80211_hwmp_seq hr_preqid; /* last PREQ ID seen from dst */ ieee80211_hwmp_seq hr_origseq; /* seq. no. on our latest PREQ*/ struct timeval hr_lastpreq; /* last time we sent a PREQ */ - int hr_preqretries; + int hr_preqretries; /* number of discoveries */ + int hr_lastdiscovery; /* last discovery in ticks */ }; struct ieee80211_hwmp_state { ieee80211_hwmp_seq hs_seq; /* next seq to be used */ @@ -177,6 +178,15 @@ static int ieee80211_hwmp_pathtimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, pathlifetime, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_pathtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "path entry lifetime (ms)"); +static int ieee80211_hwmp_maxpreq_retries = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, maxpreq_retries, CTLTYPE_INT | CTLFLAG_RW, + &ieee80211_hwmp_maxpreq_retries, 0, ieee80211_sysctl_msecs_ticks, "I", + "maximum number of preq retries"); +static int ieee80211_hwmp_net_diameter_traversaltime = -1; +SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, net_diameter_traversal_time, + CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_net_diameter_traversaltime, 0, + ieee80211_sysctl_msecs_ticks, "I", + "estimate travelse time across the MBSS (ms)"); static int ieee80211_hwmp_roottimeout = -1; SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, roottimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_hwmp_roottimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -212,10 +222,17 @@ SYSCTL_PROC(_net_wlan_hwmp, OID_AUTO, inact, CTLTYPE_INT | CTLFLAG_RW, static void ieee80211_hwmp_init(void) { + /* Default values as per amendment */ ieee80211_hwmp_pathtimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_roottimeout = msecs_to_ticks(5*1000); ieee80211_hwmp_rootint = msecs_to_ticks(2*1000); ieee80211_hwmp_rannint = msecs_to_ticks(1*1000); + ieee80211_hwmp_maxpreq_retries = 3; + /* + * (TU): A measurement of time equal to 1024 μs, + * 500 TU is 512 ms. + */ + ieee80211_hwmp_net_diameter_traversaltime = msecs_to_ticks(512); /* * Register action frame handler. @@ -1288,6 +1305,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, rt->rt_metric, metric); hr->hr_seq = prep->prep_targetseq; + hr->hr_preqretries = 0; IEEE80211_ADDR_COPY(rt->rt_nexthop, ni->ni_macaddr); rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; @@ -1648,13 +1666,31 @@ hwmp_discover(struct ieee80211vap *vap, hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + if (hr->hr_lastdiscovery != 0 && + (ticks - hr->hr_lastdiscovery < + (ieee80211_hwmp_net_diameter_traversaltime * 2))) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + dest, NULL, "%s", + "too frequent discovery requeust"); + /* XXX: stats? */ + goto done; + } + hr->hr_lastdiscovery = ticks; + if (hr->hr_preqretries >= + ieee80211_hwmp_maxpreq_retries) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, + dest, NULL, "%s", + "no valid path , max number of discovery"); + vap->iv_stats.is_mesh_fwd_nopath++; + goto done; + } + hr->hr_preqretries++; if (hr->hr_origseq == 0) hr->hr_origseq = ++hs->hs_seq; rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL; /* XXX: special discovery timeout, larger lifetime? */ ieee80211_mesh_rt_update(rt, ticks_to_msecs(ieee80211_hwmp_pathtimeout)); - /* XXX check preq retries */ sendpreq = 1; IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, dest, "start path discovery (src %s), target seq %u", |