]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Remove need for ACK for netlink messages 2589/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 29 Jun 2018 13:49:08 +0000 (09:49 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 13 Jul 2018 02:43:06 +0000 (22:43 -0400)
Kernel requests via netlink are synchronous.

Therefore we do not need to specify a need for a ACK and
we can make the netlink_cmd NONBLOCKING

1) If the netlink message is going to cause an error
we will still get one.  Since results from the kernel
are synchronous we will get the error message on the
netlink_cmd socket and handle it

2) If the netlink message is going to send more than
one packet we will still get them all.  Since the results
from the kernel are synchronous we will receive all data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/kernel_netlink.c

index 73f64de7f32bbcb2946243785cdcebcdfd0ef1e0..8703b013191f8a94edf3355a8bcaf1d300df274a 100644 (file)
@@ -829,9 +829,6 @@ int netlink_talk(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),
        n->nlmsg_seq = ++nl->seq;
        n->nlmsg_pid = nl->snl.nl_pid;
 
-       /* Request an acknowledgement by setting NLM_F_ACK */
-       n->nlmsg_flags |= NLM_F_ACK;
-
        if (IS_ZEBRA_DEBUG_KERNEL)
                zlog_debug(
                        "netlink_talk: %s type %s(%u), len=%d seq=%u flags 0x%x",
@@ -978,8 +975,12 @@ void kernel_init(struct zebra_ns *zns)
 
        /* Register kernel socket. */
        if (fcntl(zns->netlink.sock, F_SETFL, O_NONBLOCK) < 0)
-               zlog_err("Can't set %s socket flags: %s",
-                        zns->netlink.name, safe_strerror(errno));
+               zlog_err("Can't set %s socket error: %s(%d)",
+                        zns->netlink.name, safe_strerror(errno), errno);
+
+       if (fcntl(zns->netlink_cmd.sock, F_SETFL, O_NONBLOCK) < 0)
+               zlog_err("Can't set %s socket error: %s(%d)",
+                        zns->netlink_cmd.name, safe_strerror(errno), errno);
 
        /* Set receive buffer size if it's set from command line */
        if (nl_rcvbufsize)