vrrp_switch.sh: Move sysctl call to init state and install hook in vrrp_state.c. Close #1948 and close #1949.
This commit is contained in:
parent
4860d50b5f
commit
080965fe0e
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue