git: 11704859477c - main - if_wg: fix the !INET6 support

Kyle Evans kevans at FreeBSD.org
Mon Mar 15 05:42:02 UTC 2021


The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=11704859477cdb75a077807f53132be4d518e7f5

commit 11704859477cdb75a077807f53132be4d518e7f5
Author:     Kyle Evans <kevans at FreeBSD.org>
AuthorDate: 2021-03-15 05:38:22 +0000
Commit:     Kyle Evans <kevans at FreeBSD.org>
CommitDate: 2021-03-15 05:41:38 +0000

    if_wg: fix the !INET6 support
    
    INET is still required, so formally don't build it in !INET
    configurations.
---
 sys/dev/if_wg/if_wg.c | 6 ++++++
 sys/modules/Makefile  | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c
index ba2eb3221fac..c0b3ecdaa002 100644
--- a/sys/dev/if_wg/if_wg.c
+++ b/sys/dev/if_wg/if_wg.c
@@ -1102,11 +1102,13 @@ wg_send(struct wg_softc *sc, struct wg_endpoint *e, struct mbuf *m)
 			control = sbcreatecontrol((caddr_t)&e->e_local.l_in,
 			    sizeof(struct in_addr), IP_SENDSRCADDR,
 			    IPPROTO_IP);
+#ifdef INET6
 	} else if (e->e_remote.r_sa.sa_family == AF_INET6) {
 		if (!IN6_IS_ADDR_UNSPECIFIED(&e->e_local.l_in6))
 			control = sbcreatecontrol((caddr_t)&e->e_local.l_pktinfo6,
 			    sizeof(struct in6_pktinfo), IPV6_PKTINFO,
 			    IPPROTO_IPV6);
+#endif
 	} else {
 		m_freem(m);
 		return (EAFNOSUPPORT);
@@ -2296,7 +2298,9 @@ wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa,
     struct ifnet *rcvif)
 {
 	const struct sockaddr_in *sa4;
+#ifdef INET6
 	const struct sockaddr_in6 *sa6;
+#endif
 	int ret = 0;
 
 	/*
@@ -2307,10 +2311,12 @@ wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa,
 		sa4 = (const struct sockaddr_in *)srcsa;
 		e->e_remote.r_sin = sa4[0];
 		e->e_local.l_in = sa4[1].sin_addr;
+#ifdef INET6
 	} else if (srcsa->sa_family == AF_INET6) {
 		sa6 = (const struct sockaddr_in6 *)srcsa;
 		e->e_remote.r_sin6 = sa6[0];
 		e->e_local.l_in6 = sa6[1].sin6_addr;
+#endif
 	} else {
 		ret = EAFNOSUPPORT;
 	}
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 781495110cb9..32919674901b 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -163,7 +163,7 @@ SUBDIR=	\
 	if_tuntap \
 	if_vlan \
 	if_vxlan \
-	if_wg \
+	${_if_wg} \
 	iflib \
 	${_iir} \
 	imgact_binmisc \
@@ -456,6 +456,10 @@ _sctp=		sctp
 _if_stf=	if_stf
 .endif
 
+.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
+_if_wg=		if_wg
+.endif
+
 .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
 _if_me=		if_me
 _ipdivert=	ipdivert


More information about the dev-commits-src-main mailing list