git: afbfc2a617ee - main - gre: unbreak LINT-NOINET
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 27 Feb 2026 18:43:29 UTC
The branch main has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=afbfc2a617ee16b4c3bafef869690b594f812690
commit afbfc2a617ee16b4c3bafef869690b594f812690
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-02-26 21:31:25 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-02-27 18:43:20 +0000
gre: unbreak LINT-NOINET
- Move some of the braces under their respective conditionals to make the
statements more self-encapsulated and only define the `aliasreq` union
in the event either INET or INET6 is defined.
- Fix a copy-paste error: `in_gre_ioctl` should be `in6_gre_ioctl` in the
INET6 case.
Reported by: tinderbox
Fixes: e1e18cc12e68 ("if_gre: Add netlink support with tests")
Differential Revision: https://reviews.freebsd.org/D55546
---
sys/net/if_gre.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 758f25ccb859..f8036bf4446d 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -327,10 +327,10 @@ gre_clone_dump_nl(struct ifnet *ifp, struct nl_writer *nw)
#endif
} else if (sc->gre_family == AF_INET6) {
#ifdef INET6
- if (in_gre_ioctl(sc, SIOCGIFPSRCADDR_IN6, (caddr_t)&ifr) == 0)
+ if (in6_gre_ioctl(sc, SIOCGIFPSRCADDR_IN6, (caddr_t)&ifr) == 0)
nlattr_add_in6_addr(nw, IFLA_GRE_LOCAL,
(const struct in6_addr *)&ifr.ifr_addr);
- if (in_gre_ioctl(sc, SIOCGIFPDSTADDR_IN6, (caddr_t)&ifr) == 0)
+ if (in6_gre_ioctl(sc, SIOCGIFPDSTADDR_IN6, (caddr_t)&ifr) == 0)
nlattr_add_in6_addr(nw, IFLA_GRE_LOCAL,
(const struct in6_addr *)&ifr.ifr_dstaddr);
#endif
@@ -1041,10 +1041,16 @@ static int
gre_set_addr_nl(struct gre_softc *sc, struct nl_pstate *npt,
struct sockaddr *src, struct sockaddr *dst)
{
+#if defined(INET) || defined(INET6)
union {
+#ifdef INET
struct in_aliasreq in;
+#endif
+#ifdef INET6
struct in6_aliasreq in6;
+#endif
} aliasreq;
+#endif
int error;
/* XXX: this sanity check runs again in in[6]_gre_ioctl */
@@ -1057,16 +1063,18 @@ gre_set_addr_nl(struct gre_softc *sc, struct nl_pstate *npt,
sx_xlock(&gre_ioctl_sx);
error = in_gre_ioctl(sc, SIOCSIFPHYADDR, (caddr_t)&aliasreq.in);
sx_xunlock(&gre_ioctl_sx);
+ }
#endif
#ifdef INET6
- } else if (src->sa_family == AF_INET6) {
+ else if (src->sa_family == AF_INET6) {
memcpy(&aliasreq.in6.ifra_addr, src, sizeof(struct sockaddr_in6));
memcpy(&aliasreq.in6.ifra_dstaddr, dst, sizeof(struct sockaddr_in6));
sx_xlock(&gre_ioctl_sx);
error = in6_gre_ioctl(sc, SIOCSIFPHYADDR_IN6, (caddr_t)&aliasreq.in6);
sx_xunlock(&gre_ioctl_sx);
+ }
#endif
- } else
+ else
error = EAFNOSUPPORT;
if (error == EADDRNOTAVAIL)