summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-08-21 15:32:18 +0000
committerflorian <florian@openbsd.org>2019-08-21 15:32:18 +0000
commit5aceba415921b63e83fb083318c9ea40d13c7603 (patch)
treea4a37a3b1a5dd1650f8ae4221eba8d2cc4a386a6 /sys/netinet6
parentBump /usr on big auto-allocation table; ok krw@ sthen@ phessler@ (diff)
downloadwireguard-openbsd-5aceba415921b63e83fb083318c9ea40d13c7603.tar.xz
wireguard-openbsd-5aceba415921b63e83fb083318c9ea40d13c7603.zip
Remove support for semantically opace interface identifiers (RFC 7217)
for IPv6 link local addresses. Some hosting and VM providers route customer IPv6 prefixes to link local addresses derived from ethernet MAC addresses (RFC 2464). This leads to hard to debug IPv6 connectivity problems and is probably not worth the effort. RFC 7721 lists 4 weaknesses: 3.1. Correlation of Activities over Time & 3.2. Location Tracking These are still possible with RFC 7217 addresses for an adversary connected to the same layer 2 network (think conference wifi). Since the link local prefix stays the same (fe80::/64) the link local addresses do not change between different networks. An adversary on the same layer 2 network can probably track ethernet MAC addresses via different means, too. 3.3. Address Scanning & 3.4. Device-Specific Vulnerability Exploitation These now become possible, however, as noted above a layer 2 adversary was probably able to do this via different means. People concerned with these weaknesses are advised to use ifconfig lladdr random. OK benno input & OK kn
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_ifattach.c85
-rw-r--r--sys/netinet6/in6_ifattach.h3
-rw-r--r--sys/netinet6/ip6_input.c13
3 files changed, 4 insertions, 97 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 884406957cf..87aac0e1378 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.113 2019/02/13 23:47:43 dlg Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.114 2019/08/21 15:32:18 florian Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -58,7 +58,6 @@
void in6_get_rand_ifid(struct ifnet *, struct in6_addr *);
int in6_get_hw_ifid(struct ifnet *, struct in6_addr *);
-int in6_get_soii_ifid(struct ifnet *, struct in6_addr *);
void in6_get_ifid(struct ifnet *, struct in6_addr *);
int in6_ifattach_loopback(struct ifnet *);
@@ -73,24 +72,6 @@ int in6_ifattach_loopback(struct ifnet *);
#define IFID_LOCAL(in6) (!EUI64_LOCAL(in6))
#define IFID_UNIVERSAL(in6) (!EUI64_UNIVERSAL(in6))
-void
-in6_soiiupdate(struct ifnet *ifp)
-{
- struct ifaddr *ifa;
-
- NET_ASSERT_LOCKED();
-
- /*
- * Update the link-local address.
- */
- ifa = &in6ifa_ifpforlinklocal(ifp, 0)->ia_ifa;
- if (ifa) {
- in6_purgeaddr(ifa);
- dohooks(ifp->if_addrhooks, 0);
- in6_ifattach(ifp);
- }
-}
-
/*
* Generate a random interface identifier.
*
@@ -211,61 +192,6 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6)
}
/*
- * Generate a Semantically Opaque Interface Identifier according to RFC 7217
- *
- * in6 - upper 64bits are preserved
- */
-int
-in6_get_soii_ifid(struct ifnet *ifp0, struct in6_addr *in6)
-{
- struct ifnet *ifp;
- SHA2_CTX ctx;
- u_int8_t digest[SHA512_DIGEST_LENGTH];
- struct in6_addr prefix;
- struct sockaddr_dl *sdl;
- int dad_counter = 0; /* XXX not used */
- char *addr;
-
- if (ifp0->if_xflags & IFXF_INET6_NOSOII)
- return -1;
-
- sdl = ifp0->if_sadl;
-
- if (sdl == NULL || sdl->sdl_alen == 0) {
- /*
- * try to get it from some other hardware interface like
- * in in6_get_ifid()
- */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
- if (ifp == ifp0)
- continue;
- sdl = ifp->if_sadl;
- if (sdl != NULL && sdl->sdl_alen != 0)
- break;
- }
- }
-
- if (sdl == NULL || sdl->sdl_alen == 0)
- return -1;
-
- memset(&prefix, 0, sizeof(prefix));
- prefix.s6_addr16[0] = htons(0xfe80);
- addr = LLADDR(sdl);
-
- SHA512Init(&ctx);
-
- SHA512Update(&ctx, &prefix, sizeof(prefix));
- SHA512Update(&ctx, addr, sdl->sdl_alen);
- SHA512Update(&ctx, &dad_counter, sizeof(dad_counter));
- SHA512Update(&ctx, ip6_soiikey, sizeof(ip6_soiikey));
- SHA512Final(digest, &ctx);
-
- memcpy(&in6->s6_addr[8], digest + (sizeof(digest) - 8), 8);
-
- return 0;
-}
-
-/*
* Get interface identifier for the specified interface. If it is not
* available on ifp0, borrow interface identifier from other information
* sources.
@@ -275,14 +201,7 @@ in6_get_ifid(struct ifnet *ifp0, struct in6_addr *in6)
{
struct ifnet *ifp;
- /* first, try to generate a Semantically Opaque Interface Identifier */
- if (in6_get_soii_ifid(ifp0, in6) == 0) {
- nd6log((LOG_DEBUG, "%s: got Semantically Opaque Interface "
- "Identifier\n", ifp0->if_xname));
- goto success;
- }
-
- /* next, try to get it from the interface itself */
+ /* first, try to get it from the interface itself */
if (in6_get_hw_ifid(ifp0, in6) == 0) {
nd6log((LOG_DEBUG, "%s: got interface identifier from itself\n",
ifp0->if_xname));
diff --git a/sys/netinet6/in6_ifattach.h b/sys/netinet6/in6_ifattach.h
index 244451ad12c..7c4adbe9d4c 100644
--- a/sys/netinet6/in6_ifattach.h
+++ b/sys/netinet6/in6_ifattach.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.h,v 1.9 2018/10/05 07:06:09 florian Exp $ */
+/* $OpenBSD: in6_ifattach.h,v 1.10 2019/08/21 15:32:18 florian Exp $ */
/* $KAME: in6_ifattach.h,v 1.9 2000/04/12 05:35:48 itojun Exp $ */
/*
@@ -37,7 +37,6 @@
int in6_ifattach(struct ifnet *);
void in6_ifdetach(struct ifnet *);
int in6_ifattach_linklocal(struct ifnet *, struct in6_addr *);
-void in6_soiiupdate(struct ifnet *);
#endif /* _KERNEL */
#endif /* _NETINET6_IN6_IFATTACH_H_ */
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index d57c71ab719..ef84483a267 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.218 2019/08/06 22:57:55 bluhm Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.219 2019/08/21 15:32:18 florian Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -1332,7 +1332,6 @@ ip6_sysctl_ip6stat(void *oldp, size_t *oldlenp, void *newp)
int
ip6_sysctl_soiikey(void *oldp, size_t *oldlenp, void *newp, size_t newlen)
{
- struct ifnet *ifp;
uint8_t oldkey[IP6_SOIIKEY_LEN];
int error;
@@ -1345,16 +1344,6 @@ ip6_sysctl_soiikey(void *oldp, size_t *oldlenp, void *newp, size_t newlen)
error = sysctl_struct(oldp, oldlenp, newp, newlen, ip6_soiikey,
sizeof(ip6_soiikey));
- if (!error && memcmp(ip6_soiikey, oldkey, sizeof(oldkey)) != 0) {
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
- if (ifp->if_flags & IFF_LOOPBACK)
- continue;
- NET_LOCK();
- in6_soiiupdate(ifp);
- NET_UNLOCK();
- }
- }
-
return (error);
}