diff options
author | Michael Larson <mike@ft1.vyatta.com> | 2009-09-09 16:26:01 -0700 |
---|---|---|
committer | Michael Larson <mike@ft1.vyatta.com> | 2009-09-09 16:26:01 -0700 |
commit | 5f1a33134d463fa565ee9dd43237252bd27d5fb3 (patch) | |
tree | 70f1ac5b1e76a0ae875c71ca15089ecdbc45c122 /lib/Vyatta/Misc.pm | |
parent | 028e8e12c5e15efc0a316641f2b02e46d5c77210 (diff) | |
parent | 42abfac6f11077dbfc3b0eaf845597e38f7cd685 (diff) | |
download | vyatta-cfg-5f1a33134d463fa565ee9dd43237252bd27d5fb3.tar.gz vyatta-cfg-5f1a33134d463fa565ee9dd43237252bd27d5fb3.zip |
Merge branch 'kenwood' of http://git.vyatta.com/vyatta-cfg into kenwood
Diffstat (limited to 'lib/Vyatta/Misc.pm')
-rwxr-xr-x | lib/Vyatta/Misc.pm | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm index 01f1537..6089361 100755 --- a/lib/Vyatta/Misc.pm +++ b/lib/Vyatta/Misc.pm @@ -93,11 +93,18 @@ sub generate_dhclient_intf_files { } +# get list of interfaces on the system via sysfs +# skip dot files (and any interfaces name .xxx) +# and bond_masters file used by bonding +# and wireless control interfaces sub getInterfaces { opendir( my $sys_class, '/sys/class/net' ) or die "can't open /sys/class/net: $!"; - my @interfaces = - grep { ( !/^\./ ) && ( $_ ne 'bonding_masters' ) } readdir $sys_class; + my @interfaces = grep { ( !/^\./ ) && + ( $_ ne 'bonding_masters' ) && + ! ( $_ =~ '^mon.wlan\d$') && + ! ( $_ =~ '^wmaster\d+$') + } readdir $sys_class; closedir $sys_class; return @interfaces; } @@ -225,7 +232,10 @@ sub isClusterIP { my @services = $vc->returnValues("cluster group $cluster_group service"); foreach my $service (@services) { - if ( $ip eq substr( $service, 0, index( $service, '/' ) ) ) { + if ($service =~ /\//) { + $service = substr( $service, 0, index( $service, '/' )); + } + if ( $ip eq $service ) { return 1; } } @@ -355,7 +365,15 @@ sub getPortRuleString { return ( undef, $err ); } } - ( $success, $err ) = isValidPortName( $port_spec, $proto ); + if ($proto eq 'tcp_udp') { + ( $success, $err ) = isValidPortName( $port_spec, 'tcp' ); + if (defined $success) { + # only do udp test if the tcp test was a success + ( $success, $err ) = isValidPortName( $port_spec, 'udp' ) + } + } else { + ( $success, $err ) = isValidPortName( $port_spec, $proto ); + } if ( defined($success) ) { $num_ports += 1; next; |