]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Netlink: Enable strict checking on nl_req
authorAsbjørn Sloth Tønnesen <ast@2e8.dk>
Thu, 21 May 2026 12:38:26 +0000 (14:38 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Wed, 27 May 2026 04:26:58 +0000 (06:26 +0200)
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.

sysdep/linux/netlink.c

index 00b21fc97f307bda66a70b6ec1a20a340efe1429..9c519adb629556e3df569686ae0c0f1d5ef705ae 100644 (file)
@@ -86,7 +86,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));
@@ -125,7 +125,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();