Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec Fix key_getcomb_setlifetime



details:   https://anonhg.NetBSD.org/src/rev/aaa44887bb2c
branches:  trunk
changeset: 825630:aaa44887bb2c
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 26 01:33:35 2017 +0000

description:
Fix key_getcomb_setlifetime

The fix adjusts a soft limit to be 80% of a corresponding hard limit.

I'm not sure the fix is really correct though, at least the original
code is wrong. A passed comb is zero-cleared before calling
key_getcomb_setlifetime, so
  comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100;
is meaningless.

diffstat:

 sys/netipsec/key.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 2ba30b9e303e -r aaa44887bb2c sys/netipsec/key.c
--- a/sys/netipsec/key.c        Tue Jul 25 23:31:27 2017 +0000
+++ b/sys/netipsec/key.c        Wed Jul 26 01:33:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.191 2017/07/21 04:50:11 ozaki-r Exp $        */
+/*     $NetBSD: key.c,v 1.192 2017/07/26 01:33:35 ozaki-r Exp $        */
 /*     $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $        */
 /*     $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $   */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.191 2017/07/21 04:50:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.192 2017/07/26 01:33:35 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -5763,9 +5763,9 @@
        comb->sadb_comb_soft_bytes = 0;
        comb->sadb_comb_hard_bytes = 0;
        comb->sadb_comb_hard_addtime = 86400;   /* 1 day */
-       comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100;
-       comb->sadb_comb_soft_usetime = 28800;   /* 8 hours */
-       comb->sadb_comb_hard_usetime = comb->sadb_comb_hard_usetime * 80 / 100;
+       comb->sadb_comb_soft_addtime = comb->sadb_comb_hard_addtime * 80 / 100;
+       comb->sadb_comb_hard_usetime = 28800;   /* 8 hours */
+       comb->sadb_comb_soft_usetime = comb->sadb_comb_hard_usetime * 80 / 100;
 }
 
 /*



Home | Main Index | Thread Index | Old Index