diff options
author | Dmytro Shytyi <dmytro.shytyi@6wind.com> | 2023-08-03 18:35:53 +0200 |
---|---|---|
committer | Dmytro Shytyi <dmytro.shytyi@6wind.com> | 2023-09-20 15:07:15 +0200 |
commit | 857945ad1a8aff9077f84a5b8db7318852330725 (patch) | |
tree | 83b298e0876f6bd76498cfd46168cf8e481406be /lib/nexthop.c | |
parent | lib: nexthop, free the multiple seg6_segs (diff) | |
download | frr-857945ad1a8aff9077f84a5b8db7318852330725.tar.xz frr-857945ad1a8aff9077f84a5b8db7318852330725.zip |
lib: update del_srv6_seg6_local to handle seg6_segs
Adapt de_srv6_seg6local to handle seg6_segs structure.
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
Diffstat (limited to 'lib/nexthop.c')
-rw-r--r-- | lib/nexthop.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index c27c0d555..e19c1d680 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -362,7 +362,7 @@ struct nexthop *nexthop_new(void) * The linux kernel does some weird stuff with adding +1 to * all nexthop weights it gets over netlink. * To handle this, just default everything to 1 right from - * from the beginning so we don't have to special case + * the beginning so we don't have to special case * default weights in the linux netlink code. * * 1 should be a valid on all platforms anyway. @@ -568,8 +568,16 @@ void nexthop_del_srv6_seg6local(struct nexthop *nexthop) if (!nexthop->nh_srv6) return; + if (nexthop->nh_srv6->seg6local_action == ZEBRA_SEG6_LOCAL_ACTION_UNSPEC) + return; + nexthop->nh_srv6->seg6local_action = ZEBRA_SEG6_LOCAL_ACTION_UNSPEC; + if (nexthop->nh_srv6->seg6_segs && + (nexthop->nh_srv6->seg6_segs->num_segs == 0 || + sid_zero(nexthop->nh_srv6->seg6_segs))) + XFREE(MTYPE_NH_SRV6, nexthop->nh_srv6->seg6_segs); + if (nexthop->nh_srv6->seg6_segs == NULL) XFREE(MTYPE_NH_SRV6, nexthop->nh_srv6); } |