Source-Changes-HG archive

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

[src/trunk]: src/sys/net Reviewd by ohishi@IIJ. Sorry, I jumped the gun and c...



details:   https://anonhg.NetBSD.org/src/rev/6118baa844bd
branches:  trunk
changeset: 319420:6118baa844bd
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue May 29 04:45:50 2018 +0000

description:
Reviewd by ohishi@IIJ. Sorry, I jumped the gun and committed.

Fix the following two issues.
    - remove extra padding of sizeof(xisr) when adding ipsec policy
    - add padding for xpl when adding discard policy

diffstat:

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

diffs (40 lines):

diff -r 7c1a886f5680 -r 6118baa844bd sys/net/if_ipsec.c
--- a/sys/net/if_ipsec.c        Tue May 29 04:39:26 2018 +0000
+++ b/sys/net/if_ipsec.c        Tue May 29 04:45:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ipsec.c,v 1.15 2018/05/29 03:38:24 knakahara Exp $  */
+/*     $NetBSD: if_ipsec.c,v 1.16 2018/05/29 04:45:50 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.15 2018/05/29 03:38:24 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.16 2018/05/29 04:45:50 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1591,6 +1591,7 @@
        if_ipsec_add_pad(m, padlen);
 
        if_ipsec_add_mbuf(m, &xpl, sizeof(xpl));
+       padlen = PFKEY_UNUNIT64(xpl.sadb_x_policy_len) - sizeof(xpl);
        if (policy == IPSEC_POLICY_IPSEC) {
                if_ipsec_add_mbuf(m, &xisr, sizeof(xisr));
                /*
@@ -1599,11 +1600,10 @@
                 */
                if_ipsec_add_mbuf_addr_port(m, src, sport, false);
                if_ipsec_add_mbuf_addr_port(m, dst, dport, false);
-
-               padlen = PFKEY_UNUNIT64(xpl.sadb_x_policy_len) - sizeof(xpl);
+               padlen -= PFKEY_ALIGN8(sizeof(xisr));
                padlen -= PFKEY_ALIGN8(src->sa_len + dst->sa_len);
-               if_ipsec_add_pad(m, padlen);
        }
+       if_ipsec_add_pad(m, padlen);
 
        /* key_kpi_spdadd() has already done KEY_SP_REF(). */
        return key_kpi_spdadd(m);



Home | Main Index | Thread Index | Old Index