board/common: nameif: Make switch port marking more robust

Let's operate on JSON data, so that we're less vulnerable to output
changes in devlink.
This commit is contained in:
Tobias Waldekranz
2023-10-10 14:54:50 +02:00
committed by Joachim Wiberg
parent c5eed505fe
commit 7d1580ca21
+3 -1
View File
@@ -30,7 +30,9 @@ for netif in /sys/class/net/*; do
done
# Find and mark all switch ports
ports=$(devlink port 2>/dev/null | awk '/flavour physical/{print $5}')
ports=$(devlink -j port | jq -r '.port[]
| select(.flavour == "physical")
| .netdev')
for iface in $ports; do
ip link set "$iface" group port
done