git: ifconfig(8): Fix IPv6 CIDR parsing error for wgaip (wg allowed-ip)
Aaron LI
aly at crater.dragonflybsd.org
Sat Oct 19 06:08:40 PDT 2024
commit d4d5b6b13d7dcbd9707958fde1dad45eafdcc4fc
Author: Aaron LI <aly at aaronly.me>
Date: Sat Oct 19 20:57:59 2024 +0800
ifconfig(8): Fix IPv6 CIDR parsing error for wgaip (wg allowed-ip)
The inet_net_pton() is inherited from legacy ISC named code and uses a
legacy IPv6 CIDR format (e.g., 1:2:3:4/64), so it fails to parse some
now valid IPv6 CIDRs (e.g., 1:2:3:4::/64). This was causing 'wgaip'
option to fail configure some IPv6 allowed-ips/networks.
Given that inet_net_pton() is not standard and behaves differently
across BSDs and Linux, it might be not really useful to fix/improve it
(e.g., by porting OpenBSD's version). Instead, I chose to write
wg_aip_parse() to manually parse the CIDRs.
Reported-by: Michael Neumann (mneumann) on IRC
Summary of changes:
sbin/ifconfig/ifwg.c | 57 +++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 45 insertions(+), 12 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/d4d5b6b13d7dcbd9707958fde1dad45eafdcc4fc
--
DragonFly BSD source repository
More information about the Commits
mailing list