request for guidance on implementing VLAN reapplication in NetworkManager
Oleksij Rempel
o.rempel at pengutronix.de
Thu Jun 6 11:41:20 UTC 2024
Hello devs,
My name is Oleksij Rempel, and I am a Linux kernel developer primarily
focused on network switch drivers. I have been evaluating various
options for managing switch and bridge configurations, and
NetworkManager appears to be the best fit for our requirements. However,
there is still some work to be done. One of the missing features is the
ability to reapply certain settings without interrupting the data flow.
For instance, the ability to reapply `bridge-port.vlans` for slave ports
is currently lacking.
As I am new to the NetworkManager code base and its architecture, I
would like to ensure that I am on the right path. To better illustrate
my use case, here is a script that demonstrates the desired
functionality:
```bash
# Create veth pairs
nmcli connection add type veth con-name veth0 ifname veth0 veth.peer veth1
nmcli connection modify veth0 ipv4.method disabled ipv6.method ignore
nmcli connection add type veth con-name veth2 ifname veth2 veth.peer veth3
nmcli connection modify veth2 ipv4.method disabled ipv6.method ignore
# Create the bridge
nmcli connection add type bridge con-name br0 ifname br0
nmcli connection modify br0 bridge.vlan-filtering yes
nmcli connection modify br0 ipv4.method disabled ipv6.method ignore
# Add veth ends to the bridge
nmcli connection add type bridge-slave con-name veth1-slave ifname veth1 master br0
nmcli connection add type bridge-slave con-name veth3-slave ifname veth3 master br0
# Configure VLANs on the bridge ports
nmcli connection modify veth1-slave bridge-port.vlans "1002 untagged"
nmcli connection modify veth3-slave bridge-port.vlans "1002 untagged"
# Bring up the bridge and bridge-slave interfaces
nmcli connection up br0
nmcli connection up veth1-slave
nmcli connection up veth3-slave
# Reapply VLAN settings on veth1-slave and check if changes are
# reflected
bridge v
nmcli connection modify veth1-slave bridge-port.vlans "1002,1003 untagged"
nmcli dev reapply veth1
bridge v
```
If I understand the NetworkManager code correctly, the bridge master is
handled by `nm-device-bridge.c`, while the slave interfaces are handled
by `nm-device.c`. At this point, I am not entirely sure whether it is a
good idea to reapply settings only on the slave interface separately, or
if I need to do this from the master down to the slave interfaces.
Should I introduce a function to iterate and reapply all slaves on the
master/controller side? Or should I not worry too much and handle
differences only on the slave side if possible?
I would greatly appreciate any guidance or recommendations on the best
approach to achieve this functionality.
Thank you for your time and assistance.
Best regards,
Oleksij Rempel
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the Networkmanager
mailing list