From 86322573dae188303af9d821f8c72f96d178a2ff Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Wed, 19 Nov 2008 14:20:56 -0800 Subject: move submodule to get interface related info to VyattaMisc --- scripts/VyattaMisc.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'scripts') diff --git a/scripts/VyattaMisc.pm b/scripts/VyattaMisc.pm index a1d1792..5f7b436 100755 --- a/scripts/VyattaMisc.pm +++ b/scripts/VyattaMisc.pm @@ -32,6 +32,18 @@ use strict; use VyattaConfig; +sub get_sysfs_value { + my ($intf, $name) = @_; + + open (my $statf, '<', "/sys/class/net/$intf/$name") + or die "Can't open statistics file /sys/class/net/$intf/$name"; + + my $value = <$statf>; + chomp $value if defined $value; + close $statf; + return $value; +} + # check if interace is configured to get an IP address using dhcp sub is_dhcp_enabled { my ($intf, $outside_cli) = @_; -- cgit v1.2.3