* [PATCH] mac80211: close peer link after consecutive beacon misses
@ 2012-10-17 1:30 Marco Porsch
0 siblings, 0 replies; 3+ messages in thread
From: Marco Porsch @ 2012-10-17 1:30 UTC (permalink / raw)
To: johannes; +Cc: devel, linux-wireless, Marco Porsch
Currently the mesh code relies on on a graceful peer link close with a
Mesh Peering Close frame. That causes peer links to stay in established
state after a node just silently disappeared.
This commit adds a timeout that is triggered when a defined number of beacons
from a peer have been missed. In this case the link is closed, just as it
would be in case of a received Mesh Peering Close frame.
To calculate the timeout the peer's beacon interval is used.
Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
---
net/mac80211/mesh.c | 2 +-
net/mac80211/mesh.h | 5 ++++-
net/mac80211/mesh_plink.c | 19 +++++++++++++++++--
net/mac80211/sta_info.h | 2 ++
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ff0296c..6d41e5d 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -696,7 +696,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
if (elems.mesh_id && elems.mesh_config &&
mesh_matches_local(sdata, &elems))
- mesh_neighbour_update(sdata, mgmt->sa, &elems);
+ mesh_neighbour_update(sdata, mgmt, &elems);
if (ifmsh->sync_ops)
ifmsh->sync_ops->rx_bcn_presp(sdata,
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 25d0f17..7ce9203 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -209,6 +209,9 @@ struct mesh_rmc {
#define MESH_PATH_EXPIRE (600 * HZ)
+/* maximum number of missed beacons before peer link is closed */
+#define MESH_MAX_BEACON_MISS 14
+
/* Default maximum number of plinks per interface */
#define MESH_MAX_PLINKS 256
@@ -282,7 +285,7 @@ int mesh_path_send_to_gates(struct mesh_path *mpath);
int mesh_gate_num(struct ieee80211_sub_if_data *sdata);
/* Mesh plinks */
void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
- u8 *hw_addr,
+ struct ieee80211_mgmt *mgmt,
struct ieee802_11_elems *ie);
bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie);
u32 mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata);
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 3ab34d8..3a12707 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -372,6 +372,8 @@ static struct sta_info *mesh_peer_init(struct ieee80211_sub_if_data *sdata,
spin_lock_bh(&sta->lock);
sta->last_rx = jiffies;
if (sta->plink_state == NL80211_PLINK_ESTAB) {
+ mod_plink_timer(sta, TU_TO_JIFFIES(sta->beacon_interval *
+ MESH_MAX_BEACON_MISS));
spin_unlock_bh(&sta->lock);
return sta;
}
@@ -404,13 +406,13 @@ static struct sta_info *mesh_peer_init(struct ieee80211_sub_if_data *sdata,
}
void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
- u8 *hw_addr,
+ struct ieee80211_mgmt *mgmt,
struct ieee802_11_elems *elems)
{
struct sta_info *sta;
rcu_read_lock();
- sta = mesh_peer_init(sdata, hw_addr, elems);
+ sta = mesh_peer_init(sdata, mgmt->sa, elems);
if (!sta)
goto out;
@@ -421,6 +423,7 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
rssi_threshold_check(sta, sdata))
mesh_plink_open(sta);
+ sta->beacon_interval = le16_to_cpu(mgmt->u.beacon.beacon_int);
out:
rcu_read_unlock();
}
@@ -430,6 +433,7 @@ static void mesh_plink_timer(unsigned long data)
struct sta_info *sta;
__le16 llid, plid, reason;
struct ieee80211_sub_if_data *sdata;
+ u32 changed = 0;
/*
* This STA is valid because sta_info_destroy() will
@@ -495,6 +499,17 @@ static void mesh_plink_timer(unsigned long data)
mesh_plink_fsm_restart(sta);
spin_unlock_bh(&sta->lock);
break;
+ case NL80211_PLINK_ESTAB:
+ /* beacon loss timer */
+ mpl_dbg(sta->sdata, "Mesh plink for %pM beacon loss\n",
+ sta->sta.addr);
+ changed |= __mesh_plink_deactivate(sta);
+ sta->plink_state = NL80211_PLINK_HOLDING;
+ mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
+ spin_unlock_bh(&sta->lock);
+ changed |= mesh_set_ht_prot_mode(sdata);
+ ieee80211_bss_info_change_notify(sdata, changed);
+ break;
default:
spin_unlock_bh(&sta->lock);
break;
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index c88f161f..45eae7e 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
* @t_offset_setpoint: reference timing offset of this sta to be used when
* calculating clockdrift
* @ch_type: peer's channel type
+ * @beacon_interval: beacon interval of this station
* @debugfs: debug filesystem info
* @dead: set to true when sta is unlinked
* @uploaded: set to true when sta is uploaded to the driver
@@ -370,6 +371,7 @@ struct sta_info {
s64 t_offset;
s64 t_offset_setpoint;
enum nl80211_channel_type ch_type;
+ u16 beacon_interval;
#endif
#ifdef CONFIG_MAC80211_DEBUGFS
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: close peer link after consecutive beacon misses
2012-10-18 2:30 Yeoh Chun-Yeow
@ 2012-10-18 21:18 ` Marco Porsch
0 siblings, 0 replies; 3+ messages in thread
From: Marco Porsch @ 2012-10-18 21:18 UTC (permalink / raw)
To: Yeoh Chun-Yeow; +Cc: devel, linux-wireless, Johannes Berg
Hi,
thanks for reporting this; I can confirm that bug.
It is triggered by
BUG_ON(!timer->function);
in timer.c after calling mod_timer in mesh_peer_init.
Ok, so I have to dig into, what is different in peering when userspace
tools are involved.
Regards,
Marco
On 10/17/2012 07:30 PM, Yeoh Chun-Yeow wrote:
> Hi, Marco
>
> I have tried to use this patch in open mesh, no problem.
>
> But if testing with secured mesh (authsae), it causes the following
> kernel panic.
>
> Appreciate if you can take a look on this. Thanks
>
> Regards,
> Chun-Yeow
>
> [ 153.790000] Cpu 0
> [ 153.790000] $ 0 : 00000000 80330000 00000001 000003e8
> [ 153.790000] $ 4 : 8142a2e8 ffffc6e3 00000000 00005b79
> [ 153.790000] $ 8 : 00000000 00000800 00000001 0000007f
> [ 153.790000] $12 : 00000005 0000000c 81574748 0000021c
> [ 153.790000] $16 : 8142a2e8 ffffc6e3 00000000 81c43d38
> [ 153.790000] $20 : 000000cc 00000000 00000fff 81fa2a58
> [ 153.790000] $24 : 00000000 80095350
> [ 153.790000] $28 : 81c42000 81c43c88 815cd664 814af9fc
> [ 153.790000] Hi : 00000000
> [ 153.790000] Lo : 00000000
> [ 153.790000] epc : 8007c300 mod_timer+0x94/0x180
> [ 153.790000] Tainted: G O
> [ 153.790000] ra : 814af9fc mesh_pathtbl_unregister+0x740/0xa9c [mac80211]
> [ 153.790000] Status: 1000d403 KERNEL EXL IE
> [ 153.790000] Cause : 10800034
> [ 153.790000] PrId : 00019374 (MIPS 24Kc)
> [ 153.790000] Modules linked in: ath79_wdt ohci_hcd ledtrig_netdev
> nf_nat_irc nf_conntrack_irc nf_nat_ftp nf_conntrack_ftp ipt_MASQUERADE
> iptable_nat nf_nat pppoe xt_conntrack xt_CT xt_NOTRACK iptable_raw
> xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack ehci_hcd pppox
> ipt_REJECT xt_TCPMSS ipt_LOG xt_comment xt_multiport xt_mac xt_limit
> iptable_mangle iptable_filter ip_tables xt_tcpudp x_tables ppp_async
> ppp_generic slhc ath9k(O) ath9k_common(O) ath9k_hw(O) ath(O)
> mac80211(O) usbcore usb_common nls_base crc_ccitt cfg80211(O)
> compat(O) arc4 aes_generic crypto_algapi ledtrig_timer
> ledtrig_default_on leds_gpio gpio_button_hotplug(O)
> [ 153.790000] Process kworker/u:1 (pid: 7, threadinfo=81c42000,
> task=81c198f0, tls=00000000)
> [ 153.790000] Stack : ffffffff ffffffff 81c43d38 00000000 815cd664
> 81563720 8142a000 ffffc6e3
> [ 153.790000] 814e904a 814af9fc 00000000 00000000 00000000
> 00000000 00000000 00000000
> [ 153.790000] 00000001 81c43cc8 815cd380 815cd380 815cd380
> 814e9040 81c43d38 00000080
> [ 153.790000] 81fa0a80 814bc620 00000000 814afef0 00000000
> 00000000 00000001 814e8040
> [ 153.790000] 815cd380 815cd380 814e9040 00000000 81ffc0d8
> 814ac4fc 81c82900 00000000
> [ 153.790000] ...
> [ 153.790000] Call Trace:
> [ 153.790000] [<8007c300>] mod_timer+0x94/0x180
> [ 153.790000] [<814af9fc>] mesh_pathtbl_unregister+0x740/0xa9c [mac80211]
> [ 153.790000]
> [ 153.790000]
> [ 153.790000] Code: 24120001 8e020010 2c420001
> [ 153.790000] 02002021 0c01ef3d 27a50010 8e030000 10600011
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: close peer link after consecutive beacon misses
@ 2012-10-18 2:30 Yeoh Chun-Yeow
2012-10-18 21:18 ` Marco Porsch
0 siblings, 1 reply; 3+ messages in thread
From: Yeoh Chun-Yeow @ 2012-10-18 2:30 UTC (permalink / raw)
To: Marco Porsch; +Cc: devel, linux-wireless, Johannes Berg
Hi, Marco
I have tried to use this patch in open mesh, no problem.
But if testing with secured mesh (authsae), it causes the following
kernel panic.
Appreciate if you can take a look on this. Thanks
Regards,
Chun-Yeow
[ 153.790000] Cpu 0
[ 153.790000] $ 0 : 00000000 80330000 00000001 000003e8
[ 153.790000] $ 4 : 8142a2e8 ffffc6e3 00000000 00005b79
[ 153.790000] $ 8 : 00000000 00000800 00000001 0000007f
[ 153.790000] $12 : 00000005 0000000c 81574748 0000021c
[ 153.790000] $16 : 8142a2e8 ffffc6e3 00000000 81c43d38
[ 153.790000] $20 : 000000cc 00000000 00000fff 81fa2a58
[ 153.790000] $24 : 00000000 80095350
[ 153.790000] $28 : 81c42000 81c43c88 815cd664 814af9fc
[ 153.790000] Hi : 00000000
[ 153.790000] Lo : 00000000
[ 153.790000] epc : 8007c300 mod_timer+0x94/0x180
[ 153.790000] Tainted: G O
[ 153.790000] ra : 814af9fc mesh_pathtbl_unregister+0x740/0xa9c [mac80211]
[ 153.790000] Status: 1000d403 KERNEL EXL IE
[ 153.790000] Cause : 10800034
[ 153.790000] PrId : 00019374 (MIPS 24Kc)
[ 153.790000] Modules linked in: ath79_wdt ohci_hcd ledtrig_netdev
nf_nat_irc nf_conntrack_irc nf_nat_ftp nf_conntrack_ftp ipt_MASQUERADE
iptable_nat nf_nat pppoe xt_conntrack xt_CT xt_NOTRACK iptable_raw
xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack ehci_hcd pppox
ipt_REJECT xt_TCPMSS ipt_LOG xt_comment xt_multiport xt_mac xt_limit
iptable_mangle iptable_filter ip_tables xt_tcpudp x_tables ppp_async
ppp_generic slhc ath9k(O) ath9k_common(O) ath9k_hw(O) ath(O)
mac80211(O) usbcore usb_common nls_base crc_ccitt cfg80211(O)
compat(O) arc4 aes_generic crypto_algapi ledtrig_timer
ledtrig_default_on leds_gpio gpio_button_hotplug(O)
[ 153.790000] Process kworker/u:1 (pid: 7, threadinfo=81c42000,
task=81c198f0, tls=00000000)
[ 153.790000] Stack : ffffffff ffffffff 81c43d38 00000000 815cd664
81563720 8142a000 ffffc6e3
[ 153.790000] 814e904a 814af9fc 00000000 00000000 00000000
00000000 00000000 00000000
[ 153.790000] 00000001 81c43cc8 815cd380 815cd380 815cd380
814e9040 81c43d38 00000080
[ 153.790000] 81fa0a80 814bc620 00000000 814afef0 00000000
00000000 00000001 814e8040
[ 153.790000] 815cd380 815cd380 814e9040 00000000 81ffc0d8
814ac4fc 81c82900 00000000
[ 153.790000] ...
[ 153.790000] Call Trace:
[ 153.790000] [<8007c300>] mod_timer+0x94/0x180
[ 153.790000] [<814af9fc>] mesh_pathtbl_unregister+0x740/0xa9c [mac80211]
[ 153.790000]
[ 153.790000]
[ 153.790000] Code: 24120001 8e020010 2c420001
[ 153.790000] 02002021 0c01ef3d 27a50010 8e030000 10600011
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-18 21:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-17 1:30 [PATCH] mac80211: close peer link after consecutive beacon misses Marco Porsch
2012-10-18 2:30 Yeoh Chun-Yeow
2012-10-18 21:18 ` Marco Porsch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.