You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.1 KiB

#!/bin/sh
[ "$ACTION" == "ifup" -o "$ACTION" == "ifdown" ] || exit 1
[ -n "$INTERFACE" ] || exit 2
if [ "$ACTION" == "ifup" ]; then
[ -n "$DEVICE" ] || exit 3
fi
[ -x /usr/bin/ip ] || exit 4
[ -x /usr/sbin/ipset ] || exit 5
[ -x /usr/sbin/iptables ] || exit 6
[ -x /usr/sbin/ip6tables ] || exit 7
[ -x /usr/bin/logger ] || exit 8
. /lib/functions.sh
. /lib/functions/network.sh
. /lib/mwan3/mwan3.sh
config_load mwan3
config_get enabled $INTERFACE enabled 0
[ "$enabled" == "1" ] || exit 0
$LOG notice "$ACTION interface $INTERFACE (${DEVICE:-unknown})"
mwan3_set_connected_iptables
case "$ACTION" in
ifup)
mwan3_set_general_rules
mwan3_set_general_iptables
mwan3_create_iface_rules $INTERFACE $DEVICE
mwan3_create_iface_iptables $INTERFACE $DEVICE
mwan3_create_iface_route $INTERFACE $DEVICE
mwan3_track $INTERFACE $DEVICE
mwan3_set_user_rules
;;
ifdown)
mwan3_delete_iface_rules $INTERFACE
mwan3_delete_iface_iptables $INTERFACE
mwan3_delete_iface_route $INTERFACE
mwan3_delete_iface_ipset_entries $INTERFACE
;;
esac
config_foreach mwan3_create_policies_iptables policy
exit 0