From 351e6650429c5095ac11efe8f6f2b02e046ab20b Mon Sep 17 00:00:00 2001 From: Vincent Li Date: Mon, 21 Jul 2025 19:37:48 +0000 Subject: [PATCH] wireguard-functions.pl: backport two fixes from ipfire commit 68a3334413efb1a963b7cc6c6dca1ec0126e1cc1 Author: Michael Tremer Date: Fri Jul 18 08:42:12 2025 +0000 wireguard-functions.pl: Automatically skip IPv6 subnets Since we do not support this and some VPN providers generate configuration files that send any data over to them, we simply ignore any IPv6 subnets. Signed-off-by: Michael Tremer commit f7565a885b55384a64edd8bd73079143a04da519 Author: Michael Tremer Date: Fri Jul 18 09:57:34 2025 +0000 wireguard-functions.pl: Remove any carriage returns on import Some files might include carriage returns which won't be removed by chomp() on Linux. To be extra safe, we remove them manually. Signed-off-by: Michael Tremer Signed-off-by: Vincent Li --- config/cfgroot/wireguard-functions.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/cfgroot/wireguard-functions.pl b/config/cfgroot/wireguard-functions.pl index 763129262..76715fce9 100644 --- a/config/cfgroot/wireguard-functions.pl +++ b/config/cfgroot/wireguard-functions.pl @@ -491,6 +491,9 @@ sub parse_configuration($$) { # Remove line breaks chomp; + # Remove any carriage returns + $_ =~ s/\r$//; + # Search for section headers if ($_ =~ m/^\[(\w+)\]$/) { $section = $1; @@ -573,6 +576,9 @@ sub parse_configuration($$) { # Check if all networks are valid foreach my $network (@networks) { + # Skip any IPv6 networks + next if ($network =~ m/:/); + unless (&Network::check_subnet($network)) { push(@errormessages, $Lang::tr{'invalid network'} . " $network"); }