mesh: Fix inactivity timer for 32 bit system
authorMasashi Honma <masashi.honma@gmail.com>
Wed, 4 Feb 2015 02:26:51 +0000 (11:26 +0900)
committerJouni Malinen <j@w1.fi>
Sat, 7 Feb 2015 20:20:45 +0000 (22:20 +0200)
commit0cb5f8d94536e097af7a11273f79239001a602d6
tree9aa7f41163c017f919614e44d2b82632ea187527
parenta0b3f8e2ffbefe5cca78c1a321ed1cedac04cbbb
mesh: Fix inactivity timer for 32 bit system

Commit 5a2a6de6a5fec58dcfdb4320e4ec2b69d183a4c1 ('mesh: Make inactivity
timer configurable') has a problem on 32 bit systems. Setting
NL80211_MESHCONF_PLINK_TIMEOUT to 0xffffffff causes expiration of STA in
a minute by NL80211_CMD_DEL_STATION event. this is the kernel rule for
STA expiration:

(current jiffies) > (frame Rx jiffies + NL80211_MESHCONF_PLINK_TIMEOUT * 250)

On a 32 bit system, the right side could overflow and be unexpected
small value if NL80211_MESHCONF_PLINK_TIMEOUT is sufficiently large. STA
expiration occurs by this reason.

This patch solves the problem by disabling the STA expiration
functionality in mac80211. However, old kernel does not support
disabling it. If so, this patch sets mac80211 inactivity timer 60
seconds into future from the wpa_supplicant inactivity timer.

And I mis-understood that mesh_max_inactivity=0 disables inactivity
timer in wpa_supplicant. This commit fixes it also.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
src/drivers/driver_nl80211.c