2024/APs/etc/hotplug.d/iface/20-firewall

19 lines
515 B
Plaintext
Raw Normal View History

2024-11-11 17:35:27 +02:00
#!/bin/sh
has_zone() {
fw4 -q network "$INTERFACE" >/dev/null && return 0
eval $(ubus call "network.interface.$INTERFACE" status | jsonfilter -e 'ZONE=@.data.zone')
fw4 -q zone "$ZONE" >/dev/null
}
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
[ "$ACTION" = ifupdate -a -z "$IFUPDATE_ADDRESSES" -a -z "$IFUPDATE_DATA" ] && exit 0
/etc/init.d/firewall enabled || exit 0
has_zone || exit 0
logger -t firewall "Reloading firewall due to $ACTION of $INTERFACE ($DEVICE)"
fw4 -q reload
/etc/fw_mod.sh &