Small changes in if* scripts
authorDimitris Aragiorgis <dimara@grnet.gr>
Fri, 31 Jan 2014 02:37:36 +0000 (04:37 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Wed, 5 Mar 2014 16:28:09 +0000 (18:28 +0200)
* Factor out GARP and neighbor proxy action from setup_routed*
* Invoke send_garp in kvm-ifup
* Invoke delete_neighbor_proxy in snf-network-hook

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

common.sh
kvm-vif-bridge
snf-network-hook
vif-custom

index a3b03d8..291baa5 100755 (executable)
--- a/common.sh
+++ b/common.sh
@@ -2,7 +2,7 @@
 
 function try {
 
-  $1 &>/dev/null || true 
+  $1 &>/dev/null || true
 
 }
 
@@ -20,6 +20,14 @@ function clear_routed_setup_ipv6 {
 
 }
 
+function delete_neighbor_proxy {
+
+  get_uplink $LINK "-6"
+  get_eui64 $MAC $SUBNET6
+  $SNF_NETWORK_LOG $0 "ip -6 neigh del proxy $EUI64 dev $UPLINK"
+  ip -6 neigh del proxy $EUI64 dev $UPLINK
+
+}
 
 function clear_routed_setup_firewall {
 
@@ -68,6 +76,10 @@ function routed_setup_ipv4 {
        # Enable proxy ARP
        echo 1 > /proc/sys/net/ipv4/conf/$INTERFACE/proxy_arp
 
+}
+
+function send_garp {
+
   # Send GARP from host to upstream router
   get_uplink $TABLE
   echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind
index 24266ae..d595256 100755 (executable)
@@ -36,6 +36,7 @@ for tag in $NETWORK_TAGS; do
     try routed_setup_ipv4
     try routed_setup_ipv6
     try routed_setup_firewall
+    try send_garp
   ;;
   $NFDHCPD_TAG)
     # Drop unicast BOOTP/DHCP packets
index a49408f..0cdb5da 100755 (executable)
@@ -29,10 +29,7 @@ for idx in $(seq $FIRST $LAST); do
     $IP_LESS_ROUTED_TAG)
       if [ "$GANETI_OLD_PRIMARY" == "$host.$domain" ]; then
         # This runs on the source node
-        get_uplink $LINK "-6"
-        get_eui64 $MAC $SUBNET6
-        $SNF_NETWORK_LOG $0 "ip -6 neigh del proxy $EUI64 dev $UPLINK"
-        ip -6 neigh del proxy $EUI64 dev $UPLINK >/dev/null 2>&1
+        delete_neighbor_proxy
       elif [ "$GANETI_NEW_PRIMARY" == "$host.$domain" ]; then
         $SNF_NETWORK_LOG $0 "Do nothing in new primary. All done by if-up script"
       fi
index 6f9be4f..4e9fd73 100755 (executable)
@@ -53,6 +53,7 @@ for tag in $NETWORK_TAGS; do
     try routed_setup_ipv4
     try routed_setup_ipv6
     try routed_setup_firewall
+    try send_garp
   ;;
   $NFDHCPD_TAG)
     # Drop unicast BOOTP/DHCP packets