From 2cc732a1b1ddfc492eb047818be2a56167d2e446 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 4 Jun 2009 14:49:08 -0700 Subject: Make sure interface name regex are anchored This solves the problem that 'show interfaces ethernet' also shows pseudo ethernet (peth0) device. The problem was that peth0 matched the regex since it was missing start/end. (cherry picked from commit 77fb131b888bafd815722ebdceb5282b43dbb96d) --- lib/Vyatta/Interface.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index d81497b..96429c0 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -56,26 +56,26 @@ 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', }, - 'br[\d]+' => { path => 'bridge', + '^br[\d]+$' => { path => 'bridge', vif => 'vif' }, - 'eth[\d]+' => { path => 'ethernet', + '^eth[\d]+$' => { path => 'ethernet', vif => 'vif', }, - 'lo' => { path => 'loopback' }, - 'ml[\d]+' => { path => 'multilink', + '^lo$' => { path => 'loopback' }, + '^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' }, - 'wlm[\d]+' => { path => 'wireless-modem' }, - 'peth[\d]+' => { path => 'pseudo-ethernet', + '^tun[\d]+$' => { path => 'tunnel' }, + '^wlm[\d]+$' => { path => 'wireless-modem' }, + '^peth[\d]+$' => { path => 'pseudo-ethernet', vif => 'vif', }, - 'wlan[\d]+' => { path => 'wireless', vif => 'vif' }, + '^wlan[\d]+$' => { path => 'wireless', vif => 'vif' }, ); # get list of interface types -- cgit v1.2.3