xfrm: Make xfrm_state timer monotonic
authorFan Du <fan.du@windriver.com>
Thu, 15 Aug 2013 07:49:06 +0000 (15:49 +0800)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 16 Aug 2013 04:53:28 +0000 (06:53 +0200)
xfrm_state timer should be independent of system clock change,
so switch to CLOCK_BOOTTIME base which is not only monotonic but
also counting suspend time.

Thus issue reported in commit: 9e0d57fd6dad37d72a3ca6db00ca8c76f2215454
("xfrm: SAD entries do not expire correctly after suspend-resume")
could ALSO be avoided.

v2: Use CLOCK_BOOTTIME to count suspend time, but still monotonic.

Signed-off-by: Fan Du <fan.du@windriver.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_state.c

index b2cd806c0be344e0f94b55a64cdc172ae605b87c..4f8ace8558649bacdc2f0c426d89c058bd5559d6 100644 (file)
@@ -499,7 +499,8 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
                INIT_HLIST_NODE(&x->bydst);
                INIT_HLIST_NODE(&x->bysrc);
                INIT_HLIST_NODE(&x->byspi);
-               tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler, CLOCK_REALTIME, HRTIMER_MODE_ABS);
+               tasklet_hrtimer_init(&x->mtimer, xfrm_timer_handler,
+                                       CLOCK_BOOTTIME, HRTIMER_MODE_ABS);
                setup_timer(&x->rtimer, xfrm_replay_timer_handler,
                                (unsigned long)x);
                x->curlft.add_time = get_seconds();