]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
general-functions.pl: Add function to get the gateway address.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 28 Oct 2014 20:52:53 +0000 (21:52 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 28 Oct 2014 20:52:53 +0000 (21:52 +0100)
config/cfgroot/general-functions.pl

index 35ae7c0930e8fd91cae3d60e0558d6a5e06299cd..5b4b65e798707b95ef29623f511f922045b3403c 100644 (file)
@@ -1123,4 +1123,16 @@ sub get_red_interface() {
        return $interface;
 }
 
+# Function to get the current used gateway address.
+sub get_gateway() {
+
+       open(GATEWAY, "${General::swroot}/red/remote-ipaddress") or die "Could not open /var/ipfire/red/remote-ipaddress";
+
+       my $gateway = <GATEWAY>;
+       close(GATEWAY);
+       chomp $gateway;
+
+       return $gateway;
+}
+
 1;