summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_routemap.c102
-rw-r--r--doc/user/basic.rst6
-rw-r--r--lib/routemap.c67
-rw-r--r--lib/routemap.h4
-rw-r--r--lib/subdir.am1
-rw-r--r--ospfd/ospf_routemap.c29
-rw-r--r--zebra/redistribute.c6
-rw-r--r--zebra/zebra_routemap.c28
8 files changed, 192 insertions, 51 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index d00bdd2571..5aa3ec4fd1 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -475,8 +475,13 @@ route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
if (prefix->family == AF_INET) {
alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, prefix) == FILTER_DENY
? RMAP_NOMATCH
@@ -489,6 +494,13 @@ route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
access-list name. */
static void *route_match_ip_address_compile(const char *arg)
{
+ struct access_list *alist;
+
+ alist = access_list_lookup(AFI_IP, arg);
+ if (!alist)
+ zlog_warn(
+ "Access List specified %s does not exist yet, default will be NO_MATCH until it is created",
+ arg);
return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
}
@@ -506,7 +518,7 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = {
route_match_ip_address_free
};
-/* `match ip next-hop IP_ADDRESS' */
+/* `match ip next-hop <IP_ADDRESS_ACCESS_LIST_NAME>' */
/* Match function return 1 if match is success else return zero. */
static enum route_map_cmd_result_t
@@ -523,8 +535,14 @@ route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object)
p.prefixlen = IPV4_MAX_BITLEN;
alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
+
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, &p) == FILTER_DENY
? RMAP_NOMATCH
@@ -577,8 +595,14 @@ route_match_ip_route_source(void *rule, const struct prefix *pfx, void *object)
p.prefixlen = IPV4_MAX_BITLEN;
alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
+
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, &p) == FILTER_DENY
? RMAP_NOMATCH
@@ -666,8 +690,13 @@ route_match_address_prefix_list(void *rule, afi_t afi,
struct prefix_list *plist;
plist = prefix_list_lookup(afi, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
if (prefix->family == AF_FLOWSPEC)
return route_match_prefix_list_flowspec(afi, plist,
@@ -722,8 +751,13 @@ route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
p.prefixlen = IPV4_MAX_BITLEN;
plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (prefix_list_apply(plist, &p) == PREFIX_DENY
? RMAP_NOMATCH
@@ -766,8 +800,13 @@ route_match_ipv6_next_hop_prefix_list(void *rule, const struct prefix *prefix,
p.prefixlen = IPV6_MAX_BITLEN;
plist = prefix_list_lookup(AFI_IP6, (char *)rule);
- if (!plist)
+ if (!plist) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
if (prefix_list_apply(plist, &p) == PREFIX_PERMIT)
return RMAP_MATCH;
@@ -866,8 +905,13 @@ route_match_ip_route_source_prefix_list(void *rule, const struct prefix *prefix,
p.prefixlen = IPV4_MAX_BITLEN;
plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (prefix_list_apply(plist, &p) == PREFIX_DENY
? RMAP_NOMATCH
@@ -926,11 +970,21 @@ route_match_mac_address(void *rule, const struct prefix *prefix, void *object)
struct prefix p;
alist = access_list_lookup(AFI_L2VPN, (char *)rule);
- if (alist == NULL)
- return RMAP_NOMATCH;
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
- if (prefix->u.prefix_evpn.route_type != BGP_EVPN_MAC_IP_ROUTE)
return RMAP_NOMATCH;
+ }
+ if (prefix->u.prefix_evpn.route_type != BGP_EVPN_MAC_IP_ROUTE) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix %pFX is not a EVPN MAC IP ROUTE defaulting to NO_MATCH",
+ __func__, prefix);
+ return RMAP_NOMATCH;
+ }
p.family = AF_ETHERNET;
p.prefixlen = ETH_ALEN * 8;
@@ -3206,8 +3260,14 @@ route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object)
if (prefix->family == AF_INET6) {
alist = access_list_lookup(AFI_IP6, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
+
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, prefix) == FILTER_DENY
? RMAP_NOMATCH
@@ -3218,6 +3278,14 @@ route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object)
static void *route_match_ipv6_address_compile(const char *arg)
{
+ struct access_list *alist;
+
+ alist = access_list_lookup(AFI_IP6, arg);
+ if (!alist)
+ zlog_warn(
+ "Access List specified %s does not exist yet, default will be NO_MATCH until it is created",
+ arg);
+
return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
}
@@ -3249,8 +3317,14 @@ route_match_ipv6_next_hop(void *rule, const struct prefix *prefix, void *object)
p.prefixlen = IPV6_MAX_BITLEN;
alist = access_list_lookup(AFI_IP6, (char *)rule);
- if (!alist)
+ if (!alist) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
+
return RMAP_NOMATCH;
+ }
if (access_list_apply(alist, &p) == FILTER_PERMIT)
return RMAP_MATCH;
@@ -3332,7 +3406,7 @@ static const struct route_map_rule_cmd route_match_ipv6_next_hop_address_cmd = {
route_match_ipv6_next_hop_address_free
};
-/* `match ip next-hop IP_ADDRESS' */
+/* `match ip next-hop address IP_ADDRESS' */
static enum route_map_cmd_result_t
route_match_ipv4_next_hop(void *rule, const struct prefix *prefix, void *object)
diff --git a/doc/user/basic.rst b/doc/user/basic.rst
index 4a64d8f949..254dad8303 100644
--- a/doc/user/basic.rst
+++ b/doc/user/basic.rst
@@ -294,6 +294,12 @@ Basic Config Commands
log files to quickly balloon in size. Remember to disable backtraces
when they're no longer needed.
+.. clicmd:: debug routemap [detail]
+
+ This command turns on debugging of routemaps. When detail is specified
+ more data is provided to the operator about the reasoning about what
+ is going on in the routemap code.
+
.. clicmd:: service password-encryption
Encrypt password.
diff --git a/lib/routemap.c b/lib/routemap.c
index f56e6a6122..4b9033594c 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -36,6 +36,8 @@
#include "json.h"
#include "jhash.h"
+#include "lib/routemap_clippy.c"
+
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map");
DEFINE_MTYPE(LIB, ROUTE_MAP_NAME, "Route map name");
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX, "Route map index");
@@ -613,7 +615,8 @@ 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 bool rmap_debug;
+
+uint32_t rmap_debug;
/* New route map allocation. Please note route map's name must be
specified. */
@@ -681,7 +684,7 @@ static struct route_map *route_map_add(const char *name)
if (!map->ipv6_prefix_table)
map->ipv6_prefix_table = route_table_init();
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Add route-map %s", name);
return map;
}
@@ -701,7 +704,7 @@ static void route_map_free_map(struct route_map *map)
while ((index = map->head) != NULL)
route_map_index_delete(index, 0);
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Deleting route-map %s", map->name);
list = &route_map_master;
@@ -1132,7 +1135,7 @@ void route_map_index_delete(struct route_map_index *index, int notify)
QOBJ_UNREG(index);
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Deleting route-map %s sequence %d",
index->map->name, index->pref);
@@ -1243,7 +1246,7 @@ route_map_index_add(struct route_map *map, enum route_map_type type, int pref)
route_map_notify_dependencies(map->name, RMAP_EVENT_CALL_ADDED);
}
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Route-map %s add sequence %d, type: %s",
map->name, pref, route_map_type_str(type));
@@ -2580,13 +2583,13 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
&match_ret);
if (index) {
index->applied++;
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug(
"Best match route-map: %s, sequence: %d for pfx: %pFX, result: %s",
map->name, index->pref, prefix,
route_map_cmd_result_str(match_ret));
} else {
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug(
"No best match sequence for pfx: %pFX in route-map: %s, result: %s",
prefix, map->name,
@@ -2612,7 +2615,7 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
/* Apply this index. */
match_ret = route_map_apply_match(&index->match_list,
prefix, match_object);
- if (rmap_debug) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP)) {
zlog_debug(
"Route-map: %s, sequence: %d, prefix: %pFX, result: %s",
map->name, index->pref, prefix,
@@ -2725,7 +2728,7 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
}
route_map_apply_end:
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Route-map: %s, prefix: %pFX, result: %s",
(map ? map->name : "null"), prefix,
route_map_result_str(ret));
@@ -2780,7 +2783,7 @@ static void route_map_clear_reference(struct hash_bucket *bucket, void *arg)
tmp_dep_data.rname = arg;
dep_data = hash_release(dep->dep_rmap_hash, &tmp_dep_data);
if (dep_data) {
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Clearing reference for %s to %s count: %d",
dep->dep_name, tmp_dep_data.rname,
dep_data->refcnt);
@@ -2800,7 +2803,7 @@ static void route_map_clear_all_references(char *rmap_name)
{
int i;
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Clearing references for %s", rmap_name);
for (i = 1; i < ROUTE_MAP_DEP_MAX; i++) {
@@ -2876,7 +2879,7 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
case RMAP_EVENT_LLIST_ADDED:
case RMAP_EVENT_CALL_ADDED:
case RMAP_EVENT_FILTER_ADDED:
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Adding dependency for filter %s in route-map %s",
dep_name, rmap_name);
dep = (struct route_map_dep *)hash_get(
@@ -2905,7 +2908,7 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
case RMAP_EVENT_LLIST_DELETED:
case RMAP_EVENT_CALL_DELETED:
case RMAP_EVENT_FILTER_DELETED:
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
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);
@@ -2959,7 +2962,7 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
}
if (dep) {
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
hash_iterate(dep->dep_rmap_hash,
route_map_print_dependency, dname);
}
@@ -3031,7 +3034,7 @@ static void route_map_process_dependency(struct hash_bucket *bucket, void *data)
dep_data = bucket->data;
rmap_name = dep_data->rname;
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Notifying %s of dependency", rmap_name);
if (route_map_master.event_hook)
(*route_map_master.event_hook)(rmap_name);
@@ -3079,7 +3082,7 @@ void route_map_notify_dependencies(const char *affected_name,
if (!dep->this_hash)
dep->this_hash = upd8_hash;
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
zlog_debug("Filter %s updated", dep->dep_name);
hash_iterate(dep->dep_rmap_hash, route_map_process_dependency,
(void *)event);
@@ -3157,24 +3160,34 @@ DEFUN (rmap_show_unused,
return vty_show_unused_route_map(vty);
}
-DEFUN (debug_rmap,
+DEFPY (debug_rmap,
debug_rmap_cmd,
- "debug route-map",
+ "debug route-map [detail]$detail",
DEBUG_STR
- "Debug option set for route-maps\n")
+ "Debug option set for route-maps\n"
+ "Detailed output\n")
{
- rmap_debug = true;
+ if (!detail)
+ SET_FLAG(rmap_debug, DEBUG_ROUTEMAP);
+ else
+ SET_FLAG(rmap_debug, DEBUG_ROUTEMAP | DEBUG_ROUTEMAP_DETAIL);
+
return CMD_SUCCESS;
}
-DEFUN (no_debug_rmap,
+DEFPY (no_debug_rmap,
no_debug_rmap_cmd,
- "no debug route-map",
+ "no debug route-map [detail]$detail",
NO_STR
DEBUG_STR
- "Debug option set for route-maps\n")
+ "Debug option set for route-maps\n"
+ "Detailed output\n")
{
- rmap_debug = false;
+ if (!detail)
+ UNSET_FLAG(rmap_debug, DEBUG_ROUTEMAP);
+ else
+ UNSET_FLAG(rmap_debug, DEBUG_ROUTEMAP | DEBUG_ROUTEMAP_DETAIL);
+
return CMD_SUCCESS;
}
@@ -3189,7 +3202,7 @@ static struct cmd_node rmap_debug_node = {
void route_map_show_debug(struct vty *vty)
{
- if (rmap_debug)
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP))
vty_out(vty, "debug route-map\n");
}
@@ -3198,7 +3211,7 @@ static int rmap_config_write_debug(struct vty *vty)
{
int write = 0;
- if (rmap_debug) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP)) {
vty_out(vty, "debug route-map\n");
write++;
}
@@ -3400,7 +3413,7 @@ void route_map_init(void)
8, route_map_dep_hash_make_key, route_map_dep_hash_cmp,
"Route Map Dep Hash");
- rmap_debug = false;
+ UNSET_FLAG(rmap_debug, DEBUG_ROUTEMAP);
route_map_cli_init();
diff --git a/lib/routemap.h b/lib/routemap.h
index 9c78e15735..ddcb8f2ddb 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -37,6 +37,10 @@ DECLARE_MTYPE(ROUTE_MAP_NAME);
DECLARE_MTYPE(ROUTE_MAP_RULE);
DECLARE_MTYPE(ROUTE_MAP_COMPILED);
+#define DEBUG_ROUTEMAP 0x01
+#define DEBUG_ROUTEMAP_DETAIL 0x02
+extern uint32_t rmap_debug;
+
/* Route map's type. */
enum route_map_type { RMAP_PERMIT, RMAP_DENY, RMAP_ANY };
diff --git a/lib/subdir.am b/lib/subdir.am
index 18e9825a7a..dcff31ebba 100644
--- a/lib/subdir.am
+++ b/lib/subdir.am
@@ -152,6 +152,7 @@ clippy_scan += \
lib/nexthop_group.c \
lib/northbound_cli.c \
lib/plist.c \
+ lib/routemap.c \
lib/routemap_cli.c \
lib/thread.c \
lib/vty.c \
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index b1216626c4..63460c773e 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -134,8 +134,13 @@ route_match_ip_nexthop(void *rule, const struct prefix *prefix, void *object)
p.prefixlen = IPV4_MAX_BITLEN;
alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
@@ -177,8 +182,13 @@ route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
p.prefixlen = IPV4_MAX_BITLEN;
plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
@@ -249,8 +259,13 @@ route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
/* struct prefix_ipv4 match; */
alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
@@ -285,8 +300,14 @@ route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
struct prefix_list *plist;
plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
+
return RMAP_NOMATCH;
+ }
return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 4a8fe938ed..32d28f8002 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -118,13 +118,15 @@ static void zebra_redistribute(struct zserv *client, int type,
RNODE_FOREACH_RE (rn, newre) {
if (IS_ZEBRA_DEBUG_RIB)
zlog_debug(
- "%s: client %s %pRN(%u:%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
+ "%s: client %s %pRN(%u:%u) checking: selected=%d, type=%s, instance=%u, distance=%d, metric=%d zebra_check_addr=%d",
__func__,
zebra_route_string(client->proto), rn,
vrf_id, newre->instance,
!!CHECK_FLAG(newre->flags,
ZEBRA_FLAG_SELECTED),
- newre->type, newre->distance,
+ zebra_route_string(newre->type),
+ newre->instance,
+ newre->distance,
newre->metric,
zebra_check_addr(&rn->p));
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 5f307f95e3..8f24404a44 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -1055,8 +1055,13 @@ route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object)
return RMAP_NOMATCH;
}
alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
@@ -1113,8 +1118,13 @@ route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
return RMAP_NOMATCH;
}
plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
@@ -1149,8 +1159,13 @@ route_match_address(afi_t afi, void *rule, const struct prefix *prefix,
struct access_list *alist;
alist = access_list_lookup(afi, (char *)rule);
- if (alist == NULL)
+ if (alist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Access-List Specified: %s does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH
: RMAP_MATCH);
@@ -1206,8 +1221,13 @@ route_match_address_prefix_list(void *rule, const struct prefix *prefix,
struct prefix_list *plist;
plist = prefix_list_lookup(afi, (char *)rule);
- if (plist == NULL)
+ if (plist == NULL) {
+ if (CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP_DETAIL))
+ zlog_debug(
+ "%s: Prefix List %s specified does not exist defaulting to NO_MATCH",
+ __func__, (char *)rule);
return RMAP_NOMATCH;
+ }
return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH
: RMAP_MATCH);