diff --git a/vrrp_state.c b/vrrp_state.c index 267e2c2..0e22c0c 100644 --- a/vrrp_state.c +++ b/vrrp_state.c @@ -49,6 +49,9 @@ int vrrp_state_init(struct vrrp *vrrp, struct vrrp_net *vnet) { log_notice("vrid %d :: %s", vrrp->vrid, "init"); + /* Hook init */ + vrrp_exec(vrrp, vnet, INIT); + /* init Master_Adver_Interval */ vrrp->master_adv_int = vrrp->adv_int; log_debug("%d", vrrp->master_adv_int); diff --git a/vrrp_switch.sh b/vrrp_switch.sh index a1addae..b777180 100755 --- a/vrrp_switch.sh +++ b/vrrp_switch.sh @@ -28,6 +28,18 @@ case "$state" in sysctl -w net.ipv4.conf.all.rp_filter=0 sysctl -w net.ipv4.conf.all.arp_ignore=1 sysctl -w net.ipv4.conf.all.arp_announce=2 + sysctl -w net.ipv4.conf.default.rp_filter=0 + sysctl -w net.ipv4.conf.default.arp_ignore=1 + sysctl -w net.ipv4.conf.default.arp_announce=2 + + if [ -f /proc/net/if_inet6 ]; then + sysctl -w net.ipv6.conf.all.autoconf=0 + sysctl -w net.ipv6.conf.all.accept_ra=0 + sysctl -w net.ipv6.conf.all.forwarding=1 + sysctl -w net.ipv6.conf.default.autoconf=0 + sysctl -w net.ipv6.conf.default.accept_ra=0 + sysctl -w net.ipv6.conf.default.forwarding=1 + fi ;; @@ -42,12 +54,10 @@ case "$state" in for ip in $ips; do ip -$family addr add $ip dev $interface - sysctl -w net/ipv6/conf/$interface/autoconf=0 - sysctl -w net/ipv6/conf/$interface/accept_ra=0 - sysctl -w net/ipv6/conf/$interface/forwarding=1 done ip link set dev $interface up - + + IFS=$OIFS ;;