From: Michael Tremer Date: Sun, 14 Sep 2025 10:19:00 +0000 (+0200) Subject: ovpnmain.cgi: Fix reading the legacy routes file X-Git-Tag: v2.29-core197~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54944268e729c8939a49a3e9536f5ad85ce9c2b8;p=ipfire-2.x.git ovpnmain.cgi: Fix reading the legacy routes file Signed-off-by: Michael Tremer --- diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 37b6de88b..2dc4ae18d 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -945,23 +945,24 @@ sub check_ccdconf sub read_routepushfile($) { my $hash = shift; - # Don't read the legacy file if we already have a value - if ($hash->{'ROUTES_PUSH'} ne "") { - unlink($routes_push_file); - # This is some legacy code that reads the routes file if it is still present - } elsif (-e "$routes_push_file") { - delete $hash->{'ROUTES_PUSH'}; - + if (-e "$routes_push_file") { my @routes = (); open(FILE,"$routes_push_file"); while () { + chomp; push(@routes, $_); } close(FILE); $hash->{'ROUTES_PUSH'} = join("|", @routes); + + # Write the settings + &writesettings(); + + # Unlink the legacy file + unlink($routes_push_file); } }