From 302dc9c40b4cc62b93e4554eecaa859ddf493a39 Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Wed, 21 Dec 2011 11:01:00 -0800 Subject: [PATCH] bug 12704: Fix multiply public nics with redundant router status 12704: resolved fixed --- .../root/redundant_router/check_heartbeat.sh.templ | 2 +- .../config/root/redundant_router/disable_pubip.sh | 6 +++++- .../root/redundant_router/enable_pubip.sh.templ | 12 ++++++++---- .../config/root/redundant_router/master.sh.templ | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/patches/systemvm/debian/config/root/redundant_router/check_heartbeat.sh.templ b/patches/systemvm/debian/config/root/redundant_router/check_heartbeat.sh.templ index 221c669e55a..26954650a6d 100755 --- a/patches/systemvm/debian/config/root/redundant_router/check_heartbeat.sh.templ +++ b/patches/systemvm/debian/config/root/redundant_router/check_heartbeat.sh.templ @@ -11,7 +11,7 @@ then service keepalived stop >> [RROUTER_LOG] 2>&1 service conntrackd stop >> [RROUTER_LOG] 2>&1 pkill -9 keepalived >> [RROUTER_LOG] 2>&1 - ifconfig eth2 down >> [RROUTER_LOG] 2>&1 + [RROUTER_BIN_PATH]/disable_pubip.sh >> [RROUTER_LOG] 2>&1 echo Status: FAULT \(keepalived process is dead\) >> [RROUTER_LOG] exit fi diff --git a/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh b/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh index 9a9a2c6f72f..f7ab8723b55 100644 --- a/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh +++ b/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh @@ -1,4 +1,8 @@ #!/bin/bash -ifconfig eth2 down +ip link|grep BROADCAST|grep -v eth0|grep -v eth1|cut -d ":" -f 2 > /tmp/iflist +while read i +do + ifconfig $i down +done < /tmp/iflist service dnsmasq stop diff --git a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ index 1ad513ab6ac..8be4265efb9 100644 --- a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ +++ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ @@ -1,8 +1,12 @@ #!/bin/bash -ifconfig eth2 down && \ -ifconfig eth2 hw ether [ETH2MAC] && \ -ifconfig eth2 [ETH2IP] netmask [ETH2MASK] && \ -ifconfig eth2 up && \ +set -e + +ip link|grep BROADCAST|grep -v eth0|grep -v eth1|cut -d ":" -f 2 > /tmp/iflist +while read i +do + ifconfig $i down + ifconfig $i up +done < /tmp/iflist ip route add default via [GATEWAY] dev eth2 && \ service dnsmasq restart diff --git a/patches/systemvm/debian/config/root/redundant_router/master.sh.templ b/patches/systemvm/debian/config/root/redundant_router/master.sh.templ index fc8fc303c4a..d935ea85b90 100644 --- a/patches/systemvm/debian/config/root/redundant_router/master.sh.templ +++ b/patches/systemvm/debian/config/root/redundant_router/master.sh.templ @@ -17,7 +17,7 @@ echo Enable public ip returned $ret >> [RROUTER_LOG] if [ $ret -ne 0 ] then echo Fail to enable public ip! >> [RROUTER_LOG] - ifconfig eth2 down + [RROUTER_BIN_PATH]/disable_pubip.sh >> [RROUTER_LOG] 2>&1 service keepalived stop >> [RROUTER_LOG] 2>&1 service conntrackd stop >> [RROUTER_LOG] 2>&1 echo Status: FAULT \($last_msg\) >> [RROUTER_LOG]