From 345c4d05797bdbbc2347b7d2c731f27795fbf9b1 Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 14 Nov 2022 17:12:55 +0000 Subject: [PATCH] Relax the list of interfaces which support IPv6 a bit. No longer require IFF_MULTICAST for all interfaces. It is save to skip this for interfaces that don't require a ND cache. Also do not assign a link-local address in such cases. This affects point-to-point interfaces and the NBMA / point-to-multipoint interfaces like mpe(4), mgre(4) and wg(4). The NBMA interfaces need some alternative way to figure out the address mapping. In the end this allows non-multicast interfaces to work with IPv6. OK dlg@ kn@ --- sys/netinet6/in6_ifattach.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 09a9878fce6..7550297f88e 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.119 2022/09/08 10:22:07 kn Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.120 2022/11/14 17:12:55 claudio Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -373,7 +373,7 @@ in6_ifattach(struct ifnet *ifp) if (ifp->if_mtu < IPV6_MMTU) return (EINVAL); - if ((ifp->if_flags & IFF_MULTICAST) == 0) + if (nd6_need_cache(ifp) && (ifp->if_flags & IFF_MULTICAST) == 0) return (EINVAL); /* @@ -389,12 +389,12 @@ in6_ifattach(struct ifnet *ifp) return (error); } - /* Interfaces that rely on strong a priori cryptographic binding of - * IP addresses are incompatible with automatically assigned llv6. */ - switch (ifp->if_type) { - case IFT_WIREGUARD: + /* + * Only interfaces that need the ND cache should automatically + * assign a link local address. + */ + if (!nd6_need_cache(ifp)) return (0); - } /* Assign a link-local address, if there's none. */ if (in6ifa_ifpforlinklocal(ifp, 0) == NULL) { -- 2.20.1