mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 17:01:49 +00:00
commit
650e74d71a
@ -45,9 +45,6 @@ struct route_entry {
|
||||
/* Nexthop structure */
|
||||
struct nexthop *nexthop;
|
||||
|
||||
/* Refrence count. */
|
||||
unsigned long refcnt;
|
||||
|
||||
/* Tag */
|
||||
route_tag_t tag;
|
||||
|
||||
|
@ -491,17 +491,26 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
|
||||
size_t sz = (afi == AFI_IP) ? 4 : 16;
|
||||
|
||||
memset(&nh, 0, sizeof(nh));
|
||||
if (index && !gate)
|
||||
nh.type = NEXTHOP_TYPE_IFINDEX;
|
||||
else if (index && gate)
|
||||
nh.type = (afi == AFI_IP)
|
||||
? NEXTHOP_TYPE_IPV4_IFINDEX
|
||||
: NEXTHOP_TYPE_IPV6_IFINDEX;
|
||||
else if (!index && gate)
|
||||
nh.type = (afi == AFI_IP) ? NEXTHOP_TYPE_IPV4
|
||||
if (bh_type == BLACKHOLE_UNSPEC) {
|
||||
if (index && !gate)
|
||||
nh.type = NEXTHOP_TYPE_IFINDEX;
|
||||
else if (index && gate)
|
||||
nh.type =
|
||||
(afi == AFI_IP)
|
||||
? NEXTHOP_TYPE_IPV4_IFINDEX
|
||||
: NEXTHOP_TYPE_IPV6_IFINDEX;
|
||||
else if (!index && gate)
|
||||
nh.type = (afi == AFI_IP)
|
||||
? NEXTHOP_TYPE_IPV4
|
||||
: NEXTHOP_TYPE_IPV6;
|
||||
else
|
||||
else {
|
||||
nh.type = NEXTHOP_TYPE_BLACKHOLE;
|
||||
nh.bh_type = BLACKHOLE_UNSPEC;
|
||||
}
|
||||
} else {
|
||||
nh.type = NEXTHOP_TYPE_BLACKHOLE;
|
||||
nh.bh_type = bh_type;
|
||||
}
|
||||
nh.ifindex = index;
|
||||
if (gate)
|
||||
memcpy(&nh.gate, gate, sz);
|
||||
|
@ -2061,10 +2061,9 @@ void _route_entry_dump(const char *func, union prefixconstptr pp,
|
||||
is_srcdst ? prefix2str(src_pp, srcaddr, sizeof(srcaddr))
|
||||
: "",
|
||||
re->vrf_id);
|
||||
zlog_debug(
|
||||
"%s: refcnt == %lu, uptime == %lu, type == %u, instance == %d, table == %d",
|
||||
func, re->refcnt, (unsigned long)re->uptime, re->type,
|
||||
re->instance, re->table);
|
||||
zlog_debug("%s: uptime == %lu, type == %u, instance == %d, table == %d",
|
||||
func, (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);
|
||||
@ -2335,12 +2334,6 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
|
||||
&& rtnh->type == NEXTHOP_TYPE_IFINDEX && nh) {
|
||||
if (rtnh->ifindex != nh->ifindex)
|
||||
continue;
|
||||
if (re->refcnt) {
|
||||
re->refcnt--;
|
||||
route_unlock_node(rn);
|
||||
route_unlock_node(rn);
|
||||
return;
|
||||
}
|
||||
same = re;
|
||||
break;
|
||||
}
|
||||
@ -2476,13 +2469,16 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
|
||||
break;
|
||||
}
|
||||
/* Duplicate system route comes in. */
|
||||
else if ((rtnh = re->nexthop)
|
||||
&& rtnh->type == NEXTHOP_TYPE_IFINDEX
|
||||
&& rtnh->ifindex == nh->ifindex
|
||||
&& !CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) {
|
||||
re->refcnt++;
|
||||
rtnh = re->nexthop;
|
||||
if (nexthop_same_no_recurse(rtnh, nh))
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Nexthop is different. Remove the old route unless it's
|
||||
* a link-local route.
|
||||
*/
|
||||
else if (afi != AFI_IP6
|
||||
|| !IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6))
|
||||
same = re;
|
||||
}
|
||||
|
||||
/* Allocate new re structure. */
|
||||
|
@ -402,8 +402,6 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
|
||||
}
|
||||
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
|
||||
vty_out(vty, ", best");
|
||||
if (re->refcnt)
|
||||
vty_out(vty, ", refcnt %ld", re->refcnt);
|
||||
vty_out(vty, "\n");
|
||||
|
||||
if (re->type == ZEBRA_ROUTE_RIP || re->type == ZEBRA_ROUTE_OSPF
|
||||
|
Loading…
Reference in New Issue
Block a user