mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 22:37:49 +00:00
lib: Note old ifindex on shutdown
If we have an interface configured in a daemon on shutdown store the old ifindex value for retrieval on when it is possibly recreated. This is especially important for nexthop groups as that we had at one point in time the ability to restore the configuration but it was lost when we started deleting all deleted interfaces. We need the nexthop group subsystem to also mark that it has configured an interface. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
7cbdabffb6
commit
e7ff02539c
2
lib/if.c
2
lib/if.c
@ -188,7 +188,9 @@ void if_destroy_via_zapi(struct interface *ifp)
|
||||
if (ifp_master.destroy_hook)
|
||||
(*ifp_master.destroy_hook)(ifp);
|
||||
|
||||
ifp->oldifindex = ifp->ifindex;
|
||||
if_set_index(ifp, IFINDEX_INTERNAL);
|
||||
|
||||
if (!ifp->configured)
|
||||
if_delete(&ifp);
|
||||
}
|
||||
|
2
lib/if.h
2
lib/if.h
@ -224,6 +224,8 @@ struct interface {
|
||||
not work as expected.
|
||||
*/
|
||||
ifindex_t ifindex;
|
||||
ifindex_t oldifindex;
|
||||
|
||||
/*
|
||||
* ifindex of parent interface, if any
|
||||
*/
|
||||
|
@ -940,6 +940,12 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,
|
||||
nhg_hooks.add_nexthop(nhgc, nh);
|
||||
}
|
||||
|
||||
if (intf) {
|
||||
struct interface *ifp = if_lookup_by_name_all_vrf(intf);
|
||||
|
||||
if (ifp)
|
||||
ifp->configured = true;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1242,6 +1248,7 @@ void nexthop_group_interface_state_change(struct interface *ifp,
|
||||
if (ifp->ifindex != nhop.ifindex)
|
||||
continue;
|
||||
|
||||
ifp->configured = true;
|
||||
nh = nexthop_new();
|
||||
|
||||
memcpy(nh, &nhop, sizeof(nhop));
|
||||
|
@ -2068,7 +2068,7 @@ static void zebra_interface_if_set_value(struct stream *s,
|
||||
uint8_t link_params_status = 0;
|
||||
ifindex_t old_ifindex, new_ifindex;
|
||||
|
||||
old_ifindex = ifp->ifindex;
|
||||
old_ifindex = ifp->oldifindex;
|
||||
/* Read interface's index. */
|
||||
STREAM_GETL(s, new_ifindex);
|
||||
if_set_index(ifp, new_ifindex);
|
||||
|
Loading…
Reference in New Issue
Block a user