Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wron...



details:   https://anonhg.NetBSD.org/src/rev/f74ee1235470
branches:  trunk
changeset: 1006919:f74ee1235470
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Jan 31 06:54:19 2020 +0000

description:
Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly.  Pointed out by ohishi@IIJ.

XXX pullup-8, pullup-9

diffstat:

 sys/netipsec/ipsecif.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r c98beb95ee13 -r f74ee1235470 sys/netipsec/ipsecif.c
--- a/sys/netipsec/ipsecif.c    Fri Jan 31 06:05:00 2020 +0000
+++ b/sys/netipsec/ipsecif.c    Fri Jan 31 06:54:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsecif.c,v 1.18 2019/11/01 04:28:14 knakahara Exp $  */
+/*     $NetBSD: ipsecif.c,v 1.19 2020/01/31 06:54:19 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.18 2019/11/01 04:28:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.19 2020/01/31 06:54:19 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -380,7 +380,17 @@
        KASSERT(var->iv_psrc->sa_family == AF_INET);
        KASSERT(var->iv_pdst->sa_family == AF_INET);
 
-       sp = IV_SP_OUT(var);
+       switch (family) {
+       case AF_INET:
+               sp = IV_SP_OUT(var);
+               break;
+       case AF_INET6:
+               sp = IV_SP_OUT6(var);
+               break;
+       default:
+               m_freem(m);
+               return EAFNOSUPPORT;
+       }
        KASSERT(sp != NULL);
        /*
         * The SPs in ipsec_variant are prevented from freed by



Home | Main Index | Thread Index | Old Index