Merge pull request #3699 from donaldsharp/zebra_rib_debugs

Zebra Respect my authority
This commit is contained in:
David Lamparter 2019-01-31 01:51:52 +01:00 committed by GitHub
commit 19b336d343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 34 deletions

View File

@ -159,10 +159,10 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
zlog_debug( zlog_debug(
"%u:%s: Redist update re %p (type %d), old %p (type %d)", "%u:%s: Redist update re %p (%s), old %p (%s)",
re->vrf_id, prefix2str(p, buf, sizeof(buf)), re->vrf_id, prefix2str(p, buf, sizeof(buf)),
re, re->type, prev_re, re, zebra_route_string(re->type), prev_re,
prev_re ? prev_re->type : -1); prev_re ? zebra_route_string(prev_re->type) : "None");
} }
afi = family2afi(p->family); afi = family2afi(p->family);
@ -229,8 +229,9 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
inet_ntop(p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN); inet_ntop(p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
zlog_debug("%u:%s/%d: Redist delete re %p (type %d)", zlog_debug("%u:%s/%d: Redist delete re %p (%s)",
re->vrf_id, buf, p->prefixlen, re, re->type); re->vrf_id, buf, p->prefixlen, re,
zebra_route_string(re->type));
} }
/* Add DISTANCE_INFINITY check. */ /* Add DISTANCE_INFINITY check. */

View File

@ -556,6 +556,9 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
parse_encap_mpls(tb[RTA_ENCAP], labels); parse_encap_mpls(tb[RTA_ENCAP], labels);
} }
if (rtm->rtm_flags & RTNH_F_ONLINK)
SET_FLAG(nh.flags, NEXTHOP_FLAG_ONLINK);
if (num_labels) if (num_labels)
nexthop_add_labels(&nh, ZEBRA_LSP_STATIC, nexthop_add_labels(&nh, ZEBRA_LSP_STATIC,
num_labels, labels); num_labels, labels);
@ -663,6 +666,10 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
nexthop_add_labels(nh, ZEBRA_LSP_STATIC, nexthop_add_labels(nh, ZEBRA_LSP_STATIC,
num_labels, labels); num_labels, labels);
if (nh && (rtnh->rtnh_flags & RTNH_F_ONLINK))
SET_FLAG(nh->flags,
NEXTHOP_FLAG_ONLINK);
if (rtnh->rtnh_len == 0) if (rtnh->rtnh_len == 0)
break; break;

View File

@ -437,6 +437,14 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP)) if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP))
return 1; return 1;
/*
* If the kernel has sent us a route, then
* by golly gee whiz it's a good route.
*/
if (re->type == ZEBRA_ROUTE_KERNEL ||
re->type == ZEBRA_ROUTE_SYSTEM)
return 1;
/* Skip nexthops that have been filtered out due to route-map */ /* Skip nexthops that have been filtered out due to route-map */
/* The nexthops are specific to this route and so the same */ /* The nexthops are specific to this route and so the same */
/* nexthop for a different route may not have this flag set */ /* nexthop for a different route may not have this flag set */
@ -1266,8 +1274,9 @@ static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
char buf[SRCDEST2STR_BUFFER]; char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf)); srcdest_rnode2str(rn, buf, sizeof(buf));
zlog_debug("%u:%s: Adding route rn %p, re %p (type %d)", zlog_debug("%u:%s: Adding route rn %p, re %p (%s)",
zvrf_id(zvrf), buf, rn, new, new->type); zvrf_id(zvrf), buf, rn, new,
zebra_route_string(new->type));
} }
/* If labeled-unicast route, install transit LSP. */ /* If labeled-unicast route, install transit LSP. */
@ -1292,8 +1301,9 @@ static void rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
char buf[SRCDEST2STR_BUFFER]; char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf)); srcdest_rnode2str(rn, buf, sizeof(buf));
zlog_debug("%u:%s: Deleting route rn %p, re %p (type %d)", zlog_debug("%u:%s: Deleting route rn %p, re %p (%s)",
zvrf_id(zvrf), buf, rn, old, old->type); zvrf_id(zvrf), buf, rn, old,
zebra_route_string(old->type));
} }
/* If labeled-unicast route, uninstall transit LSP. */ /* If labeled-unicast route, uninstall transit LSP. */
@ -1360,15 +1370,16 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
srcdest_rnode2str(rn, buf, sizeof(buf)); srcdest_rnode2str(rn, buf, sizeof(buf));
if (new != old) if (new != old)
zlog_debug( zlog_debug(
"%u:%s: Updating route rn %p, re %p (type %d) " "%u:%s: Updating route rn %p, re %p (%s) old %p (%s)",
"old %p (type %d)",
zvrf_id(zvrf), buf, rn, new, zvrf_id(zvrf), buf, rn, new,
new->type, old, old->type); zebra_route_string(new->type),
old,
zebra_route_string(old->type));
else else
zlog_debug( zlog_debug(
"%u:%s: Updating route rn %p, re %p (type %d)", "%u:%s: Updating route rn %p, re %p (%s)",
zvrf_id(zvrf), buf, rn, new, zvrf_id(zvrf), buf, rn, new,
new->type); zebra_route_string(new->type));
} }
/* If labeled-unicast route, uninstall transit LSP. */ /* If labeled-unicast route, uninstall transit LSP. */
@ -1430,15 +1441,16 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
srcdest_rnode2str(rn, buf, sizeof(buf)); srcdest_rnode2str(rn, buf, sizeof(buf));
if (new != old) if (new != old)
zlog_debug( zlog_debug(
"%u:%s: Deleting route rn %p, re %p (type %d) " "%u:%s: Deleting route rn %p, re %p (%s) old %p (%s) - nexthop inactive",
"old %p (type %d) - nexthop inactive",
zvrf_id(zvrf), buf, rn, new, zvrf_id(zvrf), buf, rn, new,
new->type, old, old->type); zebra_route_string(new->type),
old,
zebra_route_string(old->type));
else else
zlog_debug( zlog_debug(
"%u:%s: Deleting route rn %p, re %p (type %d) - nexthop inactive", "%u:%s: Deleting route rn %p, re %p (%s) - nexthop inactive",
zvrf_id(zvrf), buf, rn, new, zvrf_id(zvrf), buf, rn, new,
new->type); zebra_route_string(new->type));
} }
/* If labeled-unicast route, uninstall transit LSP. */ /* If labeled-unicast route, uninstall transit LSP. */
@ -1583,10 +1595,10 @@ static void rib_process(struct route_node *rn)
RNODE_FOREACH_RE_SAFE (rn, re, next) { RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED) if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug( zlog_debug(
"%u:%s: Examine re %p (type %d) status %x flags %x " "%u:%s: Examine re %p (%s) status %x flags %x dist %d metric %d",
"dist %d metric %d", vrf_id, buf, re, zebra_route_string(re->type),
vrf_id, buf, re, re->type, re->status, re->status, re->flags, re->distance,
re->flags, re->distance, re->metric); re->metric);
UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED); UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
@ -2484,9 +2496,9 @@ void rib_delnode(struct route_node *rn, struct route_entry *re)
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
char buf[SRCDEST2STR_BUFFER]; char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf)); srcdest_rnode2str(rn, buf, sizeof(buf));
zlog_debug( zlog_debug("%u:%s: Freeing route rn %p, re %p (%s)",
"%u:%s: Freeing route rn %p, re %p (type %d)", re->vrf_id, buf, rn, re,
re->vrf_id, buf, rn, re, re->type); zebra_route_string(re->type));
} }
rib_unlink(rn, re); rib_unlink(rn, re);
@ -2746,10 +2758,9 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
/* Link new re to node.*/ /* Link new re to node.*/
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
rnode_debug( rnode_debug(rn, re->vrf_id,
rn, re->vrf_id, "Inserting route rn %p, re %p (%s) existing %p",
"Inserting route rn %p, re %p (type %d) existing %p", rn, re, zebra_route_string(re->type), same);
(void *)rn, (void *)re, re->type, (void *)same);
if (IS_ZEBRA_DEBUG_RIB_DETAILED) if (IS_ZEBRA_DEBUG_RIB_DETAILED)
route_entry_dump(p, src_p, re); route_entry_dump(p, src_p, re);
@ -2873,10 +2884,10 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
*/ */
if (fib && CHECK_FLAG(flags, ZEBRA_FLAG_SELFROUTE)) { if (fib && CHECK_FLAG(flags, ZEBRA_FLAG_SELFROUTE)) {
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
rnode_debug( rnode_debug(rn, vrf_id,
rn, vrf_id, "rn %p, re %p (%s) was deleted from kernel, adding",
"rn %p, re %p (type %d) was deleted from kernel, adding", rn, fib,
rn, fib, fib->type); zebra_route_string(fib->type));
} }
if (allow_delete) { if (allow_delete) {
UNSET_FLAG(fib->status, ROUTE_ENTRY_INSTALLED); UNSET_FLAG(fib->status, ROUTE_ENTRY_INSTALLED);