Module Name: src Committed By: knakahara Date: Wed Dec 7 08:30:15 UTC 2022
Modified Files: src/sys/netinet: in_gif.c in_l2tp.c src/sys/netinet6: in6_gif.c in6_l2tp.c src/sys/netipsec: ipsecif.c Log Message: gif(4), ipsec(4) and l2tp(4) use encap_attach_addr(). To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/netinet/in_gif.c cvs rdiff -u -r1.20 -r1.21 src/sys/netinet/in_l2tp.c cvs rdiff -u -r1.95 -r1.96 src/sys/netinet6/in6_gif.c cvs rdiff -u -r1.21 -r1.22 src/sys/netinet6/in6_l2tp.c cvs rdiff -u -r1.19 -r1.20 src/sys/netipsec/ipsecif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/in_gif.c diff -u src/sys/netinet/in_gif.c:1.95 src/sys/netinet/in_gif.c:1.96 --- src/sys/netinet/in_gif.c:1.95 Thu Sep 19 06:07:25 2019 +++ src/sys/netinet/in_gif.c Wed Dec 7 08:30:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_gif.c,v 1.95 2019/09/19 06:07:25 knakahara Exp $ */ +/* $NetBSD: in_gif.c,v 1.96 2022/12/07 08:30:15 knakahara Exp $ */ /* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.95 2019/09/19 06:07:25 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.96 2022/12/07 08:30:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -369,12 +369,12 @@ in_gif_attach(struct gif_variant *var) if (!var->gv_psrc || !var->gv_pdst) return EINVAL; - var->gv_encap_cookie4 = encap_attach(AF_INET, -1, var->gv_psrc, - (struct sockaddr *)&mask4, var->gv_pdst, (struct sockaddr *)&mask4, - &in_gif_encapsw, var->gv_softc); + + var->gv_encap_cookie4 = encap_attach_addr(AF_INET, -1, var->gv_psrc, + var->gv_pdst, NULL, &in_gif_encapsw, var->gv_softc); #else - var->gv_encap_cookie4 = encap_attach_func(AF_INET, -1, gif_encapcheck, - &in_gif_encapsw, var->gv_softc); + var->gv_encap_cookie4 = encap_attach_addr(AF_INET, -1, var->gv_psrc, + var->gv_pdst, gif_encapcheck, &in_gif_encapsw, var->gv_softc); #endif if (var->gv_encap_cookie4 == NULL) return EEXIST; Index: src/sys/netinet/in_l2tp.c diff -u src/sys/netinet/in_l2tp.c:1.20 src/sys/netinet/in_l2tp.c:1.21 --- src/sys/netinet/in_l2tp.c:1.20 Fri Feb 19 14:51:59 2021 +++ src/sys/netinet/in_l2tp.c Wed Dec 7 08:30:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_l2tp.c,v 1.20 2021/02/19 14:51:59 christos Exp $ */ +/* $NetBSD: in_l2tp.c,v 1.21 2022/12/07 08:30:15 knakahara Exp $ */ /* * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.20 2021/02/19 14:51:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.21 2022/12/07 08:30:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_l2tp.h" @@ -404,8 +404,9 @@ in_l2tp_attach(struct l2tp_variant *var) if (sc == NULL) return EINVAL; - var->lv_encap_cookie = encap_attach_func(AF_INET, IPPROTO_L2TP, - in_l2tp_match, &in_l2tp_encapsw, sc); + + var->lv_encap_cookie = encap_attach_addr(AF_INET, IPPROTO_L2TP, + var->lv_psrc, var->lv_pdst, in_l2tp_match, &in_l2tp_encapsw, sc); if (var->lv_encap_cookie == NULL) return EEXIST; Index: src/sys/netinet6/in6_gif.c diff -u src/sys/netinet6/in6_gif.c:1.95 src/sys/netinet6/in6_gif.c:1.96 --- src/sys/netinet6/in6_gif.c:1.95 Wed Oct 30 03:45:59 2019 +++ src/sys/netinet6/in6_gif.c Wed Dec 7 08:30:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_gif.c,v 1.95 2019/10/30 03:45:59 knakahara Exp $ */ +/* $NetBSD: in6_gif.c,v 1.96 2022/12/07 08:30:15 knakahara Exp $ */ /* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.95 2019/10/30 03:45:59 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.96 2022/12/07 08:30:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -433,12 +433,12 @@ in6_gif_attach(struct gif_variant *var) if (!var->gv_psrc || !var->gv_pdst) return EINVAL; - var->gv_encap_cookie6 = encap_attach(AF_INET6, -1, var->gv_psrc, - sin6tosa(&mask6), var->gv_pdst, sin6tosa(&mask6), - (const void *)&in6_gif_encapsw, var->gv_softc); + + var->gv_encap_cookie6 = encap_attach_addr(AF_INET6, -1, var->gv_psrc, + var->gv_pdst, NULL, &in6_gif_encapsw, var->gv_softc); #else - var->gv_encap_cookie6 = encap_attach_func(AF_INET6, -1, gif_encapcheck, - &in6_gif_encapsw, var->gv_softc); + var->gv_encap_cookie6 = encap_attach_addr(AF_INET6, -1, var->gv_psrc, + var->gv_pdst, gif_encapcheck, &in6_gif_encapsw, var->gv_softc); #endif if (var->gv_encap_cookie6 == NULL) return EEXIST; Index: src/sys/netinet6/in6_l2tp.c diff -u src/sys/netinet6/in6_l2tp.c:1.21 src/sys/netinet6/in6_l2tp.c:1.22 --- src/sys/netinet6/in6_l2tp.c:1.21 Fri Feb 19 14:52:00 2021 +++ src/sys/netinet6/in6_l2tp.c Wed Dec 7 08:30:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_l2tp.c,v 1.21 2021/02/19 14:52:00 christos Exp $ */ +/* $NetBSD: in6_l2tp.c,v 1.22 2022/12/07 08:30:15 knakahara Exp $ */ /* * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.21 2021/02/19 14:52:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.22 2022/12/07 08:30:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_l2tp.h" @@ -399,8 +399,9 @@ in6_l2tp_attach(struct l2tp_variant *var if (sc == NULL) return EINVAL; - var->lv_encap_cookie = encap_attach_func(AF_INET6, IPPROTO_L2TP, - in6_l2tp_match, &in6_l2tp_encapsw, sc); + + var->lv_encap_cookie = encap_attach_addr(AF_INET6, IPPROTO_L2TP, + var->lv_psrc, var->lv_pdst, in6_l2tp_match, &in6_l2tp_encapsw, sc); if (var->lv_encap_cookie == NULL) return EEXIST; Index: src/sys/netipsec/ipsecif.c diff -u src/sys/netipsec/ipsecif.c:1.19 src/sys/netipsec/ipsecif.c:1.20 --- src/sys/netipsec/ipsecif.c:1.19 Fri Jan 31 06:54:19 2020 +++ src/sys/netipsec/ipsecif.c Wed Dec 7 08:30:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ipsecif.c,v 1.19 2020/01/31 06:54:19 knakahara Exp $ */ +/* $NetBSD: ipsecif.c,v 1.20 2022/12/07 08:30:15 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.19 2020/01/31 06:54:19 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.20 2022/12/07 08:30:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -937,8 +937,10 @@ ipsecif4_attach(struct ipsec_variant *va if (var->iv_encap_cookie4 != NULL) return EALREADY; - var->iv_encap_cookie4 = encap_attach_func(AF_INET, -1, if_ipsec_encap_func, - &ipsecif4_encapsw, sc); + + var->iv_encap_cookie4 = encap_attach_addr(AF_INET, -1, + var->iv_psrc, var->iv_pdst, if_ipsec_encap_func, &ipsecif4_encapsw, + sc); if (var->iv_encap_cookie4 == NULL) return EEXIST; @@ -971,8 +973,9 @@ ipsecif6_attach(struct ipsec_variant *va KASSERT(if_ipsec_variant_is_configured(var)); KASSERT(var->iv_encap_cookie6 == NULL); - var->iv_encap_cookie6 = encap_attach_func(AF_INET6, -1, if_ipsec_encap_func, - &ipsecif6_encapsw, sc); + var->iv_encap_cookie6 = encap_attach_addr(AF_INET6, -1, + var->iv_psrc, var->iv_pdst, if_ipsec_encap_func, &ipsecif6_encapsw, + sc); if (var->iv_encap_cookie6 == NULL) return EEXIST;