1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00
Ronnie Sahlberg d020b2c950 When using multiple VLANs, some funky stuff can sometimes happen when
adding/removing IP addresses causing routes might be dropped by the system.

The easiest workaround for this is to unconditionally try to reapply
all static routes for all interfaces once ipreallocation has finished,
not just adding them back on the affected interface.

This worksaround a funky issue in
CQ S1023538

(This used to be ctdb commit 84600d1f53632d5fe76c308727f31f61b5ec1010)
2011-05-12 12:06:45 +10:00

46 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# script to add entries to the routing table after we have performed a
# take ip event
# (when we do a "releaseip" event and remove an ip address from an interface
# the kernel might automatically remove associated entries from
# the routing table. This is where we add them back)
#
# Routes to add are defined in /etc/ctdb/static-routes.
# Syntax is :
# IFACE NET/MASK GATEWAY
#
# Example
# bond1 10.3.3.0/24 10.0.0.1
. $CTDB_BASE/functions
loadconfig
[ -f $CTDB_BASE/static-routes ] || {
exit 0
}
case "$1" in
recovered|ipreallocated)
cat $CTDB_BASE/static-routes | while read IFACE DEST GW; do
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
done
;;
updateip)
oiface=$2
niface=$3
cat $CTDB_BASE/static-routes | egrep "^$niface " | while read IFACE DEST GW; do
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
done
cat $CTDB_BASE/static-routes | egrep "^$oiface " | while read IFACE DEST GW; do
ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
done
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0