diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2008-05-09 17:50:13 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2008-05-09 17:50:13 -0700 |
commit | 6851a2b28cb7c15bfc4a884c8bd11d784389a8ed (patch) | |
tree | c70fa66afde624cdc84bbc8f2460f16ab5ef13f2 /scripts | |
parent | 04f1b8990af194e436c8581f1ca1a7f60596899c (diff) | |
parent | 132e5c7b81bc308bfd66b23a7d619329ded829df (diff) | |
download | vyatta-cfg-6851a2b28cb7c15bfc4a884c8bd11d784389a8ed.tar.gz vyatta-cfg-6851a2b28cb7c15bfc4a884c8bd11d784389a8ed.zip |
Merge branch 'hollywood' of http://git.vyatta.com/vyatta-cfg into hollywood
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/VyattaConfigLoad.pm | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/scripts/VyattaConfigLoad.pm b/scripts/VyattaConfigLoad.pm index a5c5b08..bf86e57 100755 --- a/scripts/VyattaConfigLoad.pm +++ b/scripts/VyattaConfigLoad.pm @@ -29,49 +29,47 @@ use VyattaConfig; # configuration ordering. higher rank configured before lower rank. my $default_rank = 0; my %config_rank = ( - 'qos-policy' => 110, - 'firewall' => 102, - 'service nat' => 101, - 'interfaces' => 100, - 'interfaces bridge' => 99, - 'interfaces ethernet' => 98, - 'interfaces tunnel' => 91, - 'system gateway-address'=> 89, - 'system name-server' => 88, - 'system login user' => 87, - 'system' => 86, - 'protocols static' => 85, - 'service ssh' => 84, - 'service telnet' => 83, - 'policy' => 82, - 'protocols bgp' => 79, - 'protocols ospf' => 78, - 'protocols rip' => 77, - 'vpn' => 60, + 'qos-policy' => 1100, + 'firewall' => 1020, + 'service nat' => 1010, + 'interfaces' => 1000, + 'interfaces bridge' => 990, + 'interfaces ethernet' => 980, + 'interfaces tunnel' => 910, + 'system gateway-address'=> 890, + 'system name-server' => 880, + 'system login user' => 870, + 'system' => 860, + 'protocols static' => 850, + 'service ssh' => 840, + 'service telnet' => 830, + 'policy' => 820, + 'protocols bgp' => 790, + 'protocols ospf' => 780, + 'protocols rip' => 770, + 'vpn' => 600, ); -my %wildcard_rank = ( - 'interfaces ethernet * vrrp' => 50, - 'interfaces ethernet * vif * vrrp' => 50, +my %regex_rank = ( + 'interfaces ethernet \S* vrrp' => 500, + 'interfaces ethernet \S* vif \S* vrrp' => 500, + 'protocols bgp \d+ neighbor \S*[^\d.]\S*' => 800, ); my @all_nodes = (); my @all_naked_nodes = (); -# the wildcard matching could use some serious optimization. but probably -# not when we only have a couple of entries. -sub match_wildcard { +sub match_regex { my ($pattern, $str) = @_; - $pattern =~ s/\*/\\S*/g; $pattern =~ s/^(.*)$/\^$1\$/; return ($str =~ m/$pattern/) ? 1 : 0; } -sub get_wildcard_rank { +sub get_regex_rank { my ($str) = @_; - foreach (keys %wildcard_rank) { - if (match_wildcard($_, $str)) { - return $wildcard_rank{$_}; + foreach (keys %regex_rank) { + if (match_regex($_, $str)) { + return $regex_rank{$_}; } } return undef; @@ -85,7 +83,7 @@ sub get_config_rank { if (defined($config_rank{$path_str})) { return ($config_rank{$path_str}); } - my $wrank = get_wildcard_rank($path_str); + my $wrank = get_regex_rank($path_str); return $wrank if (defined($wrank)); pop @path; } |