From d2bec88a36effcff8d91375b325a944dad36b5e4 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Fri, 15 Feb 2019 12:28:56 -0500 Subject: [PATCH] zebra: Separate interface address lookup Separate interface lookup into its own function. We need to know interfaces for reading in nexthop information, but we need to know nexthops for reading in the interface addresses. We will read in nexthops between the two. Signed-off-by: Stephen Worley --- zebra/if_netlink.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index d42f68cbe8..b402cc4965 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -807,6 +807,23 @@ int interface_lookup_netlink(struct zebra_ns *zns) /* fixup linkages */ zebra_if_update_all_links(); + return 0; +} + +/** + * interface_addr_lookup_netlink() - Look up interface addresses + * + * @zns: Zebra netlink socket + * Return: Result status + */ +static int interface_addr_lookup_netlink(struct zebra_ns *zns) +{ + int ret; + struct zebra_dplane_info dp_info; + struct nlsock *netlink_cmd = &zns->netlink_cmd; + + /* Capture key info from ns struct */ + zebra_dplane_info_from_zns(&dp_info, zns, true /*is_cmd*/); /* Get IPv4 address of the interfaces. */ ret = netlink_request_intf_addr(netlink_cmd, AF_INET, RTM_GETADDR, 0); @@ -1460,6 +1477,7 @@ int netlink_protodown(struct interface *ifp, bool down) void interface_list(struct zebra_ns *zns) { interface_lookup_netlink(zns); + interface_addr_lookup_netlink(zns); } #endif /* GNU_LINUX */ -- 2.39.5