]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ovpnmain.cgi: Fix pushing all routes
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Oct 2025 15:52:43 +0000 (16:52 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Oct 2025 15:52:43 +0000 (16:52 +0100)
If there were multiple client routes configured, the OpenVPN server was
only told about the first one. This patch fixes this and also cleans up
the code for pushing the server routes, too.

Fixes: #13901 - iroute line is only written for the first of the OpenVPN client routes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index 1ec32799889306ef02fd06504349c2ead30566f0..6b5b713642191e08a89fa5b7223daee978dcf659 100644 (file)
@@ -571,7 +571,7 @@ sub get_ccd_client_routes($) {
 
        foreach my $key (keys %client_routes) {
                if ($client_routes{$key}[0] eq $name) {
-                       push(@routes, $client_routes{$key}[1]);
+                       push(@routes, @{$client_routes{$key}}[1 .. $#{$client_routes{$key}}]);
                }
        }
 
@@ -589,11 +589,7 @@ sub get_ccd_server_routes($) {
 
        foreach my $key (keys %server_routes) {
                if ($server_routes{$key}[0] eq $name) {
-                       my $i = 1;
-
-                       while (my $route = $server_routes{$key}[$i++]) {
-                               push(@routes, $route);
-                       }
+                       push(@routes, @{$server_routes{$key}}[1 .. $#{$server_routes{$key}}]);
                }
        }