linux/net/hsr
Fernando Fernandez Mancera c0178eec88 net: hsr: prevent creation of HSR device with slaves from another netns
HSR/PRP driver does not handle correctly having slaves/interlink devices
in a different net namespace. Currently, it is possible to create a HSR
link in a different net namespace than the slaves/interlink with the
following command:

 ip link add hsr0 netns hsr-ns type hsr slave1 eth1 slave2 eth2

As there is no use-case on supporting this scenario, enforce that HSR
device link matches netns defined by IFLA_LINK_NETNSID.

The iproute2 command mentioned above will throw the following error:

 Error: hsr: HSR slaves/interlink must be on the same net namespace than HSR link.

Fixes: f421436a59 ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20251020135533.9373-1-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-10-22 19:22:22 -07:00
..
Kconfig net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00
Makefile net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00
hsr_debugfs.c saner replacement for debugfs_rename() 2025-01-15 13:14:37 +01:00
hsr_device.c hsr: hold rcu and dev lock for hsr_get_port_ndev 2025-09-11 11:49:19 +02:00
hsr_device.h net: hsr: Provide RedBox support (HSR-SAN) 2024-04-26 12:04:43 +02:00
hsr_forward.c net: hsr: Fix PRP duplicate detection 2025-03-13 10:04:22 +01:00
hsr_forward.h
hsr_framereg.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
hsr_framereg.h net: hsr: Fix PRP duplicate detection 2025-03-13 10:04:22 +01:00
hsr_main.c hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr 2025-09-11 11:49:19 +02:00
hsr_main.h hsr: use rtnl lock when iterating over ports 2025-09-11 11:49:19 +02:00
hsr_netlink.c net: hsr: prevent creation of HSR device with slaves from another netns 2025-10-22 19:22:22 -07:00
hsr_netlink.h net/hsr: Remove unused function declarations 2023-07-31 20:11:47 -07:00
hsr_slave.c hsr: use netdev_master_upper_dev_link() when linking lower ports 2025-09-09 11:27:37 +02:00
hsr_slave.h
prp_dup_discard_test.c net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00