From 94f8d1a7008e324be5cd261a14cf6d87e98b36e7 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 1 Oct 2025 14:13:05 +0200 Subject: [PATCH] common: nameif: Handle nested dsa ports In setups like this... CPU eth0 | .----0----. | dst0sw0 | '-1-2-3-4-' | .----0----. | dst1sw0 | '-1-2-3-4-' ...both eth0 and dst0sw0p4 are DSA ports. But the latter is _also_ a physical port as far as devlink is concerned. As a result, it would first be marked as "internal" and is then instantly reclassified as a "port". Catch this condition and stick with the initial "internal" classification. --- board/common/rootfs/usr/libexec/infix/init.d/20-nameif | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/board/common/rootfs/usr/libexec/infix/init.d/20-nameif b/board/common/rootfs/usr/libexec/infix/init.d/20-nameif index 33039259..0356ce10 100755 --- a/board/common/rootfs/usr/libexec/infix/init.d/20-nameif +++ b/board/common/rootfs/usr/libexec/infix/init.d/20-nameif @@ -34,6 +34,12 @@ ports=$(devlink -j port | jq -r '.port[] | select(.flavour == "physical") | .netdev') for iface in $ports; do + # On systems with multiple switch trees, a port may be _both_ + # a physical port, registered with devlink, _and_ a DSA + # port. In those cases, hold on to our initial "internal" + # classification. + [ $(ip -j link show dev "$iface" | jq -r '.[0].group') = internal ] && continue + ip link set "$iface" group port done