]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
general-functions.pl: Do not die if no red interface could be determined.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 9 Mar 2022 14:12:32 +0000 (15:12 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 9 Mar 2022 15:46:19 +0000 (15:46 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/general-functions.pl

index 5118a9d69c00a81fd316a1312c54e62967fb3467..6f49585dc6b4cae5818d1df54912458c464715f1 100644 (file)
@@ -1228,12 +1228,15 @@ sub firewall_reload() {
 # Function which will return the used interface for the red network zone (red0, ppp0, etc).
 # if you change this also check speed.cgi that include a local copy for systemload reasons
 sub get_red_interface() {
-
-       open(IFACE, "${General::swroot}/red/iface") or die "Could not open /var/ipfire/red/iface";
-
-       my $interface = <IFACE>;
-       close(IFACE);
-       chomp $interface;
+       my $interface;
+       my $red_iface_file = "${General::swroot}/red/iface";
+
+       if (-e $red_iface_file) {
+               open(IFACE, "$red_iface_file") or die "Could not open $red_iface_file";
+               $interface = <IFACE>;
+               close(IFACE);
+               chomp $interface;
+       }
 
        return $interface;
 }