zebra: Remove need for ACK for netlink messages

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>
This commit is contained in:
Donald Sharp 2018-06-29 09:49:08 -04:00
parent 19d5a4fead
commit 8c85e8ea92

View 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)