2023-12-06 12:39:23 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
vtunduciport=$(uci get vtun.@options[0].port 2>/dev/null)
|
|
|
|
vtundport=${vtunduciport:-5525}
|
2024-01-07 17:17:52 -07:00
|
|
|
issupernode=$(uci get aredn.@supernode[0].enable 2>/dev/null)
|
|
|
|
if [ "$issupernode" = "1" ]; then
|
|
|
|
vtundport=$(($vtundport+1000))
|
|
|
|
fi
|
|
|
|
vtundportend=$(($vtundport+128))
|
2023-12-06 12:39:23 -07:00
|
|
|
|
2024-01-07 17:17:52 -07:00
|
|
|
nft insert rule ip fw4 input_wan udp dport $vtundport-$vtundportend accept comment \"Wireguard\"
|
2023-12-06 12:39:23 -07:00
|
|
|
if [ "$(/sbin/uci -q get aredn.@tunnel[0].wanonly)" != "0" ]; then
|
2024-01-07 17:17:52 -07:00
|
|
|
nft insert rule ip fw4 output_wifi udp dport $vtundport-$vtundportend reject comment \"Wireguard\"
|
|
|
|
nft insert rule ip fw4 output_dtdlink udp dport $vtundport-$vtundportend reject comment \"Wireguard\"
|
2023-12-06 12:39:23 -07:00
|
|
|
fi
|