Skip to content

Fix IPv6 bans being ignored when loading banlist

Hanicef requested to merge Hanicef/SRB2:fix-parse-ipv6-ban into next

currently, IPv6 has a pretty serious bug that prevents IPv6 addresses from loading from the banlist. the cause is due to a formatting error on IPv6 addresses when it writes to the banlist, where SRB2 will write IPv6 with brackets around the address. however, when loading the ban later, it uses the function I_getaddrinfo, which doesn't expect addresses to be wrapped in brackets. this causes the address to fail to parse and is subsequently ignored from the banlist.

here's a console log to illustrate the bug:

$banip 192.0.2.0 test
Banned IP address 192.0.2.0 for: test
$banip 2001:db8::1 test
Banned IP address 2001:db8::1 for: test
$showbanlist
Ban List:
1: 192.0.2.0/32 (test)
2: [2001:db8::1]/128 (test)
$reloadbans 
$showbanlist
Ban List:
1: 192.0.2.0/32 (test)

Merge request reports