#!/bin/sh # # FFHO ip-up replacement script (Salt managed) # # Using a ip-up.local script intentionally PREVENTS ALL OTHER ip-up.d/ scripts # from being called. We don't want that stuff. # # # This script is run by the pppd after the link is established. # # This script is called with the following arguments: # Arg Name Example # $1 Interface name ppp0 # $2 The tty ttyS1 # $3 The link speed 38400 # $4 Local IP number 12.34.56.78 # $5 Peer IP number 12.34.56.99 # $6 Optional ``ipparam'' value foo # The environment is cleared before executing this script # so the path must be reset PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin export PATH cat << EOF > /usr/local/sbin/fix_ppp_vrf.gen #!/bin/sh while ! ip a s dev ppp0 | grep -q "inet "; do sleep 1 done ip link set ${1} master vrf_external ip link set ${1} up ip route add default via ${5} table 1023 {%- if grains['id'] == 'bbr-kt.in.ffho.net' %} # Reload backbone GRE tunnels to rebind them to VRF master device for pop in ber dus fra; do for x in a b; do ifdown gre_ffrl_\${pop}_\${x} ifup gre_ffrl_\${pop}_\${x} done done {%- endif %} {%- if grains['id'] == 'bbr-wagsh.in.ffho.net' %} # Reload OpenVPN tunnels systemctl restart openvpn.service #systemctl restart fastd@hx-sued_intergw.service {%- endif %} EOF chmod 755 /usr/local/sbin/fix_ppp_vrf.gen at -f /usr/local/sbin/fix_ppp_vrf now