From 54944268e729c8939a49a3e9536f5ad85ce9c2b8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 14 Sep 2025 12:19:00 +0200 Subject: [PATCH] ovpnmain.cgi: Fix reading the legacy routes file Signed-off-by: Michael Tremer --- html/cgi-bin/ovpnmain.cgi | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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); } } -- 2.47.3