From 02cac39033091eaa1e77f23107934615e302a91a Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Fri, 4 Dec 2009 14:36:27 -0800 Subject: Fix 5113: bgp default-originate commit fails for IPv6 --- .../neighbor/node.tag/default-originate/node.def | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def index e318a3ae..9147464f 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def @@ -1,12 +1,22 @@ help: Set to send default route to this neighbor + commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" + commit:expression: $VAR(../peer-group/) == ""; "protocold bgp $VAR(../../@) neighbor $VAR(../@): you can't set default-originate for a neighbor in a peer-group" -delete: touch /tmp/bgp-neighbor-$VAR(../@)-default-originate.$PPID -end: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) default-originate "; - if [ -f "/tmp/bgp-neighbor-$VAR(../@)-default-originate.$PPID" ]; then - rm -rf /tmp/bgp-neighbor-$VAR(../@)-default-originate.$PPID; + +end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then + vyatta-vtysh --noerror \ + -c "configure terminal" \ + -c "router bgp $VAR(../../@)" \ + -c "address-family ipv6" \ + -c "no neighbor $VAR(../@) default-originate "; else + vyatta-vtysh --noerror \ + -c "configure terminal" \ + -c "router bgp $VAR(../../@)" \ + -c "no neighbor $VAR(../@) default-originate "; + fi; + if [ ${COMMIT_ACTION} = 'SET' ]; then if [ -n "$VAR(./route-map/@)" ]; then cond="route-map $VAR(./route-map/@) " ; fi ; @@ -14,9 +24,18 @@ end: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@ peer="remote-as $VAR(../remote-as/@)"; else peer="peer-group $VAR(../peer-group/@)"; - fi; - vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) default-originate $cond"; \ + fi; + if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../@)" \ + -c "address-family ipv6" \ + -c "neighbor $VAR(../@) $peer" \ + -c "address-family ipv6" \ + -c "neighbor $VAR(../@) default-originate $cond"; + else + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../@)" \ + -c "neighbor $VAR(../@) $peer" \ + -c "neighbor $VAR(../@) default-originate $cond"; + fi; fi; - -- cgit v1.2.3