summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 48ccf91ec7..488bca06da 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1171,7 +1171,7 @@ int netlink_route_read(struct zebra_ns *zns)
if (ret < 0)
return ret;
ret = netlink_parse_info(netlink_route_change_read_unicast,
- &zns->netlink_cmd, &dp_info, 0, 1);
+ &zns->netlink_cmd, &dp_info, 0, true);
if (ret < 0)
return ret;
@@ -1180,7 +1180,7 @@ int netlink_route_read(struct zebra_ns *zns)
if (ret < 0)
return ret;
ret = netlink_parse_info(netlink_route_change_read_unicast,
- &zns->netlink_cmd, &dp_info, 0, 1);
+ &zns->netlink_cmd, &dp_info, 0, true);
if (ret < 0)
return ret;
@@ -1731,12 +1731,11 @@ static bool _netlink_route_build_multipath(const struct prefix *p,
return true;
}
-static inline bool _netlink_mpls_build_singlepath(const struct prefix *p,
- const char *routedesc,
- const zebra_nhlfe_t *nhlfe,
- struct nlmsghdr *nlmsg,
- struct rtmsg *rtmsg,
- size_t req_size, int cmd)
+static inline bool
+_netlink_mpls_build_singlepath(const struct prefix *p, const char *routedesc,
+ const struct zebra_nhlfe *nhlfe,
+ struct nlmsghdr *nlmsg, struct rtmsg *rtmsg,
+ size_t req_size, int cmd)
{
int bytelen;
uint8_t family;
@@ -1751,7 +1750,7 @@ static inline bool _netlink_mpls_build_singlepath(const struct prefix *p,
static inline bool
_netlink_mpls_build_multipath(const struct prefix *p, const char *routedesc,
- const zebra_nhlfe_t *nhlfe,
+ const struct zebra_nhlfe *nhlfe,
struct nlmsghdr *nlmsg, size_t req_size,
struct rtmsg *rtmsg, const union g_addr **src)
{
@@ -1811,7 +1810,7 @@ static int netlink_neigh_update(int cmd, int ifindex, void *addr, char *lla,
nl_attr_put(&req.n, sizeof(req), NDA_LLADDR, lla, llalen);
return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
- 0);
+ false);
}
static bool nexthop_set_src(const struct nexthop *nexthop, int family,
@@ -2269,7 +2268,7 @@ int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *in)
nl_attr_put32(&req.n, sizeof(req), RTA_TABLE, actual_table);
suc = netlink_talk(netlink_route_change_read_multicast, &req.n,
- &zns->netlink_cmd, zns, 0);
+ &zns->netlink_cmd, zns, false);
mroute = NULL;
return suc;
@@ -3020,7 +3019,7 @@ int netlink_nexthop_read(struct zebra_ns *zns)
if (ret < 0)
return ret;
ret = netlink_parse_info(netlink_nexthop_change, &zns->netlink_cmd,
- &dp_info, 0, 1);
+ &dp_info, 0, true);
if (!ret)
/* If we succesfully read in nexthop objects,
@@ -3428,7 +3427,7 @@ int netlink_macfdb_read(struct zebra_ns *zns)
/* We are reading entire table. */
filter_vlan = 0;
ret = netlink_parse_info(netlink_macfdb_table, &zns->netlink_cmd,
- &dp_info, 0, 1);
+ &dp_info, 0, true);
return ret;
}
@@ -3462,7 +3461,7 @@ int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp,
if (ret < 0)
return ret;
ret = netlink_parse_info(netlink_macfdb_table, &zns->netlink_cmd,
- &dp_info, 0, 0);
+ &dp_info, 0, false);
/* Reset VLAN filter. */
filter_vlan = 0;
@@ -3527,7 +3526,7 @@ int netlink_macfdb_read_specific_mac(struct zebra_ns *zns,
return ret;
ret = netlink_parse_info(netlink_macfdb_table, &zns->netlink_cmd,
- &dp_info, 1, 0);
+ &dp_info, 1, false);
return ret;
}
@@ -3658,6 +3657,15 @@ static void netlink_handle_5549(struct ndmsg *ndm, struct zebra_if *zif,
#define NUD_LOCAL_ACTIVE \
(NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE)
+static int netlink_nbr_entry_state_to_zclient(int nbr_state)
+{
+ /* an exact match is done between
+ * - netlink neighbor state values: NDM_XXX (see in linux/neighbour.h)
+ * - zclient neighbor state values: ZEBRA_NEIGH_STATE_XXX
+ * (see in lib/zclient.h)
+ */
+ return nbr_state;
+}
static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
{
struct ndmsg *ndm;
@@ -3747,8 +3755,10 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
&mac, l2_len);
} else
sockunion_family(&link_layer_ipv4) = AF_UNSPEC;
- zsend_nhrp_neighbor_notify(cmd, ifp, &ip, ndm->ndm_state,
- &link_layer_ipv4);
+ zsend_nhrp_neighbor_notify(
+ cmd, ifp, &ip,
+ netlink_nbr_entry_state_to_zclient(ndm->ndm_state),
+ &link_layer_ipv4);
}
if (h->nlmsg_type == RTM_GETNEIGH)
@@ -3920,7 +3930,7 @@ int netlink_neigh_read(struct zebra_ns *zns)
if (ret < 0)
return ret;
ret = netlink_parse_info(netlink_neigh_table, &zns->netlink_cmd,
- &dp_info, 0, 1);
+ &dp_info, 0, true);
return ret;
}
@@ -3941,7 +3951,7 @@ int netlink_neigh_read_for_vlan(struct zebra_ns *zns, struct interface *vlan_if)
if (ret < 0)
return ret;
ret = netlink_parse_info(netlink_neigh_table, &zns->netlink_cmd,
- &dp_info, 0, 0);
+ &dp_info, 0, false);
return ret;
}
@@ -4012,7 +4022,7 @@ int netlink_neigh_read_specific_ip(const struct ipaddr *ip,
return ret;
ret = netlink_parse_info(netlink_neigh_table, &zns->netlink_cmd,
- &dp_info, 1, 0);
+ &dp_info, 1, false);
return ret;
}
@@ -4241,7 +4251,7 @@ ssize_t netlink_mpls_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx,
{
mpls_lse_t lse;
const struct nhlfe_list_head *head;
- const zebra_nhlfe_t *nhlfe;
+ const struct zebra_nhlfe *nhlfe;
struct nexthop *nexthop = NULL;
unsigned int nexthop_num;
const char *routedesc;
@@ -4432,7 +4442,7 @@ static int netlink_fdb_nh_update(uint32_t nh_id, struct in_addr vtep_ip)
}
return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
- 0);
+ false);
}
static int netlink_fdb_nh_del(uint32_t nh_id)
@@ -4467,7 +4477,7 @@ static int netlink_fdb_nh_del(uint32_t nh_id)
}
return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
- 0);
+ false);
}
static int netlink_fdb_nhg_update(uint32_t nhg_id, uint32_t nh_cnt,
@@ -4527,7 +4537,7 @@ static int netlink_fdb_nhg_update(uint32_t nhg_id, uint32_t nh_cnt,
}
return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
- 0);
+ false);
}
static int netlink_fdb_nhg_del(uint32_t nhg_id)