diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index d594accf4..b05d037f9 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -2348,7 +2348,8 @@ static int netlink_macfdb_update(struct interface *ifp, vlanid_t vid, * 5549 support, re-install them. */ static void netlink_handle_5549(struct ndmsg *ndm, struct zebra_if *zif, - struct interface *ifp, struct ipaddr *ip) + struct interface *ifp, struct ipaddr *ip, + bool handle_failed) { if (ndm->ndm_family != AF_INET) return; @@ -2359,6 +2360,12 @@ static void netlink_handle_5549(struct ndmsg *ndm, struct zebra_if *zif, if (ipv4_ll.s_addr != ip->ip._v4_addr.s_addr) return; + if (handle_failed && ndm->ndm_state & NUD_FAILED) { + zlog_info("Neighbor Entry for %s has entered a failed state, not reinstalling", + ifp->name); + return; + } + if_nbr_ipv6ll_to_ipv4ll_neigh_update(ifp, &zif->v6_2_v4_ll_addr6, true); } @@ -2409,7 +2416,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) /* if kernel deletes our rfc5549 neighbor entry, re-install it */ if (h->nlmsg_type == RTM_DELNEIGH && (ndm->ndm_state & NUD_PERMANENT)) { - netlink_handle_5549(ndm, zif, ifp, &ip); + netlink_handle_5549(ndm, zif, ifp, &ip, false); if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "\tNeighbor Entry Received is a 5549 entry, finished"); @@ -2417,13 +2424,8 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) } /* if kernel marks our rfc5549 neighbor entry invalid, re-install it */ - if (h->nlmsg_type == RTM_NEWNEIGH && !(ndm->ndm_state & NUD_VALID)) { - if (!(ndm->ndm_state & NUD_FAILED)) - netlink_handle_5549(ndm, zif, ifp, &ip); - else - zlog_info("Neighbor Entry for %s has entered a failed state, not reinstalling", - ifp->name); - } + if (h->nlmsg_type == RTM_NEWNEIGH && !(ndm->ndm_state & NUD_VALID)) + netlink_handle_5549(ndm, zif, ifp, &ip, true); /* The neighbor is present on an SVI. From this, we locate the * underlying diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 555bec959..2df24f75c 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2444,6 +2444,7 @@ void _route_entry_dump(const char *func, union prefixconstptr pp, bool is_srcdst = src_p && src_p->prefixlen; char straddr[PREFIX_STRLEN]; char srcaddr[PREFIX_STRLEN]; + char nhname[PREFIX_STRLEN]; struct nexthop *nexthop; zlog_debug("%s: dumping RE entry %p for %s%s%s vrf %u", func, @@ -2453,12 +2454,12 @@ void _route_entry_dump(const char *func, union prefixconstptr pp, : "", re->vrf_id); zlog_debug("%s: uptime == %lu, type == %u, instance == %d, table == %d", - func, (unsigned long)re->uptime, re->type, re->instance, + straddr, (unsigned long)re->uptime, re->type, re->instance, re->table); zlog_debug( "%s: metric == %u, mtu == %u, distance == %u, flags == %u, status == %u", - func, re->metric, re->mtu, re->distance, re->flags, re->status); - zlog_debug("%s: nexthop_num == %u, nexthop_active_num == %u", func, + straddr, re->metric, re->mtu, re->distance, re->flags, re->status); + zlog_debug("%s: nexthop_num == %u, nexthop_active_num == %u", straddr, re->nexthop_num, re->nexthop_active_num); for (ALL_NEXTHOPS(re->ng, nexthop)) { @@ -2467,27 +2468,27 @@ void _route_entry_dump(const char *func, union prefixconstptr pp, switch (nexthop->type) { case NEXTHOP_TYPE_BLACKHOLE: - sprintf(straddr, "Blackhole"); + sprintf(nhname, "Blackhole"); break; case NEXTHOP_TYPE_IFINDEX: ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id); - sprintf(straddr, "%s", ifp ? ifp->name : "Unknown"); + sprintf(nhname, "%s", ifp ? ifp->name : "Unknown"); break; case NEXTHOP_TYPE_IPV4: /* fallthrough */ case NEXTHOP_TYPE_IPV4_IFINDEX: - inet_ntop(AF_INET, &nexthop->gate, straddr, + inet_ntop(AF_INET, &nexthop->gate, nhname, INET6_ADDRSTRLEN); break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: - inet_ntop(AF_INET6, &nexthop->gate, straddr, + inet_ntop(AF_INET6, &nexthop->gate, nhname, INET6_ADDRSTRLEN); break; } zlog_debug("%s: %s %s[%u] vrf %s(%u) with flags %s%s%s%s%s%s", - func, (nexthop->rparent ? " NH" : "NH"), straddr, + straddr, (nexthop->rparent ? " NH" : "NH"), nhname, nexthop->ifindex, vrf ? vrf->name : "Unknown", nexthop->vrf_id, (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE) @@ -2509,7 +2510,7 @@ void _route_entry_dump(const char *func, union prefixconstptr pp, ? "DUPLICATE " : "")); } - zlog_debug("%s: dump complete", func); + zlog_debug("%s: dump complete", straddr); } /* This is an exported helper to rtm_read() to dump the strange