1 setup_ctdb_policy_routing ()
3 service_name="per_ip_routing"
5 export CTDB_PER_IP_ROUTING_CONF="$CTDB_BASE/policy_routing"
6 export CTDB_PER_IP_ROUTING_RULE_PREF=100
7 export CTDB_PER_IP_ROUTING_TABLE_ID_LOW=1000
8 export CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=2000
10 # Tests need to create and populate this file
11 rm -f "$CTDB_PER_IP_ROUTING_CONF"
14 # Create policy routing configuration in $CTDB_PER_IP_ROUTING_CONF.
15 # $1 is the number of assigned IPs to use (<num>, all), defaulting to
16 # 1. If $2 is "default" then a default route is also added.
17 create_policy_routing_config ()
20 _should_add_default="$2"
22 ctdb_get_my_public_addresses |
23 if [ "$_num_ips" = "all" ] ; then
26 { head -n "$_num_ips" ; cat >/dev/null ; }
28 while read _dev _ip _bits ; do
29 _net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
30 _gw="${_net%.*}.254" # a dumb, calculated default
34 if [ "$_should_add_default" = "default" ] ; then
35 echo "$_ip 0.0.0.0/0 $_gw"
37 done >"$CTDB_PER_IP_ROUTING_CONF"