Commit 9afaca057980c02771f4657c455cc7592fcd7373

Authored by Masahide NAKAMURA
Committed by David S. Miller
1 parent 060f02a3bd

[XFRM] IPV6: Update outbound state timestamp for each sending.

With this patch transformation state is updated last used time
for each sending. Xtime is used for it like other state lifetime
expiration.
Mobile IPv6 enabled nodes will want to know traffic status of each
binding (e.g. judgement to request binding refresh by correspondent node,
or to keep home/care-of nonce alive by mobile node).
The last used timestamp is an important hint about it.
Based on MIPL2 kernel patch.

This patch was also written by: Henrik Petander <petander@tcs.hut.fi>

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 4 changed files with 9 additions and 0 deletions Side-by-side Diff

include/linux/xfrm.h
... ... @@ -236,6 +236,7 @@
236 236 XFRMA_ETIMER_THRESH,
237 237 XFRMA_SRCADDR, /* xfrm_address_t */
238 238 XFRMA_COADDR, /* xfrm_address_t */
  239 + XFRMA_LASTUSED,
239 240 __XFRMA_MAX
240 241  
241 242 #define XFRMA_MAX (__XFRMA_MAX - 1)
... ... @@ -167,6 +167,9 @@
167 167 struct xfrm_lifetime_cur curlft;
168 168 struct timer_list timer;
169 169  
  170 + /* Last used time */
  171 + u64 lastused;
  172 +
170 173 /* Reference to data common to all the instances of this
171 174 * transformer. */
172 175 struct xfrm_type *type;
net/ipv6/xfrm6_output.c
... ... @@ -75,6 +75,8 @@
75 75  
76 76 x->curlft.bytes += skb->len;
77 77 x->curlft.packets++;
  78 + if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
  79 + x->lastused = (u64)xtime.tv_sec;
78 80  
79 81 spin_unlock_bh(&x->lock);
80 82  
net/xfrm/xfrm_user.c
... ... @@ -595,6 +595,9 @@
595 595 if (x->coaddr)
596 596 RTA_PUT(skb, XFRMA_COADDR, sizeof(*x->coaddr), x->coaddr);
597 597  
  598 + if (x->lastused)
  599 + RTA_PUT(skb, XFRMA_LASTUSED, sizeof(x->lastused), &x->lastused);
  600 +
598 601 nlh->nlmsg_len = skb->tail - b;
599 602 out:
600 603 sp->this_idx++;