diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2012-06-21 18:04:09 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2012-06-21 18:04:09 -0700 |
commit | 05cb0712cb5dd1876acbaf0666f9800a71ab324e (patch) | |
tree | 82fafc32250f20c341a1640e72f70e33e0918db7 | |
parent | 80494ea87918712040eb5cc7df94de9afafc5b18 (diff) | |
download | vyatta-cfg-05cb0712cb5dd1876acbaf0666f9800a71ab324e.tar.gz vyatta-cfg-05cb0712cb5dd1876acbaf0666f9800a71ab324e.zip |
Simplify name matching regex
Turns out that [\d]+ is same as \d+ since \d is the class
of all digits and [] is the set operator
-rwxr-xr-x | lib/Vyatta/Interface.pm | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 93d559f..7df4369 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -58,31 +58,31 @@ use constant { # path: configuration level below interfaces # vif: places to look for vif (if any) my %net_prefix = ( - '^adsl[\d]+$' => { path => 'adsl', + '^adsl\d+$' => { path => 'adsl', vif => 'vif', }, - '^bond[\d]+$' => { path => 'bonding', + '^bond\d+$' => { path => 'bonding', vif => 'vif', }, - '^bond[\d]+v[\d]+$' => { path => 'vrrp' }, - '^br[\d]+$' => { path => 'bridge', + '^bond\d+v\d+$' => { path => 'vrrp' }, + '^br\d+$' => { path => 'bridge', vif => 'vif' }, - '^eth[\d]+$' => { path => 'ethernet', + '^eth\d+$' => { path => 'ethernet', vif => 'vif', }, - '^eth[\d]+v[\d]+$' => { path => 'vrrp' }, - '^eth[\d]+.[\d]+v[\d]+$' => { path => 'vrrp' }, + '^eth\d+v\d+$' => { path => 'vrrp' }, + '^eth\d+.\d+v\d+$' => { path => 'vrrp' }, '^lo$' => { path => 'loopback' }, - '^ml[\d]+$' => { path => 'multilink', + '^ml\d+$' => { path => 'multilink', vif => 'vif', }, - '^vtun[\d]+$' => { path => 'openvpn' }, - '^wan[\d]+$' => { path => 'serial', + '^vtun\d+$' => { path => 'openvpn' }, + '^wan\d+$' => { path => 'serial', vif => ( 'cisco-hdlc vif', 'ppp vif', 'frame-relay vif' ), }, - '^tun[\d]+$' => { path => 'tunnel' }, - '^vti[\d]+$' => { path => 'vti' }, - '^wlm[\d]+$' => { path => 'wireless-modem' }, - '^peth[\d]+$' => { path => 'pseudo-ethernet', + '^tun\d+$' => { path => 'tunnel' }, + '^vti\d+$' => { path => 'vti' }, + '^wlm\d+$' => { path => 'wireless-modem' }, + '^peth\d+$' => { path => 'pseudo-ethernet', vif => 'vif', }, - '^wlan[\d]+$' => { path => 'wireless', vif => 'vif' }, - '^ifb[\d]+$' => { path => 'input' }, + '^wlan\d+$' => { path => 'wireless', vif => 'vif' }, + '^ifb\d+$' => { path => 'input' }, '^dp\d+p\d+p\d+$' => { path => 'dataplane', vif => 'vif' }, '^dp\d+em\d+$' => { path => 'dataplane', vif => 'vif' }, ); @@ -302,7 +302,7 @@ sub new { $path .= " $vifpath $vif" if $vif; # add the vif 1 to multilink paths since they don't have vif interfaces # denoted by <if>.<vif> and only allow 1 vif to be set - $path .= " vif 1" if ($dev =~ m/^ml[\d]+$/); + $path .= " vif 1" if ($dev =~ m/^ml\d+$/); $path .= " vrrp vrrp-group $vrid interface" if $vrid; $type = 'vrrp' if $vrid; |