]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ovpnmain.cgi: Fix reading the legacy routes file
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Sep 2025 10:19:00 +0000 (12:19 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Sep 2025 10:19:00 +0000 (12:19 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index 37b6de88bdcb4d28598e02742eec83d89ef97c3a..2dc4ae18dfe415e683d9d193d2b3007e8c125b62 100644 (file)
@@ -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 (<FILE>) {
+                       chomp;
                        push(@routes, $_);
                }
                close(FILE);
 
                $hash->{'ROUTES_PUSH'} = join("|", @routes);
+
+               # Write the settings
+               &writesettings();
+
+               # Unlink the legacy file
+               unlink($routes_push_file);
        }
 }