#!/bin/sh
# Re-assert the provider VLAN on the uplink when a port appears or comes up.
# Numbered before 51-trutz-ensure-bridge on purpose: the bridge step has to see
# the finished picture, otherwise it would treat the untagged parent as a free
# LAN port and swallow the uplink.
IFACE="$1"
ACTION="$2"
case "$ACTION" in
    up|connectivity-change|reapply) : ;;
    *) exit 0 ;;
esac
case "$IFACE" in
    lo|br0|wl*|p2p-dev*|tun*|veth*|docker*|virbr*|"") exit 0 ;;
esac
[ -x /usr/share/trutz-network/ensure-wan-vlan.sh ] || exit 0
# Detached: a dispatcher script must not block, and bringing a profile up can
# take a moment.
setsid /usr/share/trutz-network/ensure-wan-vlan.sh >/dev/null 2>&1 &
exit 0
