From 4eb514ce71553b3eeaadc121bbe0a9b2f8b71d38 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 14 Jan 2024 19:20:25 +0100 Subject: [PATCH] Fix IPv6 bans incorrectly banning IPv4 address --- src/netcode/i_tcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 3fa230647..810453f45 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -424,7 +424,7 @@ static boolean SOCK_cmpipv6(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask) { UINT8 bitmask; I_Assert(mask <= 128); - if (memcmp(&a->ip6.sin6_addr, &b->ip6.sin6_addr, mask / 8) != 0) + if (memcmp(&a->ip6.sin6_addr.s6_addr, &b->ip6.sin6_addr.s6_addr, mask / 8) != 0) return false; if (mask % 8 == 0) return true; @@ -437,6 +437,9 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask) { UINT32 bitmask = INADDR_NONE; + if (a->any.sa_family != b->any.sa_family) + return false; + if (mask && mask < 32) bitmask = htonl((UINT32)(-1) << (32 - mask));