summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-08-03 10:54:30 +1000
committerMartin Schwenke <martin@meltin.net>2012-10-11 12:10:45 +1100
commit74843dadada9995efc5f5f3c8458ec58bcf6bc05 (patch)
tree745f9923c187d9e71b4a91b43b56720b306ac314
parent4719df62d6b11a84f3ba7a72748d70ac925f49bd (diff)
downloadsamba-74843dadada9995efc5f5f3c8458ec58bcf6bc05.tar.gz
samba-74843dadada9995efc5f5f3c8458ec58bcf6bc05.tar.xz
samba-74843dadada9995efc5f5f3c8458ec58bcf6bc05.zip
Eventscripts: Add support for "reconfigure" pseudo-event for policy routing
This rebuilds all policy routes and can be used if the configuration changes. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit c185ffd2822fcee26d07398464c59b66c61f53fa)
-rwxr-xr-xctdb/config/events.d/13.per_ip_routing19
1 files changed, 17 insertions, 2 deletions
diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing
index 06b21b95ec..d51d309dd8 100755
--- a/ctdb/config/events.d/13.per_ip_routing
+++ b/ctdb/config/events.d/13.per_ip_routing
@@ -276,7 +276,8 @@ flush_rules_and_routes ()
# Add any missing routes. Some might have gone missing if, for
# example, all IPs on the network were removed (possibly if the
-# primary was removed).
+# primary was removed). If $1 is "force" then (re-)add all the
+# routes.
add_missing_routes ()
{
ctdb ip -v -Y | {
@@ -292,7 +293,8 @@ add_missing_routes ()
[ -n "$_iface" ] || continue
_table_id="${table_id_prefix}${_ip}"
- if [ -z "$(ip route show table $_table_id 2>/dev/null)" ] ; then
+ if [ -z "$(ip route show table $_table_id 2>/dev/null)" -o \
+ "$1" = "force" ] ; then
add_routing_for_ip "$_iface" "$_ip"
fi
done
@@ -326,8 +328,21 @@ remove_bogus_routes ()
######################################################################
+service_reconfigure ()
+{
+ add_missing_routes "force"
+ remove_bogus_routes
+
+ # flush our route cache
+ set_proc sys/net/ipv4/route/flush 1
+}
+
+######################################################################
+
ctdb_check_args "$@"
+ctdb_service_check_reconfigure
+
case "$1" in
startup)
flush_rules_and_routes