Commit 9afaca05 authored by Masahide NAKAMURA's avatar Masahide NAKAMURA Committed by David S. Miller

[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: default avatarMasahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 060f02a3
...@@ -236,6 +236,7 @@ enum xfrm_attr_type_t { ...@@ -236,6 +236,7 @@ enum xfrm_attr_type_t {
XFRMA_ETIMER_THRESH, XFRMA_ETIMER_THRESH,
XFRMA_SRCADDR, /* xfrm_address_t */ XFRMA_SRCADDR, /* xfrm_address_t */
XFRMA_COADDR, /* xfrm_address_t */ XFRMA_COADDR, /* xfrm_address_t */
XFRMA_LASTUSED,
__XFRMA_MAX __XFRMA_MAX
#define XFRMA_MAX (__XFRMA_MAX - 1) #define XFRMA_MAX (__XFRMA_MAX - 1)
......
...@@ -167,6 +167,9 @@ struct xfrm_state ...@@ -167,6 +167,9 @@ struct xfrm_state
struct xfrm_lifetime_cur curlft; struct xfrm_lifetime_cur curlft;
struct timer_list timer; struct timer_list timer;
/* Last used time */
u64 lastused;
/* Reference to data common to all the instances of this /* Reference to data common to all the instances of this
* transformer. */ * transformer. */
struct xfrm_type *type; struct xfrm_type *type;
......
...@@ -75,6 +75,8 @@ static int xfrm6_output_one(struct sk_buff *skb) ...@@ -75,6 +75,8 @@ static int xfrm6_output_one(struct sk_buff *skb)
x->curlft.bytes += skb->len; x->curlft.bytes += skb->len;
x->curlft.packets++; x->curlft.packets++;
if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
x->lastused = (u64)xtime.tv_sec;
spin_unlock_bh(&x->lock); spin_unlock_bh(&x->lock);
......
...@@ -595,6 +595,9 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr) ...@@ -595,6 +595,9 @@ static int dump_one_state(struct xfrm_state *x, int count, void *ptr)
if (x->coaddr) if (x->coaddr)
RTA_PUT(skb, XFRMA_COADDR, sizeof(*x->coaddr), x->coaddr); RTA_PUT(skb, XFRMA_COADDR, sizeof(*x->coaddr), x->coaddr);
if (x->lastused)
RTA_PUT(skb, XFRMA_LASTUSED, sizeof(x->lastused), &x->lastused);
nlh->nlmsg_len = skb->tail - b; nlh->nlmsg_len = skb->tail - b;
out: out:
sp->this_idx++; sp->this_idx++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment