[Openvpn-devel,v1] sitnl: use RTM_SETLINK for updating existing interfaces

Message ID 20261011202439.15128-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] sitnl: use RTM_SETLINK for updating existing interfaces |

Commit Message

Gert Doering Oct. 11, 2026, 8:24 p.m. UTC
  From: Gianmarco De Gregori <gianmarco@mandelbit.com>

RTM_NEWLINK is primarily intended for link creation and initialization,
while RTM_SETLINK is the canonical interface for modifying attributes of
an already existing link.

Even though the kernel may accept RTM_NEWLINK for updates, using
RTM_SETLINK better reflects the intended netlink semantics and follows
the dedicated update path in the kernel.

This makes the behavior more explicit and consistent with how link
configuration changes are expected to be performed.

Change-Id: I33e55d88d561393ebfbc73a995f700056e19a436
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1628
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1628
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>
  

Patch

diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index b3f8e2b..3aea076 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -671,7 +671,7 @@ 
 
     req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.i));
     req.n.nlmsg_flags = NLM_F_REQUEST;
-    req.n.nlmsg_type = RTM_NEWLINK;
+    req.n.nlmsg_type = RTM_SETLINK;
 
     req.i.ifi_family = AF_PACKET;
     req.i.ifi_index = ifindex;
@@ -707,7 +707,7 @@ 
 
     req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.i));
     req.n.nlmsg_flags = NLM_F_REQUEST;
-    req.n.nlmsg_type = RTM_NEWLINK;
+    req.n.nlmsg_type = RTM_SETLINK;
 
     req.i.ifi_family = AF_PACKET;
     req.i.ifi_index = ifindex;
@@ -738,7 +738,7 @@ 
 
     req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.i));
     req.n.nlmsg_flags = NLM_F_REQUEST;
-    req.n.nlmsg_type = RTM_NEWLINK;
+    req.n.nlmsg_type = RTM_SETLINK;
 
     req.i.ifi_family = AF_PACKET;
     req.i.ifi_index = ifindex;