aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2023-09-13 07:18:05 +0100
committerDavid S. Miller <davem@davemloft.net>2023-09-13 07:18:05 +0100
commitab6c4ec8742a653b1ba06215d9bccb31c4d87d0f (patch)
tree5451d725ed8ae06ca21ae072650a90f29cd503b6 /include
parentipv6: fix ip6_sock_set_addr_preferences() typo (diff)
parentselftest: tcp: Add v4-mapped-v6 cases in bind_wildcard.c. (diff)
downloadwireguard-linux-ab6c4ec8742a653b1ba06215d9bccb31c4d87d0f.tar.xz
wireguard-linux-ab6c4ec8742a653b1ba06215d9bccb31c4d87d0f.zip
Merge branch 'tcp-bind-fixes'
Kuniyuki Iwashima says: ==================== tcp: Fix bind() regression for v4-mapped-v6 address Since bhash2 was introduced, bind() is broken in two cases related to v4-mapped-v6 address. This series fixes the regression and adds test to cover the cases. Changes: v2: * Added patch 1 to factorise duplicated comparison (Eric Dumazet) v1: https://lore.kernel.org/netdev/20230911165106.39384-1-kuniyu@amazon.com/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/ipv6.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index fe274c122a56..c6932d1a3fa8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -784,6 +784,11 @@ static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
cpu_to_be32(0x0000ffff))) == 0UL;
}
+static inline bool ipv6_addr_v4mapped_any(const struct in6_addr *a)
+{
+ return ipv6_addr_v4mapped(a) && ipv4_is_zeronet(a->s6_addr32[3]);
+}
+
static inline bool ipv6_addr_v4mapped_loopback(const struct in6_addr *a)
{
return ipv6_addr_v4mapped(a) && ipv4_is_loopback(a->s6_addr32[3]);