From 2d9121d9e81ff56e6d511d8df25e433cc74ee087 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 1 Apr 2009 17:36:18 -0700 Subject: Handle ipv6 daemons Need to do special case IPV6 daemon restart --- scripts/quagga-manager | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/quagga-manager b/scripts/quagga-manager index e7b5d5ae..fc1326f0 100755 --- a/scripts/quagga-manager +++ b/scripts/quagga-manager @@ -7,7 +7,7 @@ #echo $* | logger -p local7.debug -t quagga-manager usage() { - echo "Usage: $0 {check|start|stop|restart} {bgpd|ospfd|ripd|ripngd}" + echo "Usage: $0 {check|start|stop|restart} {bgpd|ospfd|ripd|ospf6d|ripngd}" exit 1 } @@ -74,7 +74,15 @@ stop() { reload_config() { local daemon=$1 - local proto=${daemon/%d/} + local proto + + # handle exception... + case $daemon in + bgpd|ospfd|ripd|ripngd|isisd) proto=${daemon/%d/};; + ospf6d) proto="ospfv3";; + *) echo "Unknown daemon $daemon"; exit 1;; + esac + local vyatta_cfg=/opt/vyatta/config/active local path=$vyatta_cfg/protocols/$proto @@ -94,10 +102,11 @@ reload_config() { # Erase portion of active configuration for that protocol rm -fr $path - # special case for interface configuration + # special case for interface, remove parameters force reload case $proto in - rip|ospf) - find $vyatta_cfg/interfaces -type d -name $daemon -exec rm -fr '{}' \; ;; + rip|ospf|ripng|ospfv3) + find $vyatta_cfg/interfaces -type d -name $proto \ + -exec rm -fr '{}' \; ;; esac # Reload causing configuration to activate - implies commit -- cgit v1.2.3 From 7807977e9701dc6acb00ce7bc17d539eb4eed8c3 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 1 Apr 2009 17:38:41 -0700 Subject: Don't stop daemon if OSPF/RIP still has parameters Need daemon to hold around parameters for start. --- scripts/quagga-manager | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/quagga-manager b/scripts/quagga-manager index fc1326f0..40a1ebfe 100755 --- a/scripts/quagga-manager +++ b/scripts/quagga-manager @@ -129,7 +129,11 @@ update() { # Cleanup any daemons no longer needed for p in ${deleted[*]} - do stop $p + do + # Need daemon to hold state of interface + if [ -z "$(find $vyatta_cfg/interfaces -type d -name $p)" ] + then stop $p + fi done start watchquagga -- cgit v1.2.3 From 73712ffe263d0f12cf6db914e9457509bc62f045 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 1 Apr 2009 17:38:41 -0700 Subject: Don't stop daemon if OSPF/RIP still has parameters Need daemon to hold around parameters for start. --- scripts/quagga-manager | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/scripts/quagga-manager b/scripts/quagga-manager index 40a1ebfe..58c91b66 100755 --- a/scripts/quagga-manager +++ b/scripts/quagga-manager @@ -4,7 +4,7 @@ # # debug -#echo $* | logger -p local7.debug -t quagga-manager +# echo $* | logger -p local7.debug -t quagga-manager usage() { echo "Usage: $0 {check|start|stop|restart} {bgpd|ospfd|ripd|ospf6d|ripngd}" @@ -42,6 +42,8 @@ start() { zebra) args+=( -l -S -s 1048576 ) ;; watchquagga) args=( -dz -p ${pid_dir}/${daemon}.pid ); + # Note: at present ospf/rip only monitored if actually active + # probably should get smarter in future here local -a protocols=(`/opt/vyatta/bin/vyatta-show-protocols exists`) if [ ${#protocols[*]} -eq 0 ] @@ -72,16 +74,18 @@ stop() { rm -f $pid_dir/${daemon}.pid } -reload_config() { +get_protocol() { local daemon=$1 - local proto - - # handle exception... case $daemon in - bgpd|ospfd|ripd|ripngd|isisd) proto=${daemon/%d/};; - ospf6d) proto="ospfv3";; - *) echo "Unknown daemon $daemon"; exit 1;; + bgpd|ospfd|ripd|ripngd|isisd) echo ${daemon/%d/};; + ospf6d) echo "ospfv3";; + *) echo "Unknown daemon $daemon" 1>&2; exit 1;; esac +} + +reload_config() { + local daemon=$1 + local proto=$(get_protocol $daemon) local vyatta_cfg=/opt/vyatta/config/active local path=$vyatta_cfg/protocols/$proto @@ -104,8 +108,11 @@ reload_config() { # special case for interface, remove parameters force reload case $proto in - rip|ospf|ripng|ospfv3) - find $vyatta_cfg/interfaces -type d -name $proto \ + rip|ospf) + find $vyatta_cfg/interfaces -type d -path "*/ip/$proto" \ + -exec rm -fr '{}' \; ;; + ripng|ospfv3) + find $vyatta_cfg/interfaces -type d -path "*/ipv6/$proto" \ -exec rm -fr '{}' \; ;; esac @@ -117,7 +124,24 @@ reload_config() { trap "" EXIT HUP INT QUIT TERM } +# Check if interface configuration exists for this protocol +okay_to_stop() { + local daemon=$1 + local proto=$(get_protocol $daemon) + local cfg=/opt/vyatta/config/active/interfaces + + case $proto in + rip|ospf) + return $(find $cfg -type d -path "*/ip/$proto" | wc -l);; + ripng|ospfv3) + return $(find $cfg -type d -path "*/ipv6/$proto" | wc -l);; + *) + return 0;; + esac +} + update() { + # get list of daemons deleted and added in current transaction local -a deleted=( `/opt/vyatta/bin/vyatta-show-protocols deleted` ) local -a added=( `/opt/vyatta/bin/vyatta-show-protocols added` ) @@ -131,7 +155,7 @@ update() { for p in ${deleted[*]} do # Need daemon to hold state of interface - if [ -z "$(find $vyatta_cfg/interfaces -type d -name $p)" ] + if okay_to_stop $p then stop $p fi done -- cgit v1.2.3 From b8ede7d7fc7c541ac8222356375dd0cc4f996409 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 2 Apr 2009 15:06:15 -0700 Subject: 0.18.13 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index eb17ae65..ab22e57f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +vyatta-cfg-quagga (0.18.13) unstable; urgency=low + + * Handle ipv6 daemons + * Don't stop daemon if OSPF/RIP still has parameters + * Don't stop daemon if OSPF/RIP still has parameters + + -- Stephen Hemminger Thu, 02 Apr 2009 15:06:15 -0700 + vyatta-cfg-quagga (0.18.12) unstable; urgency=low * Revert "Remove redundant check-as call since it doesn't work with -- cgit v1.2.3