mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 18:04:03 +00:00
ospf6: fix crash on shutdown
The crash is sometimes reproduced by all_protocol_startup topotest. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
f5f26b8fca
commit
1fa5858735
@ -292,28 +292,28 @@ void ospf6_add_nexthop(struct list *nh_list, int ifindex, struct in6_addr *addr)
|
|||||||
|
|
||||||
void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
||||||
struct zapi_nexthop nexthops[],
|
struct zapi_nexthop nexthops[],
|
||||||
int entries)
|
int entries, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct ospf6_nexthop *nh;
|
struct ospf6_nexthop *nh;
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
struct interface *ifp;
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (route) {
|
if (route) {
|
||||||
i = 0;
|
i = 0;
|
||||||
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
|
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
|
||||||
ifp = if_lookup_by_index_all_vrf(nh->ifindex);
|
|
||||||
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
|
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
|
||||||
|
const char *ifname;
|
||||||
inet_ntop(AF_INET6, &nh->address, buf,
|
inet_ntop(AF_INET6, &nh->address, buf,
|
||||||
sizeof(buf));
|
sizeof(buf));
|
||||||
|
ifname = ifindex2ifname(nh->ifindex, vrf_id);
|
||||||
zlog_debug(" nexthop: %s%%%.*s(%d)", buf,
|
zlog_debug(" nexthop: %s%%%.*s(%d)", buf,
|
||||||
IFNAMSIZ, ifp->name, nh->ifindex);
|
IFNAMSIZ, ifname, nh->ifindex);
|
||||||
}
|
}
|
||||||
if (i >= entries)
|
if (i >= entries)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nexthops[i].vrf_id = ifp->vrf_id;
|
nexthops[i].vrf_id = vrf_id;
|
||||||
nexthops[i].ifindex = nh->ifindex;
|
nexthops[i].ifindex = nh->ifindex;
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED(&nh->address)) {
|
if (!IN6_IS_ADDR_UNSPECIFIED(&nh->address)) {
|
||||||
nexthops[i].gate.ipv6 = nh->address;
|
nexthops[i].gate.ipv6 = nh->address;
|
||||||
|
@ -280,7 +280,7 @@ extern int ospf6_route_cmp_nexthops(struct ospf6_route *a,
|
|||||||
struct ospf6_route *b);
|
struct ospf6_route *b);
|
||||||
extern void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
extern void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
||||||
struct zapi_nexthop nexthops[],
|
struct zapi_nexthop nexthops[],
|
||||||
int entries);
|
int entries, vrf_id_t vrf_id);
|
||||||
extern int ospf6_route_get_first_nh_index(struct ospf6_route *route);
|
extern int ospf6_route_get_first_nh_index(struct ospf6_route *route);
|
||||||
|
|
||||||
/* Hide abstraction of nexthop implementation in route from outsiders */
|
/* Hide abstraction of nexthop implementation in route from outsiders */
|
||||||
|
@ -344,7 +344,8 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
|
|||||||
api.prefix = *dest;
|
api.prefix = *dest;
|
||||||
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
||||||
api.nexthop_num = MIN(nhcount, MULTIPATH_NUM);
|
api.nexthop_num = MIN(nhcount, MULTIPATH_NUM);
|
||||||
ospf6_route_zebra_copy_nexthops(request, api.nexthops, api.nexthop_num);
|
ospf6_route_zebra_copy_nexthops(request, api.nexthops, api.nexthop_num,
|
||||||
|
api.vrf_id);
|
||||||
SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
|
SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
|
||||||
api.metric = (request->path.metric_type == 2 ? request->path.u.cost_e2
|
api.metric = (request->path.metric_type == 2 ? request->path.u.cost_e2
|
||||||
: request->path.cost);
|
: request->path.cost);
|
||||||
|
Loading…
Reference in New Issue
Block a user