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 <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-02-15 12:28:56 -05:00
parent 347bb8e269
commit d2bec88a36

View File

@ -807,6 +807,23 @@ int interface_lookup_netlink(struct zebra_ns *zns)
/* fixup linkages */ /* fixup linkages */
zebra_if_update_all_links(); 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. */ /* Get IPv4 address of the interfaces. */
ret = netlink_request_intf_addr(netlink_cmd, AF_INET, RTM_GETADDR, 0); 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) void interface_list(struct zebra_ns *zns)
{ {
interface_lookup_netlink(zns); interface_lookup_netlink(zns);
interface_addr_lookup_netlink(zns);
} }
#endif /* GNU_LINUX */ #endif /* GNU_LINUX */