[PATCH 1/4] Netlink: Enable strict checking on nl_req

Asbjørn Sloth Tønnesen ast at 2e8.dk
Tue Feb 10 18:10:42 CET 2026


Enable strict checking of netlink messages on the nl_req connection,
so it is enabled on both connections.

Also rename the function to remove "_dump" suffix, as it's a generic
option.

Strict checking was originally called NETLINK_DUMP_STRICT_CHK,
but was renamed to NETLINK_GET_STRICT_CHK, as it should apply to
all calls, not only dumps (Linux commmit d3e8869ec826).

When set on nl_req, we don't need to check the return code, as it will
fail on nl_scan as well, and so one log message should be enough and
unlike nl_scan, we don't need to alter the mode of operation.

Signed-off-by: Asbjørn Sloth Tønnesen <ast at 2e8.dk>
---
 sysdep/linux/netlink.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 8be5112c4..4268244a0 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -83,7 +83,7 @@ nl_open_sock(struct nl_sock *nl)
 }
 
 static int
-nl_set_strict_dump(struct nl_sock *nl UNUSED, int strict UNUSED)
+nl_set_strict_chk(struct nl_sock *nl UNUSED, int strict UNUSED)
 {
 #ifdef SOL_NETLINK
   return setsockopt(nl->fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK, &strict, sizeof(strict));
@@ -122,7 +122,8 @@ nl_open(void)
   nl_open_sock(&nl_scan);
   nl_open_sock(&nl_req);
 
-  if (nl_set_strict_dump(&nl_scan, 1) < 0)
+  nl_set_strict_chk(&nl_req, 1);
+  if (nl_set_strict_chk(&nl_scan, 1) < 0)
   {
     log(L_WARN "KRT: Netlink strict checking failed, will scan all tables at once");
     krt_use_shared_scan();
-- 
2.51.0



More information about the Bird-users mailing list