]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
lldp.cgi: Call binary for peers and do json stuff only if the service is enabled
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 15 Nov 2025 10:07:57 +0000 (11:07 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Nov 2025 15:24:12 +0000 (15:24 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/lldp.cgi

index 9e30faa92f18ca23a90dea2b2b51e713d31c2add..194f4ec828159a88842ae60306c8cfdc9106f57f 100644 (file)
@@ -116,21 +116,21 @@ MAIN:
 END
        &Header::closebox();
 
-       # Load data about all peers
-       my @output = &General::system_output("lldpctl", "-f", "json0");
+       # Show a list with all peers if the service is enabled
+       if ($settings{"ENABLED"} eq "on") {
+               # Load data about all peers
+               my @output = &General::system_output("lldpctl", "-f", "json0");
 
-       my $json;
+               my $json;
 
-       # Parse the JSON output
-       eval {
-               $json = decode_json join("\n", @output);
-               1;
-       } or do {
-               $json = undef;
-       };
+               # Parse the JSON output
+               eval {
+                       $json = decode_json join("\n", @output);
+                       1;
+               } or do {
+                       $json = undef;
+               };
 
-       # Show a list with all peers if the service is enabled
-       if ($settings{"ENABLED"} eq "on") {
                &Header::opensection($Lang::tr{'lldp neighbors'});
 
                # Fetch the interface object