From b78813061ce2ad9a3e494032680b50f4d97baca8 Mon Sep 17 00:00:00 2001 From: VANHULLEBUS Yvan Date: Tue, 5 Aug 2008 15:36:50 +0000 Subject: [PATCH] Add lifetime informations to generated SPD entries when SPDDUMP Approved by: gnn (mentor) MFC after: 4 weeks --- sys/netipsec/key.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 2921d0235b73..dc66a397ecf5 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -2412,6 +2412,7 @@ key_setdumpsp(sp, type, seq, pid) u_int32_t seq, pid; { struct mbuf *result = NULL, *m; + struct seclifetime lt; m = key_setsadbmsg(type, 0, SADB_SATYPE_UNSPEC, seq, pid, sp->refcnt); if (!m) @@ -2437,6 +2438,22 @@ key_setdumpsp(sp, type, seq, pid) goto fail; m_cat(result, m); + if(sp->lifetime){ + lt.addtime=sp->created; + lt.usetime= sp->lastused; + m = key_setlifetime(<, SADB_EXT_LIFETIME_CURRENT); + if (!m) + goto fail; + m_cat(result, m); + + lt.addtime=sp->lifetime; + lt.usetime= sp->validtime; + m = key_setlifetime(<, SADB_EXT_LIFETIME_HARD); + if (!m) + goto fail; + m_cat(result, m); + } + if ((result->m_flags & M_PKTHDR) == 0) goto fail;