diff options
author | Russ White <russ@riw.us> | 2018-09-24 16:54:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-24 16:54:16 +0200 |
commit | a1b32de24ed520a53499f6e81d6ee8eaac548bd1 (patch) | |
tree | 5ce26f8b92502977830006b7d8e99fba93cd7970 /zebra/if_netlink.c | |
parent | Merge pull request #3064 from NaveenThanikachalam/3049 (diff) | |
parent | zebra: fix debug dplane cli (diff) | |
download | frr-a1b32de24ed520a53499f6e81d6ee8eaac548bd1.tar.xz frr-a1b32de24ed520a53499f6e81d6ee8eaac548bd1.zip |
Merge pull request #3052 from donaldsharp/dplane_2
Dplane 2
Diffstat (limited to 'zebra/if_netlink.c')
-rw-r--r-- | zebra/if_netlink.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index bf5d83427..e7ddf68c1 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -705,8 +705,8 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup) } /* Request for specific interface or address information from the kernel */ -static int netlink_request_intf_addr(struct zebra_ns *zns, int family, int type, - uint32_t filter_mask) +static int netlink_request_intf_addr(struct nlsock *netlink_cmd, int family, + int type, uint32_t filter_mask) { struct { struct nlmsghdr n; @@ -724,39 +724,44 @@ static int netlink_request_intf_addr(struct zebra_ns *zns, int family, int type, if (filter_mask) addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filter_mask); - return netlink_request(&zns->netlink_cmd, &req.n); + return netlink_request(netlink_cmd, &req.n); } /* Interface lookup by netlink socket. */ int interface_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 interface information. */ - ret = netlink_request_intf_addr(zns, AF_PACKET, RTM_GETLINK, 0); + ret = netlink_request_intf_addr(netlink_cmd, AF_PACKET, RTM_GETLINK, 0); if (ret < 0) return ret; - ret = netlink_parse_info(netlink_interface, &zns->netlink_cmd, zns, 0, + ret = netlink_parse_info(netlink_interface, netlink_cmd, &dp_info, 0, 1); if (ret < 0) return ret; /* Get interface information - for bridge interfaces. */ - ret = netlink_request_intf_addr(zns, AF_BRIDGE, RTM_GETLINK, + ret = netlink_request_intf_addr(netlink_cmd, AF_BRIDGE, RTM_GETLINK, RTEXT_FILTER_BRVLAN); if (ret < 0) return ret; - ret = netlink_parse_info(netlink_interface, &zns->netlink_cmd, zns, 0, + ret = netlink_parse_info(netlink_interface, netlink_cmd, &dp_info, 0, 0); if (ret < 0) return ret; /* Get interface information - for bridge interfaces. */ - ret = netlink_request_intf_addr(zns, AF_BRIDGE, RTM_GETLINK, + ret = netlink_request_intf_addr(netlink_cmd, AF_BRIDGE, RTM_GETLINK, RTEXT_FILTER_BRVLAN); if (ret < 0) return ret; - ret = netlink_parse_info(netlink_interface, &zns->netlink_cmd, zns, 0, + ret = netlink_parse_info(netlink_interface, netlink_cmd, &dp_info, 0, 0); if (ret < 0) return ret; @@ -765,19 +770,19 @@ int interface_lookup_netlink(struct zebra_ns *zns) zebra_if_update_all_links(); /* Get IPv4 address of the interfaces. */ - ret = netlink_request_intf_addr(zns, AF_INET, RTM_GETADDR, 0); + ret = netlink_request_intf_addr(netlink_cmd, AF_INET, RTM_GETADDR, 0); if (ret < 0) return ret; - ret = netlink_parse_info(netlink_interface_addr, &zns->netlink_cmd, zns, + ret = netlink_parse_info(netlink_interface_addr, netlink_cmd, &dp_info, 0, 1); if (ret < 0) return ret; /* Get IPv6 address of the interfaces. */ - ret = netlink_request_intf_addr(zns, AF_INET6, RTM_GETADDR, 0); + ret = netlink_request_intf_addr(netlink_cmd, AF_INET6, RTM_GETADDR, 0); if (ret < 0) return ret; - ret = netlink_parse_info(netlink_interface_addr, &zns->netlink_cmd, zns, + ret = netlink_parse_info(netlink_interface_addr, netlink_cmd, &dp_info, 0, 1); if (ret < 0) return ret; |