From: William A. Kennington III Date: Tue, 27 Apr 2021 08:25:58 +0000 (-0700) Subject: network: neighbor: Always add neighbors with replace X-Git-Tag: v249-rc1~337 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=192a9d95ea3e058afd824d38a9cea16ad0a84a57;p=thirdparty%2Fsystemd.git network: neighbor: Always add neighbors with replace We were duplicating setting flags for the message and a combination of NLM_F_APPEND and NLM_F_CREATE which does not make sense. We should have been using NLM_F_REPLACE and NLM_F_CREATE since the kernel can dynamically create neighbors prior to us adding an entry. Otherwise, we can end up with cases where the message will time out after ~25s even though the neighbor still gets added. This delays the rest of the setup of the interface even though the error is ultimately ignored. --- diff --git a/src/libsystemd/sd-netlink/rtnl-message.c b/src/libsystemd/sd-netlink/rtnl-message.c index d14fa1a5cb7..ead19672587 100644 --- a/src/libsystemd/sd-netlink/rtnl-message.c +++ b/src/libsystemd/sd-netlink/rtnl-message.c @@ -447,7 +447,7 @@ int sd_rtnl_message_new_neigh(sd_netlink *rtnl, sd_netlink_message **ret, uint16 return r; if (nlmsg_type == RTM_NEWNEIGH) - (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_APPEND; + (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_REPLACE; ndm = NLMSG_DATA((*ret)->hdr); diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c index f54a2f9c99f..ef09665a854 100644 --- a/src/network/networkd-neighbor.c +++ b/src/network/networkd-neighbor.c @@ -258,10 +258,6 @@ static int neighbor_configure(Neighbor *neighbor, Link *link) { if (r < 0) return log_link_error_errno(link, r, "Could not set state: %m"); - r = sd_netlink_message_set_flags(req, NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_REPLACE); - if (r < 0) - return log_link_error_errno(link, r, "Could not set flags: %m"); - r = sd_netlink_message_append_data(req, NDA_LLADDR, &neighbor->lladdr, neighbor->lladdr_size); if (r < 0) return log_link_error_errno(link, r, "Could not append NDA_LLADDR attribute: %m");