aboutsummaryrefslogtreecommitdiff
path: root/sys/netipsec
diff options
context:
space:
mode:
authorVANHULLEBUS Yvan <vanhu@FreeBSD.org>2008-08-05 15:36:50 +0000
committerVANHULLEBUS Yvan <vanhu@FreeBSD.org>2008-08-05 15:36:50 +0000
commitb78813061ce2ad9a3e494032680b50f4d97baca8 (patch)
tree6eafa3420b9f5f9891fdfb0622f00fb17ac0a17a /sys/netipsec
parent20ed1beeb5e72521d48779f5dc5e63033ac17c9e (diff)
downloadsrc-b78813061ce2ad9a3e494032680b50f4d97baca8.tar.gz
src-b78813061ce2ad9a3e494032680b50f4d97baca8.zip
Add lifetime informations to generated SPD entries when SPDDUMP
Approved by: gnn (mentor) MFC after: 4 weeks
Notes
Notes: svn path=/head/; revision=181330
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/key.c17
1 files changed, 17 insertions, 0 deletions
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(&lt, SADB_EXT_LIFETIME_CURRENT);
+ if (!m)
+ goto fail;
+ m_cat(result, m);
+
+ lt.addtime=sp->lifetime;
+ lt.usetime= sp->validtime;
+ m = key_setlifetime(&lt, SADB_EXT_LIFETIME_HARD);
+ if (!m)
+ goto fail;
+ m_cat(result, m);
+ }
+
if ((result->m_flags & M_PKTHDR) == 0)
goto fail;