$IPT4 -A mwan3_ifaces_in -m mark --mark 0x0/$MMX_MASK -j mwan3_iface_in_$1
$IPT4 -F mwan3_iface_out_$1
$IPT4 -A mwan3_iface_out_$1 -s $src_ip -m mark --mark 0x0/$MMX_MASK -m comment --comment "$1" -j MARK --set-xmark $(mwan3_id2mask id MMX_MASK)/$MMX_MASK
$IPT4 -A mwan3_iface_out_$1 -o $2 -m mark --mark 0x0/$MMX_MASK -m comment --comment "$1" -j MARK --set-xmark $(mwan3_id2mask id MMX_MASK)/$MMX_MASK
$IPT4 -D mwan3_ifaces_out -m mark --mark 0x0/$MMX_MASK -j mwan3_iface_out_$1&> /dev/null
$IPT4 -A mwan3_ifaces_out -m mark --mark 0x0/$MMX_MASK -j mwan3_iface_out_$1
fi
if["$family"=="ipv6"];then
ubus call network.interface.${1}_6 status &>/dev/null
if["$?" -eq "0"];then
network_get_ipaddr6 src_ipv6 ${1}_6
else
network_get_ipaddr6 src_ipv6 $1
fi
$IPS -! create mwan3_connected_v6 hash:net family inet6
if ! $IPT6 -S mwan3_ifaces_in &> /dev/null;then
@ -278,7 +262,7 @@ mwan3_create_iface_iptables()
$IPT6 -A mwan3_ifaces_in -m mark --mark 0x0/$MMX_MASK -j mwan3_iface_in_$1
$IPT6 -F mwan3_iface_out_$1
$IPT6 -A mwan3_iface_out_$1 -s $src_ipv6 -m mark --mark 0x0/$MMX_MASK -m comment --comment "$1" -j MARK --set-xmark $(mwan3_id2mask id MMX_MASK)/$MMX_MASK
$IPT6 -A mwan3_iface_out_$1 -o $2 -m mark --mark 0x0/$MMX_MASK -m comment --comment "$1" -j MARK --set-xmark $(mwan3_id2mask id MMX_MASK)/$MMX_MASK
$IPT6 -D mwan3_ifaces_out -m mark --mark 0x0/$MMX_MASK -j mwan3_iface_out_$1&> /dev/null
$IPT6 -A mwan3_ifaces_out -m mark --mark 0x0/$MMX_MASK -j mwan3_iface_out_$1
@ -322,32 +306,37 @@ mwan3_create_iface_route()
[ -n "$id"]||return0
if["$family"=="ipv4"];then
ubus call network.interface.${1}_4 status &>/dev/null
if["$?" -eq "0"];then
if ubus call network.interface.${1}_4 status &>/dev/null;then
network_get_gateway route_args ${1}_4
else
network_get_gateway route_args $1
fi
route_args="via $route_args dev $2"
if[ -n "$route_args" -a "$route_args" !="0.0.0.0"];then
route_args="via $route_args"
else
route_args=""
fi
$IP4 route flush table $id
$IP4 route add table $id default $route_args
$IP4 route add table $id default $route_args dev $2
fi
if["$family"=="ipv6"];then
ubus call network.interface.${1}_6 status &>/dev/null
if["$?" -eq "0"];then
if ubus call network.interface.${1}_6 status &>/dev/null;then
network_get_gateway6 route_args ${1}_6
else
network_get_gateway6 route_args $1
fi
route_args="via $route_args dev $2"
if[ -n "$route_args" -a "$route_args" !="::"];then
route_args="via $route_args"
else
route_args=""
fi
$IP6 route flush table $id
$IP6 route add table $id default $route_args
$IP6 route add table $id default $route_args dev $2