summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--bgpd/bgp_mac.c22
-rw-r--r--bgpd/bgp_route.c20
-rw-r--r--doc/user/bgp.rst61
-rw-r--r--lib/command.c1
-rw-r--r--lib/command.h1
-rw-r--r--lib/routemap.c129
-rw-r--r--pimd/pim_ifchannel.c4
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py4
-rw-r--r--vtysh/vtysh_config.c7
-rw-r--r--zebra/kernel_netlink.c12
-rw-r--r--zebra/rt_netlink.c4
-rw-r--r--zebra/zebra_rib.c10
-rw-r--r--zebra/zebra_rnh.c27
-rw-r--r--zebra/zebra_rnh.h12
15 files changed, 275 insertions, 40 deletions
diff --git a/README.md b/README.md
index a7725d5e4e..e8c775684a 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ FRR currently supports the following protocols:
* Babel
* PBR
* OpenFabric
+* VRRP
* EIGRP (alpha)
* NHRP (alpha)
diff --git a/bgpd/bgp_mac.c b/bgpd/bgp_mac.c
index f19453fecb..c85b4b1f39 100644
--- a/bgpd/bgp_mac.c
+++ b/bgpd/bgp_mac.c
@@ -29,6 +29,7 @@
#include "bgpd/bgp_memory.h"
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_packet.h"
+#include "bgpd/bgp_rd.h"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_evpn_private.h"
@@ -169,6 +170,23 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,
prd.prefixlen = 64;
memcpy(&prd.val, &prn->p.u.val, 8);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
+ if (bgp_debug_update(peer, &rn->p, NULL, 1)) {
+ char pfx_buf[BGP_PRD_PATH_STRLEN];
+
+ bgp_debug_rdpfxpath2str(
+ AFI_L2VPN, SAFI_EVPN, &prd,
+ &rn->p, label_pnt, num_labels,
+ pi->addpath_rx_id ? 1 : 0,
+ pi->addpath_rx_id, pfx_buf,
+ sizeof(pfx_buf));
+ zlog_debug(
+ "%s skip update of %s marked as removed",
+ peer->host, pfx_buf);
+ }
+ continue;
+ }
+
memcpy(&evpn, &pi->attr->evpn_overlay, sizeof(evpn));
int32_t ret = bgp_update(peer, &rn->p,
pi->addpath_rx_id,
@@ -282,8 +300,10 @@ void bgp_mac_add_mac_entry(struct interface *ifp)
* If old mac address is the same as the new,
* then there is nothing to do here
*/
- if (old_bsm == bsm)
+ if (old_bsm == bsm) {
+ XFREE(MTYPE_BSM_STRING, ifname);
return;
+ }
if (old_bsm)
bgp_mac_remove_ifp_internal(old_bsm, ifp->name);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index ae1821c43a..4ae018698d 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6532,28 +6532,38 @@ DEFUN (no_aggregate_address_mask,
DEFUN (ipv6_aggregate_address,
ipv6_aggregate_address_cmd,
- "aggregate-address X:X::X:X/M [summary-only]",
+ "aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>]",
"Configure BGP aggregate entries\n"
"Aggregate prefix\n"
- "Filter more specific routes from updates\n")
+ "Generate AS set path information\n"
+ "Filter more specific routes from updates\n"
+ "Filter more specific routes from updates\n"
+ "Generate AS set path information\n")
{
int idx = 0;
argv_find(argv, argc, "X:X::X:X/M", &idx);
char *prefix = argv[idx]->arg;
+ int as_set =
+ argv_find(argv, argc, "as-set", &idx) ? AGGREGATE_AS_SET : 0;
+
+ idx = 0;
int sum_only = argv_find(argv, argc, "summary-only", &idx)
? AGGREGATE_SUMMARY_ONLY
: 0;
return bgp_aggregate_set(vty, prefix, AFI_IP6, SAFI_UNICAST, sum_only,
- 0);
+ as_set);
}
DEFUN (no_ipv6_aggregate_address,
no_ipv6_aggregate_address_cmd,
- "no aggregate-address X:X::X:X/M [summary-only]",
+ "no aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>]",
NO_STR
"Configure BGP aggregate entries\n"
"Aggregate prefix\n"
- "Filter more specific routes from updates\n")
+ "Generate AS set path information\n"
+ "Filter more specific routes from updates\n"
+ "Filter more specific routes from updates\n"
+ "Generate AS set path information\n")
{
int idx = 0;
argv_find(argv, argc, "X:X::X:X/M", &idx);
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index 95998d3054..933a8f70b4 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -665,6 +665,11 @@ Networks
Route Aggregation
-----------------
+.. _bgp-route-aggregation-ipv4:
+
+Route Aggregation-IPv4 Address Family
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
.. index:: aggregate-address A.B.C.D/M
.. clicmd:: aggregate-address A.B.C.D/M
@@ -684,6 +689,62 @@ Route Aggregation
.. index:: no aggregate-address A.B.C.D/M
.. clicmd:: no aggregate-address A.B.C.D/M
+
+ This command removes an aggregate address.
+
+
+ This configuration example setup the aggregate-address under
+ ipv4 address-family.
+
+ .. code-block:: frr
+
+ router bgp 1
+ address-family ipv4 unicast
+ aggregate-address 10.0.0.0/8
+ aggregate-address 20.0.0.0/8 as-set
+ aggregate-address 40.0.0.0/8 summary-only
+ exit-address-family
+
+
+.. _bgp-route-aggregation-ipv6:
+
+Route Aggregation-IPv6 Address Family
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. index:: aggregate-address X:X::X:X/M
+.. clicmd:: aggregate-address X:X::X:X/M
+
+ This command specifies an aggregate address.
+
+.. index:: aggregate-address X:X::X:X/M as-set
+.. clicmd:: aggregate-address X:X::X:X/M as-set
+
+ This command specifies an aggregate address. Resulting routes include
+ AS set.
+
+.. index:: aggregate-address X:X::X:X/M summary-only
+.. clicmd:: aggregate-address X:X::X:X/M summary-only
+
+ This command specifies an aggregate address. Aggregated routes will
+ not be announce.
+
+.. index:: no aggregate-address X:X::X:X/M
+.. clicmd:: no aggregate-address X:X::X:X/M
+
+ This command removes an aggregate address.
+
+
+ This configuration example setup the aggregate-address under
+ ipv4 address-family.
+
+ .. code-block:: frr
+
+ router bgp 1
+ address-family ipv6 unicast
+ aggregate-address 10::0/64
+ aggregate-address 20::0/64 as-set
+ aggregate-address 40::0/64 summary-only
+ exit-address-family
.. _bgp-redistribute-to-bgp:
diff --git a/lib/command.c b/lib/command.c
index 0e16f30a8a..eb7ee52336 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -84,6 +84,7 @@ const char *node_names[] = {
"vrf debug", // VRF_DEBUG_NODE,
"northbound debug", // NORTHBOUND_DEBUG_NODE,
"vnc debug", // DEBUG_VNC_NODE,
+ "route-map debug", /* RMAP_DEBUG_NODE */
"aaa", // AAA_NODE,
"keychain", // KEYCHAIN_NODE,
"keychain key", // KEYCHAIN_KEY_NODE,
diff --git a/lib/command.h b/lib/command.h
index d6c41e0824..cc4c5d52f2 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -94,6 +94,7 @@ enum node_type {
VRF_DEBUG_NODE, /* Vrf Debug node. */
NORTHBOUND_DEBUG_NODE, /* Northbound Debug node. */
DEBUG_VNC_NODE, /* Debug VNC node. */
+ RMAP_DEBUG_NODE, /* Route-map debug node */
AAA_NODE, /* AAA node. */
KEYCHAIN_NODE, /* Key-chain node. */
KEYCHAIN_KEY_NODE, /* Key-chain key node. */
diff --git a/lib/routemap.c b/lib/routemap.c
index 9336154b1a..47cc2e294a 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -688,7 +688,7 @@ static unsigned int route_map_dep_hash_make_key(const void *p);
static void route_map_clear_all_references(char *rmap_name);
static void route_map_rule_delete(struct route_map_rule_list *,
struct route_map_rule *);
-static int rmap_debug = 0;
+static bool rmap_debug;
static void route_map_index_delete(struct route_map_index *, int);
@@ -739,6 +739,9 @@ static struct route_map *route_map_add(const char *name)
(*route_map_master.add_hook)(name);
route_map_notify_dependencies(name, RMAP_EVENT_CALL_ADDED);
}
+
+ if (rmap_debug)
+ zlog_debug("Add route-map %s", name);
return map;
}
@@ -757,6 +760,9 @@ static void route_map_free_map(struct route_map *map)
while ((index = map->head) != NULL)
route_map_index_delete(index, 0);
+ if (rmap_debug)
+ zlog_debug("Deleting route-map %s", map->name);
+
list = &route_map_master;
QOBJ_UNREG(map);
@@ -921,6 +927,24 @@ static const char *route_map_type_str(enum route_map_type type)
return "";
}
+static const char *route_map_result_str(route_map_result_t res)
+{
+ switch (res) {
+ case RMAP_MATCH:
+ return "match";
+ case RMAP_DENYMATCH:
+ return "deny";
+ case RMAP_NOMATCH:
+ return "no match";
+ case RMAP_ERROR:
+ return "error";
+ case RMAP_OKAY:
+ return "okay";
+ }
+
+ return "invalid";
+}
+
static int route_map_empty(struct route_map *map)
{
if (map->head == NULL && map->tail == NULL)
@@ -1066,6 +1090,10 @@ static void route_map_index_delete(struct route_map_index *index, int notify)
QOBJ_UNREG(index);
+ if (rmap_debug)
+ zlog_debug("Deleting route-map %s sequence %d",
+ index->map->name, index->pref);
+
/* Free route match. */
while ((rule = index->match_list.head) != NULL)
route_map_rule_delete(&index->match_list, rule);
@@ -1152,6 +1180,11 @@ route_map_index_add(struct route_map *map, enum route_map_type type, int pref)
(*route_map_master.event_hook)(map->name);
route_map_notify_dependencies(map->name, RMAP_EVENT_CALL_ADDED);
}
+
+ if (rmap_debug)
+ zlog_debug("Route-map %s add sequence %d, type: %s",
+ map->name, pref, route_map_type_str(type));
+
return index;
}
@@ -1612,6 +1645,7 @@ route_map_result_t route_map_apply(struct route_map *map,
int ret = 0;
struct route_map_index *index;
struct route_map_rule *set;
+ char buf[PREFIX_STRLEN];
if (recursion > RMAP_RECURSION_LIMIT) {
flog_warn(
@@ -1622,8 +1656,10 @@ route_map_result_t route_map_apply(struct route_map *map,
return RMAP_DENYMATCH;
}
- if (map == NULL)
- return RMAP_DENYMATCH;
+ if (map == NULL) {
+ ret = RMAP_DENYMATCH;
+ goto route_map_apply_end;
+ }
map->applied++;
for (index = map->head; index; index = index->next) {
@@ -1632,6 +1668,13 @@ route_map_result_t route_map_apply(struct route_map *map,
ret = route_map_apply_match(&index->match_list, prefix, type,
object);
+ if (rmap_debug) {
+ zlog_debug("Route-map: %s, sequence: %d, prefix: %s, result: %s",
+ map->name, index->pref,
+ prefix2str(prefix, buf, sizeof(buf)),
+ route_map_result_str(ret));
+ }
+
/* Now we apply the matrix from above */
if (ret == RMAP_NOMATCH)
/* 'cont' from matrix - continue to next route-map
@@ -1666,12 +1709,12 @@ route_map_result_t route_map_apply(struct route_map *map,
/* If nextrm returned 'deny', finish. */
if (ret == RMAP_DENYMATCH)
- return ret;
+ goto route_map_apply_end;
}
switch (index->exitpolicy) {
case RMAP_EXIT:
- return ret;
+ goto route_map_apply_end;
case RMAP_NEXT:
continue;
case RMAP_GOTO: {
@@ -1686,19 +1729,30 @@ route_map_result_t route_map_apply(struct route_map *map,
}
if (next == NULL) {
/* No clauses match! */
- return ret;
+ goto route_map_apply_end;
}
}
}
} else if (index->type == RMAP_DENY)
/* 'deny' */
{
- return RMAP_DENYMATCH;
+ ret = RMAP_DENYMATCH;
+ goto route_map_apply_end;
}
}
}
/* Finally route-map does not match at all. */
- return RMAP_DENYMATCH;
+ ret = RMAP_DENYMATCH;
+
+route_map_apply_end:
+ if (rmap_debug) {
+ zlog_debug("Route-map: %s, prefix: %s, result: %s",
+ (map ? map->name : "null"),
+ prefix2str(prefix, buf, sizeof(buf)),
+ route_map_result_str(ret));
+ }
+
+ return (ret);
}
void route_map_add_hook(void (*func)(const char *))
@@ -1835,8 +1889,8 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
case RMAP_EVENT_CALL_ADDED:
case RMAP_EVENT_FILTER_ADDED:
if (rmap_debug)
- zlog_debug("%s: Adding dependency for %s in %s",
- __FUNCTION__, dep_name, rmap_name);
+ zlog_debug("Adding dependency for filter %s in route-map %s",
+ dep_name, rmap_name);
dep = (struct route_map_dep *)hash_get(
dephash, dname, route_map_dep_hash_alloc);
if (!dep) {
@@ -1864,8 +1918,8 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
case RMAP_EVENT_CALL_DELETED:
case RMAP_EVENT_FILTER_DELETED:
if (rmap_debug)
- zlog_debug("%s: Deleting dependency for %s in %s",
- __FUNCTION__, dep_name, rmap_name);
+ zlog_debug("Deleting dependency for filter %s in route-map %s",
+ dep_name, rmap_name);
dep = (struct route_map_dep *)hash_get(dephash, dname, NULL);
if (!dep) {
goto out;
@@ -1979,8 +2033,7 @@ static void route_map_process_dependency(struct hash_bucket *bucket, void *data)
rmap_name = dep_data->rname;
if (rmap_debug)
- zlog_debug("%s: Notifying %s of dependency",
- __FUNCTION__, rmap_name);
+ zlog_debug("Notifying %s of dependency", rmap_name);
if (route_map_master.event_hook)
(*route_map_master.event_hook)(rmap_name);
}
@@ -2027,6 +2080,8 @@ void route_map_notify_dependencies(const char *affected_name,
if (!dep->this_hash)
dep->this_hash = upd8_hash;
+ if (rmap_debug)
+ zlog_debug("Filter %s updated", dep->dep_name);
hash_iterate(dep->dep_rmap_hash, route_map_process_dependency,
(void *)event);
}
@@ -3006,6 +3061,30 @@ DEFUN (no_rmap_description,
return CMD_SUCCESS;
}
+DEFUN (debug_rmap,
+ debug_rmap_cmd,
+ "debug route-map",
+ DEBUG_STR
+ "Debug option set for route-maps\n")
+{
+ rmap_debug = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_rmap,
+ no_debug_rmap_cmd,
+ "no debug route-map",
+ NO_STR
+ DEBUG_STR
+ "Debug option set for route-maps\n")
+{
+ rmap_debug = false;
+ return CMD_SUCCESS;
+}
+
+/* Debug node. */
+static struct cmd_node rmap_debug_node = {RMAP_DEBUG_NODE, "", 1};
+
/* Configuration write function. */
static int route_map_config_write(struct vty *vty)
{
@@ -3051,6 +3130,18 @@ static int route_map_config_write(struct vty *vty)
return write;
}
+static int rmap_config_write_debug(struct vty *vty)
+{
+ int write = 0;
+
+ if (rmap_debug) {
+ vty_out(vty, "debug route-map\n");
+ write++;
+ }
+
+ return write;
+}
+
/* Route map node structure. */
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# ", 1};
@@ -3164,15 +3255,22 @@ void route_map_init(void)
cmd_variable_handler_register(rmap_var_handlers);
+ rmap_debug = false;
+
/* Install route map top node. */
install_node(&rmap_node, route_map_config_write);
+ install_node(&rmap_debug_node, rmap_config_write_debug);
+
/* Install route map commands. */
install_default(RMAP_NODE);
install_element(CONFIG_NODE, &route_map_cmd);
install_element(CONFIG_NODE, &no_route_map_cmd);
install_element(CONFIG_NODE, &no_route_map_all_cmd);
+ install_element(CONFIG_NODE, &debug_rmap_cmd);
+ install_element(CONFIG_NODE, &no_debug_rmap_cmd);
+
/* Install the on-match stuff */
install_element(RMAP_NODE, &route_map_cmd);
install_element(RMAP_NODE, &rmap_onmatch_next_cmd);
@@ -3196,6 +3294,9 @@ void route_map_init(void)
install_element(ENABLE_NODE, &rmap_show_name_cmd);
install_element(ENABLE_NODE, &rmap_show_unused_cmd);
+ install_element(ENABLE_NODE, &debug_rmap_cmd);
+ install_element(ENABLE_NODE, &no_debug_rmap_cmd);
+
install_element(RMAP_NODE, &match_interface_cmd);
install_element(RMAP_NODE, &no_match_interface_cmd);
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 9b242e9be5..3fb3da8f44 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -613,6 +613,10 @@ static int on_ifjoin_expiry_timer(struct thread *t)
ch = THREAD_ARG(t);
+ if (PIM_DEBUG_TRACE)
+ zlog_debug("%s: ifchannel %s expiry timer", __PRETTY_FUNCTION__,
+ ch->sg_str);
+
ifjoin_to_noinfo(ch, true);
/* ch may have been deleted */
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
index ce542413ba..02fba97316 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
@@ -149,7 +149,9 @@ def ltemplatePreRouterStartHook():
krel = platform.release()
tgen = get_topogen()
logger.info('pre router-start hook, kernel=' + krel)
- if topotest.version_cmp(krel, '4.15') == 0:
+
+ if topotest.version_cmp(krel, '4.15') >= 0 and \
+ topotest.version_cmp(krel, '4.18') <= 0:
l3mdev_accept = 1
else:
l3mdev_accept = 0
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 9c2de0f62b..b8957c2b00 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -373,6 +373,10 @@ void vtysh_config_parse_line(void *arg, const char *line)
strlen("debug northbound"))
== 0)
config = config_get(NORTHBOUND_DEBUG_NODE, line);
+ else if (strncmp(line, "debug route-map",
+ strlen("debug route-map"))
+ == 0)
+ config = config_get(RMAP_DEBUG_NODE, line);
else if (strncmp(line, "debug", strlen("debug")) == 0)
config = config_get(DEBUG_NODE, line);
else if (strncmp(line, "password", strlen("password")) == 0
@@ -418,7 +422,8 @@ void vtysh_config_parse_line(void *arg, const char *line)
|| (I) == ACCESS_IPV6_NODE || (I) == ACCESS_MAC_NODE \
|| (I) == PREFIX_IPV6_NODE || (I) == FORWARDING_NODE \
|| (I) == DEBUG_NODE || (I) == AAA_NODE || (I) == VRF_DEBUG_NODE \
- || (I) == NORTHBOUND_DEBUG_NODE || (I) == MPLS_NODE)
+ || (I) == NORTHBOUND_DEBUG_NODE || (I) == RMAP_DEBUG_NODE \
+ || (I) == MPLS_NODE)
/* Display configuration to file pointer. */
void vtysh_config_dump(void)
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 4971994346..2c306434a3 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -129,8 +129,18 @@ static const struct message family_str[] = {{AF_INET, "ipv4"},
{RTNL_FAMILY_IP6MR, "ipv6MR"},
{0}};
-static const struct message rttype_str[] = {{RTN_UNICAST, "unicast"},
+static const struct message rttype_str[] = {{RTN_UNSPEC, "none"},
+ {RTN_UNICAST, "unicast"},
+ {RTN_LOCAL, "local"},
+ {RTN_BROADCAST, "broadcast"},
+ {RTN_ANYCAST, "anycast"},
{RTN_MULTICAST, "multicast"},
+ {RTN_BLACKHOLE, "blackhole"},
+ {RTN_UNREACHABLE, "unreachable"},
+ {RTN_PROHIBIT, "prohibited"},
+ {RTN_THROW, "throw"},
+ {RTN_NAT, "nat"},
+ {RTN_XRESOLVE, "resolver"},
{0}};
extern struct thread_master *master;
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 92c78a4cbb..3c1bc4d081 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -330,6 +330,10 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
bh_type = BLACKHOLE_ADMINPROHIB;
break;
default:
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug("Route rtm_type: %s(%d) intentionally ignoring",
+ nl_rttype_to_str(rtm->rtm_type),
+ rtm->rtm_type);
return 0;
}
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index cc614abac5..555bec9593 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -744,9 +744,10 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
char buf[PREFIX_STRLEN];
- zlog_debug("%s: %s Being examined for Nexthop Tracking",
+ zlog_debug("%s: %s Being examined for Nexthop Tracking Count: %zd",
__PRETTY_FUNCTION__,
- srcdest_rnode2str(rn, buf, sizeof(buf)));
+ srcdest_rnode2str(rn, buf, sizeof(buf)),
+ dest ? rnh_list_count(&dest->nht) : 0);
}
if (!dest) {
rn = rn->parent;
@@ -760,7 +761,7 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
* nht resolution and as such we need to call the
* nexthop tracking evaluation code
*/
- frr_each (rnh_list, &dest->nht, rnh) {
+ frr_each_safe(rnh_list, &dest->nht, rnh) {
struct zebra_vrf *zvrf =
zebra_vrf_lookup_by_id(rnh->vrf_id);
struct prefix *p = &rnh->node->p;
@@ -769,11 +770,12 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
char buf1[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
- zlog_debug("%u:%s has Nexthop(%s) depending on it, evaluating %u:%u",
+ zlog_debug("%u:%s has Nexthop(%s) Type: %s depending on it, evaluating %u:%u",
zvrf->vrf->vrf_id,
srcdest_rnode2str(rn, buf1,
sizeof(buf1)),
prefix2str(p, buf2, sizeof(buf2)),
+ rnh_type2str(rnh->type),
seq, rnh->seqno);
}
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 1024f3a052..0a8dbfdde8 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -160,14 +160,15 @@ struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, rnh_type_t type,
if (IS_ZEBRA_DEBUG_NHT) {
prefix2str(p, buf, sizeof(buf));
- zlog_debug("%u: Add RNH %s type %d", vrfid, buf, type);
+ zlog_debug("%u: Add RNH %s type %s", vrfid, buf,
+ rnh_type2str(type));
}
table = get_rnh_table(vrfid, afi, type);
if (!table) {
prefix2str(p, buf, sizeof(buf));
flog_warn(EC_ZEBRA_RNH_NO_TABLE,
- "%u: Add RNH %s type %d - table not found", vrfid,
- buf, type);
+ "%u: Add RNH %s type %s - table not found", vrfid,
+ buf, rnh_type2str(type));
exists = false;
return NULL;
}
@@ -271,8 +272,8 @@ static void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type)
if (IS_ZEBRA_DEBUG_NHT) {
char buf[PREFIX2STR_BUFFER];
- zlog_debug("%u: Del RNH %s type %d", rnh->vrf_id,
- rnh_str(rnh, buf, sizeof(buf)), type);
+ zlog_debug("%u: Del RNH %s type %s", rnh->vrf_id,
+ rnh_str(rnh, buf, sizeof(buf)), rnh_type2str(type));
}
zebra_free_rnh(rnh);
@@ -293,9 +294,9 @@ void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
{
if (IS_ZEBRA_DEBUG_NHT) {
char buf[PREFIX2STR_BUFFER];
- zlog_debug("%u: Client %s registers for RNH %s type %d", vrf_id,
+ zlog_debug("%u: Client %s registers for RNH %s type %s", vrf_id,
zebra_route_string(client->proto),
- rnh_str(rnh, buf, sizeof(buf)), type);
+ rnh_str(rnh, buf, sizeof(buf)), rnh_type2str(type));
}
if (!listnode_lookup(rnh->client_list, client))
listnode_add(rnh->client_list, client);
@@ -312,9 +313,9 @@ void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client,
{
if (IS_ZEBRA_DEBUG_NHT) {
char buf[PREFIX2STR_BUFFER];
- zlog_debug("Client %s unregisters for RNH %s type %d",
+ zlog_debug("Client %s unregisters for RNH %s type %s",
zebra_route_string(client->proto),
- rnh_str(rnh, buf, sizeof(buf)), type);
+ rnh_str(rnh, buf, sizeof(buf)), rnh_type2str(type));
}
listnode_delete(rnh->client_list, client);
zebra_delete_rnh(rnh, type);
@@ -803,8 +804,8 @@ static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi,
if (IS_ZEBRA_DEBUG_NHT) {
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
- zlog_debug("%u:%s: Evaluate RNH, type %d %s", zvrf->vrf->vrf_id,
- bufn, type, force ? "(force)" : "");
+ zlog_debug("%u:%s: Evaluate RNH, type %s %s", zvrf->vrf->vrf_id,
+ bufn, rnh_type2str(type), force ? "(force)" : "");
}
rnh = nrn->info;
@@ -1156,9 +1157,9 @@ static int zebra_cleanup_rnh_client(vrf_id_t vrf_id, afi_t afi,
struct rnh *rnh;
if (IS_ZEBRA_DEBUG_NHT)
- zlog_debug("%u: Client %s RNH cleanup for family %s type %d",
+ zlog_debug("%u: Client %s RNH cleanup for family %s type %s",
vrf_id, zebra_route_string(client->proto),
- afi2str(afi), type);
+ afi2str(afi), rnh_type2str(type));
ntable = get_rnh_table(vrf_id, afi, type);
if (!ntable) {
diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h
index 95a3941181..c7d2c0d298 100644
--- a/zebra/zebra_rnh.h
+++ b/zebra/zebra_rnh.h
@@ -43,6 +43,18 @@ static inline int rnh_resolve_via_default(int family)
return 0;
}
+static inline const char *rnh_type2str(rnh_type_t type)
+{
+ switch (type) {
+ case RNH_NEXTHOP_TYPE:
+ return "Nexthop";
+ case RNH_IMPORT_CHECK_TYPE:
+ return "Import";
+ }
+
+ return "ERROR";
+}
+
extern struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid,
rnh_type_t type, bool *exists);
extern struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid,