summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_clist.c134
-rw-r--r--bgpd/bgp_clist.h14
-rw-r--r--bgpd/bgp_table.c3
-rw-r--r--bgpd/bgp_table.h9
-rw-r--r--lib/agg_table.h6
-rw-r--r--zebra/rt_netlink.c91
6 files changed, 121 insertions, 136 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index 5c461dbe77..b9e1f9aaa2 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -311,9 +311,9 @@ static void community_list_delete(struct community_list_master *cm,
community_list_free(list);
}
-static int community_list_empty_p(struct community_list *list)
+static bool community_list_empty_p(struct community_list *list)
{
- return (list->head == NULL && list->tail == NULL) ? 1 : 0;
+ return list->head == NULL && list->tail == NULL;
}
/* Delete community-list entry from the list. */
@@ -497,7 +497,7 @@ static char *community_str_get(struct community *com, int i)
/* Internal function to perform regular expression match for
* a single community. */
-static int community_regexp_include(regex_t *reg, struct community *com, int i)
+static bool community_regexp_include(regex_t *reg, struct community *com, int i)
{
char *str;
int rv;
@@ -514,16 +514,12 @@ static int community_regexp_include(regex_t *reg, struct community *com, int i)
XFREE(MTYPE_COMMUNITY_STR, str);
- if (rv == 0)
- return 1;
-
- /* No match. */
- return 0;
+ return rv == 0;
}
/* Internal function to perform regular expression match for community
attribute. */
-static int community_regexp_match(struct community *com, regex_t *reg)
+static bool community_regexp_match(struct community *com, regex_t *reg)
{
const char *str;
@@ -536,10 +532,10 @@ static int community_regexp_match(struct community *com, regex_t *reg)
/* Regular expression match. */
if (regexec(reg, str, 0, NULL, 0) == 0)
- return 1;
+ return true;
/* No match. */
- return 0;
+ return false;
}
static char *lcommunity_str_get(struct lcommunity *lcom, int i)
@@ -574,8 +570,8 @@ static char *lcommunity_str_get(struct lcommunity *lcom, int i)
/* Internal function to perform regular expression match for
* a single community. */
-static int lcommunity_regexp_include(regex_t *reg, struct lcommunity *lcom,
- int i)
+static bool lcommunity_regexp_include(regex_t *reg, struct lcommunity *lcom,
+ int i)
{
char *str;
@@ -589,15 +585,15 @@ static int lcommunity_regexp_include(regex_t *reg, struct lcommunity *lcom,
/* Regular expression match. */
if (regexec(reg, str, 0, NULL, 0) == 0) {
XFREE(MTYPE_LCOMMUNITY_STR, str);
- return 1;
+ return true;
}
XFREE(MTYPE_LCOMMUNITY_STR, str);
/* No match. */
- return 0;
+ return false;
}
-static int lcommunity_regexp_match(struct lcommunity *com, regex_t *reg)
+static bool lcommunity_regexp_match(struct lcommunity *com, regex_t *reg)
{
const char *str;
@@ -610,14 +606,14 @@ static int lcommunity_regexp_match(struct lcommunity *com, regex_t *reg)
/* Regular expression match. */
if (regexec(reg, str, 0, NULL, 0) == 0)
- return 1;
+ return true;
/* No match. */
- return 0;
+ return false;
}
-static int ecommunity_regexp_match(struct ecommunity *ecom, regex_t *reg)
+static bool ecommunity_regexp_match(struct ecommunity *ecom, regex_t *reg)
{
const char *str;
@@ -630,10 +626,10 @@ static int ecommunity_regexp_match(struct ecommunity *ecom, regex_t *reg)
/* Regular expression match. */
if (regexec(reg, str, 0, NULL, 0) == 0)
- return 1;
+ return true;
/* No match. */
- return 0;
+ return false;
}
#if 0
@@ -718,125 +714,113 @@ community_regexp_delete (struct community *com, regex_t * reg)
/* When given community attribute matches to the community-list return
1 else return 0. */
-int community_list_match(struct community *com, struct community_list *list)
+bool community_list_match(struct community *com, struct community_list *list)
{
struct community_entry *entry;
for (entry = list->head; entry; entry = entry->next) {
if (entry->any)
- return entry->direct == COMMUNITY_PERMIT ? 1 : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (entry->style == COMMUNITY_LIST_STANDARD) {
if (community_include(entry->u.com, COMMUNITY_INTERNET))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (community_match(com, entry->u.com))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == COMMUNITY_LIST_EXPANDED) {
if (community_regexp_match(com, entry->reg))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
}
}
- return 0;
+ return false;
}
-int lcommunity_list_match(struct lcommunity *lcom, struct community_list *list)
+bool lcommunity_list_match(struct lcommunity *lcom, struct community_list *list)
{
struct community_entry *entry;
for (entry = list->head; entry; entry = entry->next) {
if (entry->any)
- return entry->direct == COMMUNITY_PERMIT ? 1 : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
if (lcommunity_match(lcom, entry->u.lcom))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == LARGE_COMMUNITY_LIST_EXPANDED) {
if (lcommunity_regexp_match(lcom, entry->reg))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
}
}
- return 0;
+ return false;
}
/* Perform exact matching. In case of expanded large-community-list, do
* same thing as lcommunity_list_match().
*/
-int lcommunity_list_exact_match(struct lcommunity *lcom,
- struct community_list *list)
+bool lcommunity_list_exact_match(struct lcommunity *lcom,
+ struct community_list *list)
{
struct community_entry *entry;
for (entry = list->head; entry; entry = entry->next) {
if (entry->any)
- return entry->direct == COMMUNITY_PERMIT ? 1 : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
if (lcommunity_cmp(lcom, entry->u.com))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == LARGE_COMMUNITY_LIST_EXPANDED) {
if (lcommunity_regexp_match(lcom, entry->reg))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
}
}
- return 0;
+ return false;
}
-int ecommunity_list_match(struct ecommunity *ecom, struct community_list *list)
+bool ecommunity_list_match(struct ecommunity *ecom, struct community_list *list)
{
struct community_entry *entry;
for (entry = list->head; entry; entry = entry->next) {
if (entry->any)
- return entry->direct == COMMUNITY_PERMIT ? 1 : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (entry->style == EXTCOMMUNITY_LIST_STANDARD) {
if (ecommunity_match(ecom, entry->u.ecom))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == EXTCOMMUNITY_LIST_EXPANDED) {
if (ecommunity_regexp_match(ecom, entry->reg))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
}
}
- return 0;
+ return false;
}
/* Perform exact matching. In case of expanded community-list, do
same thing as community_list_match(). */
-int community_list_exact_match(struct community *com,
- struct community_list *list)
+bool community_list_exact_match(struct community *com,
+ struct community_list *list)
{
struct community_entry *entry;
for (entry = list->head; entry; entry = entry->next) {
if (entry->any)
- return entry->direct == COMMUNITY_PERMIT ? 1 : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (entry->style == COMMUNITY_LIST_STANDARD) {
if (community_include(entry->u.com, COMMUNITY_INTERNET))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
if (community_cmp(com, entry->u.com))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
} else if (entry->style == COMMUNITY_LIST_EXPANDED) {
if (community_regexp_match(com, entry->reg))
- return entry->direct == COMMUNITY_PERMIT ? 1
- : 0;
+ return entry->direct == COMMUNITY_PERMIT;
}
}
- return 0;
+ return false;
}
/* Delete all permitted communities in the list from com. */
@@ -900,8 +884,8 @@ struct community *community_list_match_delete(struct community *com,
/* To avoid duplicated entry in the community-list, this function
compares specified entry to existing entry. */
-static int community_list_dup_check(struct community_list *list,
- struct community_entry *new)
+static bool community_list_dup_check(struct community_list *list,
+ struct community_entry *new)
{
struct community_entry *entry;
@@ -916,32 +900,32 @@ static int community_list_dup_check(struct community_list *list,
continue;
if (entry->any)
- return 1;
+ return true;
switch (entry->style) {
case COMMUNITY_LIST_STANDARD:
if (community_cmp(entry->u.com, new->u.com))
- return 1;
+ return true;
break;
case LARGE_COMMUNITY_LIST_STANDARD:
if (lcommunity_cmp(entry->u.lcom, new->u.lcom))
- return 1;
+ return true;
break;
case EXTCOMMUNITY_LIST_STANDARD:
if (ecommunity_cmp(entry->u.ecom, new->u.ecom))
- return 1;
+ return true;
break;
case COMMUNITY_LIST_EXPANDED:
case EXTCOMMUNITY_LIST_EXPANDED:
case LARGE_COMMUNITY_LIST_EXPANDED:
if (strcmp(entry->config, new->config) == 0)
- return 1;
+ return true;
break;
default:
break;
}
}
- return 0;
+ return false;
}
/* Set community-list. */
@@ -1104,7 +1088,7 @@ struct lcommunity *lcommunity_list_match_delete(struct lcommunity *lcom,
}
/* Helper to check if every octet do not exceed UINT_MAX */
-static int lcommunity_list_valid(const char *community)
+static bool lcommunity_list_valid(const char *community)
{
int octets = 0;
char **splits;
@@ -1114,10 +1098,10 @@ static int lcommunity_list_valid(const char *community)
for (int i = 0; i < num; i++) {
if (strtoul(splits[i], NULL, 10) > UINT_MAX)
- return 0;
+ return false;
if (strlen(splits[i]) == 0)
- return 0;
+ return false;
octets++;
XFREE(MTYPE_TMP, splits[i]);
@@ -1125,9 +1109,9 @@ static int lcommunity_list_valid(const char *community)
XFREE(MTYPE_TMP, splits);
if (octets < 3)
- return 0;
+ return false;
- return 1;
+ return true;
}
/* Set lcommunity-list. */
diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h
index c5718aecac..4cb5d7c593 100644
--- a/bgpd/bgp_clist.h
+++ b/bgpd/bgp_clist.h
@@ -165,13 +165,13 @@ extern struct community_list *
community_list_lookup(struct community_list_handler *c, const char *name,
uint32_t name_hash, int master);
-extern int community_list_match(struct community *, struct community_list *);
-extern int ecommunity_list_match(struct ecommunity *, struct community_list *);
-extern int lcommunity_list_match(struct lcommunity *, struct community_list *);
-extern int community_list_exact_match(struct community *,
- struct community_list *);
-extern int lcommunity_list_exact_match(struct lcommunity *lcom,
- struct community_list *list);
+extern bool community_list_match(struct community *, struct community_list *);
+extern bool ecommunity_list_match(struct ecommunity *, struct community_list *);
+extern bool lcommunity_list_match(struct lcommunity *, struct community_list *);
+extern bool community_list_exact_match(struct community *,
+ struct community_list *);
+extern bool lcommunity_list_exact_match(struct lcommunity *lcom,
+ struct community_list *list);
extern struct community *community_list_match_delete(struct community *,
struct community_list *);
extern struct lcommunity *
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 04181d38be..3d74128da4 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -187,7 +187,8 @@ bgp_route_next_until_maxlen(struct bgp_node *node, const struct bgp_node *limit,
return NULL;
}
-void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
+void bgp_table_range_lookup(const struct bgp_table *table,
+ const struct prefix *p,
uint8_t maxlen, struct list *matches)
{
struct bgp_node *node = bgp_node_from_rnode(table->route_table->top);
diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h
index 222af12183..7b468cc036 100644
--- a/bgpd/bgp_table.h
+++ b/bgpd/bgp_table.h
@@ -217,7 +217,7 @@ static inline struct bgp_node *bgp_route_next_until(struct bgp_node *node,
* bgp_node_get
*/
static inline struct bgp_node *bgp_node_get(struct bgp_table *const table,
- struct prefix *p)
+ const struct prefix *p)
{
return bgp_node_from_rnode(route_node_get(table->route_table, p));
}
@@ -243,7 +243,7 @@ static inline struct bgp_node *bgp_lock_node(struct bgp_node *node)
* bgp_node_match
*/
static inline struct bgp_node *bgp_node_match(const struct bgp_table *table,
- struct prefix *p)
+ const struct prefix *p)
{
return bgp_node_from_rnode(route_node_match(table->route_table, p));
}
@@ -277,7 +277,7 @@ static inline unsigned long bgp_table_count(const struct bgp_table *const table)
* bgp_table_get_next
*/
static inline struct bgp_node *bgp_table_get_next(const struct bgp_table *table,
- struct prefix *p)
+ const struct prefix *p)
{
return bgp_node_from_rnode(route_table_get_next(table->route_table, p));
}
@@ -347,7 +347,8 @@ static inline uint64_t bgp_table_version(struct bgp_table *table)
return table->version;
}
-void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
+void bgp_table_range_lookup(const struct bgp_table *table,
+ const struct prefix *p,
uint8_t maxlen, struct list *matches);
diff --git a/lib/agg_table.h b/lib/agg_table.h
index 40ffe8c755..f95fed6758 100644
--- a/lib/agg_table.h
+++ b/lib/agg_table.h
@@ -86,13 +86,13 @@ static inline struct agg_node *agg_route_next(struct agg_node *node)
}
static inline struct agg_node *agg_node_get(struct agg_table *table,
- struct prefix *p)
+ const struct prefix *p)
{
return agg_node_from_rnode(route_node_get(table->route_table, p));
}
static inline struct agg_node *
-agg_node_lookup(const struct agg_table *const table, struct prefix *p)
+agg_node_lookup(const struct agg_table *const table, const struct prefix *p)
{
return agg_node_from_rnode(route_node_lookup(table->route_table, p));
}
@@ -109,7 +109,7 @@ static inline struct agg_node *agg_route_next_until(struct agg_node *node,
}
static inline struct agg_node *agg_node_match(struct agg_table *table,
- struct prefix *p)
+ const struct prefix *p)
{
return agg_node_from_rnode(route_node_match(table->route_table, p));
}
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 2cc520bbce..2f675e2d5a 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1111,7 +1111,8 @@ static int build_label_stack(struct mpls_label_stack *nh_label,
* @param nlmsg: nlmsghdr structure to fill in.
* @param req_size: The size allocated for the message.
*/
-static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
+static void _netlink_route_build_singlepath(const struct prefix *p,
+ const char *routedesc, int bytelen,
const struct nexthop *nexthop,
struct nlmsghdr *nlmsg,
struct rtmsg *rtmsg,
@@ -1176,9 +1177,8 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- " 5549: _netlink_route_build_singlepath() (%s): "
- "nexthop via %s %s if %u(%u)",
- routedesc, ipv4_ll_buf, label_buf,
+ " 5549: _netlink_route_build_singlepath() (%s): %pFX nexthop via %s %s if %u(%u)",
+ routedesc, p, ipv4_ll_buf, label_buf,
nexthop->ifindex, nexthop->vrf_id);
return;
}
@@ -1202,9 +1202,8 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "netlink_route_multipath() (%s): "
- "nexthop via %s %s if %u(%u)",
- routedesc, inet_ntoa(nexthop->gate.ipv4),
+ "netlink_route_multipath() (%s): %pFX nexthop via %s %s if %u(%u)",
+ routedesc, p, inet_ntoa(nexthop->gate.ipv4),
label_buf, nexthop->ifindex, nexthop->vrf_id);
}
@@ -1225,9 +1224,8 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "netlink_route_multipath() (%s): "
- "nexthop via %s %s if %u(%u)",
- routedesc, inet6_ntoa(nexthop->gate.ipv6),
+ "netlink_route_multipath() (%s): %pFX nexthop via %s %s if %u(%u)",
+ routedesc, p, inet6_ntoa(nexthop->gate.ipv6),
label_buf, nexthop->ifindex, nexthop->vrf_id);
}
@@ -1251,9 +1249,9 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "netlink_route_multipath() (%s): "
- "nexthop via if %u(%u)",
- routedesc, nexthop->ifindex, nexthop->vrf_id);
+ "netlink_route_multipath() (%s): %pFX nexthop via if %u(%u)",
+ routedesc, p, nexthop->ifindex,
+ nexthop->vrf_id);
}
}
@@ -1273,12 +1271,11 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen,
* @param src: pointer pointing to a location where
* the prefsrc should be stored.
*/
-static void _netlink_route_build_multipath(const char *routedesc, int bytelen,
- const struct nexthop *nexthop,
- struct rtattr *rta,
- struct rtnexthop *rtnh,
- struct rtmsg *rtmsg,
- const union g_addr **src)
+static void
+_netlink_route_build_multipath(const struct prefix *p, const char *routedesc,
+ int bytelen, const struct nexthop *nexthop,
+ struct rtattr *rta, struct rtnexthop *rtnh,
+ struct rtmsg *rtmsg, const union g_addr **src)
{
mpls_lse_t out_lse[MPLS_MAX_LABELS];
char label_buf[256];
@@ -1350,9 +1347,8 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- " 5549: netlink_route_build_multipath() (%s): "
- "nexthop via %s %s if %u",
- routedesc, ipv4_ll_buf, label_buf,
+ " 5549: netlink_route_build_multipath() (%s): %pFX nexthop via %s %s if %u",
+ routedesc, p, ipv4_ll_buf, label_buf,
nexthop->ifindex);
return;
}
@@ -1369,9 +1365,8 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "netlink_route_multipath() (%s): "
- "nexthop via %s %s if %u",
- routedesc, inet_ntoa(nexthop->gate.ipv4),
+ "netlink_route_multipath() (%s): %pFX nexthop via %s %s if %u",
+ routedesc, p, inet_ntoa(nexthop->gate.ipv4),
label_buf, nexthop->ifindex);
}
if (nexthop->type == NEXTHOP_TYPE_IPV6
@@ -1387,9 +1382,8 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "netlink_route_multipath() (%s): "
- "nexthop via %s %s if %u",
- routedesc, inet6_ntoa(nexthop->gate.ipv6),
+ "netlink_route_multipath() (%s): %pFX nexthop via %s %s if %u",
+ routedesc, p, inet6_ntoa(nexthop->gate.ipv6),
label_buf, nexthop->ifindex);
}
@@ -1410,16 +1404,16 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen,
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
- "netlink_route_multipath() (%s): "
- "nexthop via if %u",
- routedesc, nexthop->ifindex);
+ "netlink_route_multipath() (%s): %pFX nexthop via if %u",
+ routedesc, p, nexthop->ifindex);
}
if (nexthop->weight)
rtnh->rtnh_hops = nexthop->weight - 1;
}
-static inline void _netlink_mpls_build_singlepath(const char *routedesc,
+static inline void _netlink_mpls_build_singlepath(const struct prefix *p,
+ const char *routedesc,
const zebra_nhlfe_t *nhlfe,
struct nlmsghdr *nlmsg,
struct rtmsg *rtmsg,
@@ -1430,23 +1424,24 @@ static inline void _netlink_mpls_build_singlepath(const char *routedesc,
family = NHLFE_FAMILY(nhlfe);
bytelen = (family == AF_INET ? 4 : 16);
- _netlink_route_build_singlepath(routedesc, bytelen, nhlfe->nexthop,
+ _netlink_route_build_singlepath(p, routedesc, bytelen, nhlfe->nexthop,
nlmsg, rtmsg, req_size, cmd);
}
static inline void
-_netlink_mpls_build_multipath(const char *routedesc, const zebra_nhlfe_t *nhlfe,
- struct rtattr *rta, struct rtnexthop *rtnh,
- struct rtmsg *rtmsg, const union g_addr **src)
+_netlink_mpls_build_multipath(const struct prefix *p, const char *routedesc,
+ const zebra_nhlfe_t *nhlfe, struct rtattr *rta,
+ struct rtnexthop *rtnh, struct rtmsg *rtmsg,
+ const union g_addr **src)
{
int bytelen;
uint8_t family;
family = NHLFE_FAMILY(nhlfe);
bytelen = (family == AF_INET ? 4 : 16);
- _netlink_route_build_multipath(routedesc, bytelen, nhlfe->nexthop, rta,
- rtnh, rtmsg, src);
+ _netlink_route_build_multipath(p, routedesc, bytelen, nhlfe->nexthop,
+ rta, rtnh, rtmsg, src);
}
@@ -1646,6 +1641,10 @@ static int netlink_route_multipath(int cmd, struct zebra_dplane_ctx *ctx)
}
if (kernel_nexthops_supported()) {
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug(
+ "netlink_route_multipath(): %pFX nhg_id is %u",
+ p, dplane_ctx_get_nhe_id(ctx));
/* Kernel supports nexthop objects */
addattr32(&req.n, sizeof(req), RTA_NH_ID,
dplane_ctx_get_nhe_id(ctx));
@@ -1732,7 +1731,7 @@ static int netlink_route_multipath(int cmd, struct zebra_dplane_ctx *ctx)
: "single-path";
_netlink_route_build_singlepath(
- routedesc, bytelen, nexthop, &req.n,
+ p, routedesc, bytelen, nexthop, &req.n,
&req.r, sizeof(req), cmd);
nexthop_num++;
break;
@@ -1802,8 +1801,8 @@ static int netlink_route_multipath(int cmd, struct zebra_dplane_ctx *ctx)
nexthop_num++;
_netlink_route_build_multipath(
- routedesc, bytelen, nexthop, rta, rtnh,
- &req.r, &src1);
+ p, routedesc, bytelen, nexthop, rta,
+ rtnh, &req.r, &src1);
rtnh = RTNH_NEXT(rtnh);
if (!setsrc && src1) {
@@ -3466,6 +3465,7 @@ int netlink_mpls_multipath(int cmd, struct zebra_dplane_ctx *ctx)
unsigned int nexthop_num;
const char *routedesc;
int route_type;
+ struct prefix p = {0};
struct {
struct nlmsghdr n;
@@ -3552,8 +3552,7 @@ int netlink_mpls_multipath(int cmd, struct zebra_dplane_ctx *ctx)
NEXTHOP_FLAG_FIB)))) {
/* Add the gateway */
_netlink_mpls_build_singlepath(
- routedesc, nhlfe,
- &req.n, &req.r,
+ &p, routedesc, nhlfe, &req.n, &req.r,
sizeof(req), cmd);
nexthop_num++;
@@ -3593,9 +3592,9 @@ int netlink_mpls_multipath(int cmd, struct zebra_dplane_ctx *ctx)
nexthop_num++;
/* Build the multipath */
- _netlink_mpls_build_multipath(routedesc, nhlfe,
- rta, rtnh, &req.r,
- &src1);
+ _netlink_mpls_build_multipath(&p, routedesc,
+ nhlfe, rta, rtnh,
+ &req.r, &src1);
rtnh = RTNH_NEXT(rtnh);
}
}