diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-11-19 14:20:56 -0800 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-11-19 14:20:56 -0800 |
commit | 86322573dae188303af9d821f8c72f96d178a2ff (patch) | |
tree | dd6a6027ba114ff4928688295549a3d262544135 /scripts | |
parent | 3a33aaead277f7f6da162b2285b1659cc2c2b7fd (diff) | |
download | vyatta-cfg-86322573dae188303af9d821f8c72f96d178a2ff.tar.gz vyatta-cfg-86322573dae188303af9d821f8c72f96d178a2ff.zip |
move submodule to get interface related info to VyattaMisc
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/VyattaMisc.pm | 12 |
1 files changed, 12 insertions, 0 deletions
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) = @_; |