3 # Attempt to add a set of static routes.
5 # Do this in "ipreallocated" rather than just "startup" because some
6 # of the routes might be missing because the corresponding interface
7 # has not previously had any IPs assigned or IPs were previously
8 # released and corresponding routes were dropped.
10 # Addition of some routes might fail, errors go to /dev/null.
12 # Routes to add are defined in $CTDB_BASE/static-routes. Syntax is:
14 # IFACE NET/MASK GATEWAY
18 # bond1 10.3.3.0/24 10.0.0.1
20 [ -n "$CTDB_BASE" ] || \
21 CTDB_BASE
=$
(d
=$
(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
23 .
"${CTDB_BASE}/functions"
27 [ -f "${CTDB_BASE}/static-routes" ] ||
{
33 while read iface dest gw
; do
34 ip route add
"$dest" via
"$gw" dev
"$iface" >/dev
/null
2>&1
35 done <"${CTDB_BASE}/static-routes"
41 while read iface dest gw
; do
42 if [ "$niface" = "$iface" -o "$oiface" = "$iface" ] ; then
43 ip route add
"$dest" via
"$gw" dev
"$iface" >/dev
/null
2>&1
45 done <"${CTDB_BASE}/static-routes"