]> git.proxmox.com Git - mirror_frr.git/commitdiff
Zebra: Ignore the failure of startup intf lookup.
authorYuan Yuan <yyuanam@amazon.com>
Wed, 22 Sep 2021 20:02:40 +0000 (20:02 +0000)
committerYuan Yuan <yyuanam@amazon.com>
Wed, 6 Oct 2021 02:00:39 +0000 (02:00 +0000)
In startup, zebra would dump interface information from Kernel in 3
steps w/o lock: step1, get interface information; step2, get interface
ipv4 address; step3, get interface ipv6 address.
If any interface gets added after step1, but before step2/3, zebra
would get extra interface addresses in step2/3 that has not been added
into zebra in step1. Returning error in the referenced interface lookup
would cause the startup interface retrieval to be incomplete.

Signed-off-by: Yuan Yuan <yyuanam@amazon.com>
zebra/if_netlink.c

index acd6697b65148664b7ac586819317964391a5c1c..8e52ef4047e54f000f0c5da6381a2a80df6a51ec 100644 (file)
@@ -1302,11 +1302,22 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
 
        ifp = if_lookup_by_index_per_ns(zns, ifa->ifa_index);
        if (ifp == NULL) {
-               flog_err(
-                       EC_LIB_INTERFACE,
-                       "netlink_interface_addr can't find interface by index %d",
-                       ifa->ifa_index);
-               return -1;
+               if (startup) {
+                       /* During startup, failure to lookup the referenced
+                        * interface should not be an error, so we have
+                        * downgraded this condition to warning, and we permit
+                        * the startup interface state retrieval to continue.
+                        */
+                       flog_warn(EC_LIB_INTERFACE,
+                                 "%s: can't find interface by index %d",
+                                 __func__, ifa->ifa_index);
+                       return 0;
+               } else {
+                       flog_err(EC_LIB_INTERFACE,
+                                "%s: can't find interface by index %d",
+                                __func__, ifa->ifa_index);
+                       return -1;
+               }
        }
 
        /* Flags passed through */