From 5a040d2ba78f633b7633f8fded6ac7e14a9d453b Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Wed, 9 Apr 2008 14:05:30 -0700 Subject: Fix 3126: ospf virtual-link authentication types should not be able to be coexisted in the config --- .../node.tag/authentication/md5/node.def | 26 ++++++++++++---------- .../authentication/plaintext-password/node.def | 21 +++++++++-------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def index c2af0dd3..e81d00be 100644 --- a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def +++ b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/md5/node.def @@ -1,14 +1,16 @@ help: Configure MD5 key id -create:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ - -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication-key\" \ - -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication message-digest\"; " +commit:expression: $VAR(../plaintext-password/) == "" ; "plaintext-password already set" -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ - -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication null\"; " +create: ${vyatta_sbindir}/vyatta-vtysh.pl \ + -c "configure terminal" \ + -c "router ospf" \ + -c "no area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication-key" \ + -c "area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication message-digest"; + +delete: ${vyatta_sbindir}/vyatta-vtysh.pl \ + -c "configure terminal" \ + -c "router ospf" \ + -c "area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication null"; diff --git a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/plaintext-password/node.def b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/plaintext-password/node.def index ab268f98..6b024a35 100644 --- a/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/plaintext-password/node.def +++ b/templates/protocols/ospf/area/node.tag/virtual-link/node.tag/authentication/plaintext-password/node.def @@ -1,20 +1,23 @@ type: txt help: Configure plain text password + syntax:expression: exec " \ if [ `echo -n $VAR(@) | wc -c` -gt 8 ]; then \ echo Password must be 8 characters or less ; \ exit 1 ; \ fi ; " -update:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ - -c \"configure terminal\" -c \"router ospf\" \ - -c \"area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication authentication-key $VAR(@) \"; " +commit:expression: $VAR(../md5/) == "" ; "md5 password already set" + +update: ${vyatta_sbindir}/vyatta-vtysh.pl \ + -c "configure terminal" -c "router ospf" \ + -c "area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication authentication-key $VAR(@) " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl \ - -c \"configure terminal\" -c \"router ospf\" \ - -c \"no area $VAR(../../../@) virtual-link $VAR(../../@) \ - authentication authentication-key \"; " +delete: ${vyatta_sbindir}/vyatta-vtysh.pl \ + -c "configure terminal" -c "router ospf" \ + -c "no area $VAR(../../../@) virtual-link $VAR(../../@) \ + authentication authentication-key"; comp_help: possible completions: - Plain text password (8 characters or less) + Plain text password (8 characters or less) -- cgit v1.2.3 From c999ddec2a30f23121072d51a49003fd822527d7 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Wed, 9 Apr 2008 16:39:45 -0700 Subject: Fix [Bug 3125] "...... range <> no-advertise" should be removed from the config while it is removed from the routing engine by "set protocols ospf area <> range <> substitute <>" --- .../protocols/ospf/area/node.tag/range/node.def | 47 +++++++++++++++++++--- .../area/node.tag/range/node.tag/cost/node.def | 10 ++--- .../node.tag/range/node.tag/not-advertise/node.def | 6 --- .../node.tag/range/node.tag/substitute/node.def | 7 +--- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/templates/protocols/ospf/area/node.tag/range/node.def b/templates/protocols/ospf/area/node.tag/range/node.def index 63147ac6..ab689990 100644 --- a/templates/protocols/ospf/area/node.tag/range/node.def +++ b/templates/protocols/ospf/area/node.tag/range/node.def @@ -2,9 +2,44 @@ tag: type: ipv4net help: Summarize routes matching prefix (border routers only) syntax:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $VAR(@)" -create:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"area $VAR(../@) range $VAR(@)\"; " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no area $VAR(../@) range $VAR(@)\"; " + +delete: touch /tmp/ospf-range.$PPID + +end: if [ -f /tmp/ospf-range.$PPID ]; then + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "no area $VAR(../@) range $VAR(@)"; + rm /tmp/ospf-range.$PPID; + else + ${vyatta_sbindir}/vyatta-check-typeless-node.pl \ + "protocols ospf area $VAR(../@) range $VAR(@) not-advertise"; + if [ $? -eq 0 ] ; then + if [ -n "$VAR(cost/@)" ] || [ -n "$VAR(substitute/@)" ]; then + echo "Remove 'not-advertise' before setting cost or substitue"; + exit 1; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -noerr -c "configure terminal" \ + -c "router ospf" \ + -c "no area $VAR(../@) range $VAR(@)"; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "area $VAR(../@) range $VAR(@) not-advertise"; + else + ${vyatta_sbindir}/vyatta-vtysh.pl -noerr -c "configure terminal" \ + -c "router ospf" \ + -c "no area $VAR(../@) range $VAR(@)"; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "area $VAR(../@) range $VAR(@)"; + if [ -n "$VAR(cost/@)" ]; then + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "area $VAR(../@) range $VAR(@) cost $VAR(cost/@)"; + fi; + if [ -n "$VAR(substitute/@)" ]; then + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "area $VAR(../@) range $VAR(@) substitute $VAR(substitute/@)"; + fi; + fi; + fi; diff --git a/templates/protocols/ospf/area/node.tag/range/node.tag/cost/node.def b/templates/protocols/ospf/area/node.tag/range/node.tag/cost/node.def index 11b744db..fcd58871 100644 --- a/templates/protocols/ospf/area/node.tag/range/node.tag/cost/node.def +++ b/templates/protocols/ospf/area/node.tag/range/node.tag/cost/node.def @@ -1,11 +1,7 @@ type: u32 help: Metric for this range + syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 16777215; "Metric must be between 0-16777215" -update:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"area $VAR(../../@) range $VAR(../@) cost $VAR(@)\"; " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no area $VAR(../../@) range $VAR(../@) cost $VAR(@)\"; " + comp_help: possible completions: - <0-16777215> Set metric for this range + <0-16777215> Set metric for this range diff --git a/templates/protocols/ospf/area/node.tag/range/node.tag/not-advertise/node.def b/templates/protocols/ospf/area/node.tag/range/node.tag/not-advertise/node.def index 22a10e0c..0a8079ce 100644 --- a/templates/protocols/ospf/area/node.tag/range/node.tag/not-advertise/node.def +++ b/templates/protocols/ospf/area/node.tag/range/node.tag/not-advertise/node.def @@ -1,7 +1 @@ help: Do NOT advertise this range -create:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"area $VAR(../../@) range $VAR(../@) not-advertise\"; " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no area $VAR(../../@) range $VAR(../@) not-advertise\"; " diff --git a/templates/protocols/ospf/area/node.tag/range/node.tag/substitute/node.def b/templates/protocols/ospf/area/node.tag/range/node.tag/substitute/node.def index dba70a07..a691273e 100644 --- a/templates/protocols/ospf/area/node.tag/range/node.tag/substitute/node.def +++ b/templates/protocols/ospf/area/node.tag/range/node.tag/substitute/node.def @@ -1,9 +1,4 @@ type: ipv4net help: Announce area range as another prefix + syntax:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $VAR(@)" -update:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"area $VAR(../../@) range $VAR(../@) substitute $VAR(@)\"; " -delete:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no area $VAR(../../@) range $VAR(../@) substitute $VAR(@)\"; " -- cgit v1.2.3