diff options
| author | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2018-09-12 11:33:51 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-18 10:41:53 -0400 |
| commit | 520ebf72b27c2462ce8b0dc5a1d4cb83956df69c (patch) | |
| tree | aceba5b51cb3f7510efe328817eb419237bd7244 /zebra/if_netlink.c | |
| parent | 66e3798747385bbcd6cfbd647e1945718c565dd3 (diff) | |
zebra: resolve link dependencies post nldump
Netdevices are not sorted in any fashion by the kernel during the initial
interface nldump. So you can get an upper device (such as an SVI) before
its corresponding lower device (bridge).
To fix this problem we skip resolving link dependencies during handling of
nldump notifications. Resolving instead at the end (when all the devices
are present)
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Ticket: CM-22388, CM-21796
Reviewed By: CCR-7845
Testing Done:
1. verified on a setup with missing linkages
2. automation - evpn-min
Diffstat (limited to 'zebra/if_netlink.c')
| -rw-r--r-- | zebra/if_netlink.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 47a101e619..6c71fddbbf 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -585,6 +585,7 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup) zebra_slave_iftype_t zif_slave_type = ZEBRA_IF_SLAVE_NONE; ifindex_t bridge_ifindex = IFINDEX_INTERNAL; ifindex_t link_ifindex = IFINDEX_INTERNAL; + struct zebra_if *zif; zns = zebra_ns_lookup(ns_id); ifi = NLMSG_DATA(h); @@ -679,8 +680,12 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup) if (IS_ZEBRA_IF_VRF(ifp)) SET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK); - /* Update link. */ - zebra_if_update_link(ifp, link_ifindex, ns_id); + /* Just set the @link/lower-device ifindex. During nldump interfaces are + * not ordered in any fashion so we may end up getting upper devices + * before lower devices. We will setup the real linkage once the dump + * is complete. */ + zif = (struct zebra_if *)ifp->info; + zif->link_ifindex = link_ifindex; /* Hardware type and address. */ ifp->ll_type = netlink_to_zebra_link_type(ifi->ifi_type); @@ -754,6 +759,9 @@ int interface_lookup_netlink(struct zebra_ns *zns) if (ret < 0) return ret; + /* fixup linkages */ + zebra_if_update_all_links(); + /* Get IPv4 address of the interfaces. */ ret = netlink_request_intf_addr(zns, AF_INET, RTM_GETADDR, 0); if (ret < 0) |
