XFREE(MTYPE_NH_SRV6, nexthop->nh_srv6);
}
-void nexthop_add_srv6_seg6(struct nexthop *nexthop, const struct in6_addr *segs,
- int num_segs)
+void nexthop_add_srv6_seg6(struct nexthop *nexthop, const struct in6_addr *segs, int num_segs,
+ enum srv6_headend_behavior encap_behavior)
{
int i;
for (i = 0; i < num_segs; i++)
memcpy(&nexthop->nh_srv6->seg6_segs->seg[i], &segs[i],
sizeof(struct in6_addr));
+
+ nexthop->nh_srv6->seg6_segs->encap_behavior = encap_behavior;
}
void nexthop_del_srv6_seg6(struct nexthop *nexthop)
if (nexthop->nh_srv6->seg6_segs &&
nexthop->nh_srv6->seg6_segs->num_segs &&
!sid_zero(nexthop->nh_srv6->seg6_segs))
- nexthop_add_srv6_seg6(copy,
- &nexthop->nh_srv6->seg6_segs->seg[0],
- nexthop->nh_srv6->seg6_segs
- ->num_segs);
+ nexthop_add_srv6_seg6(copy, &nexthop->nh_srv6->seg6_segs->seg[0],
+ nexthop->nh_srv6->seg6_segs->num_segs,
+ nexthop->nh_srv6->seg6_segs->encap_behavior);
}
}
void nexthop_add_srv6_seg6local(struct nexthop *nexthop, uint32_t action,
const struct seg6local_context *ctx);
void nexthop_del_srv6_seg6local(struct nexthop *nexthop);
-void nexthop_add_srv6_seg6(struct nexthop *nexthop, const struct in6_addr *seg,
- int num_segs);
+void nexthop_add_srv6_seg6(struct nexthop *nexthop, const struct in6_addr *seg, int num_segs,
+ enum srv6_headend_behavior encap_behavior);
void nexthop_del_srv6_seg6(struct nexthop *nexthop);
/*
&znh->seg6local_ctx);
if (znh->seg_num && !sid_zero_ipv6(znh->seg6_segs))
- nexthop_add_srv6_seg6(n, &znh->seg6_segs[0], znh->seg_num);
+ nexthop_add_srv6_seg6(n, &znh->seg6_segs[0], znh->seg_num, znh->srv6_encap_behavior);
return n;
}
sg.r.nhop.gate.ipv6 = seg6_nh6;
sg.r.nhop.vrf_id = vrf->vrf_id;
sg.r.nhop_group.nexthop = &sg.r.nhop;
- nexthop_add_srv6_seg6(&sg.r.nhop, &seg6_seg, 1);
+ nexthop_add_srv6_seg6(&sg.r.nhop, &seg6_seg, 1, SRV6_HEADEND_BEHAVIOR_H_ENCAPS);
sg.r.vrf_id = vrf->vrf_id;
sharp_install_routes_helper(&prefix, sg.r.vrf_id, sg.r.inst, 0,
sg.r.nhop_group.nexthop = &sg.r.nhop;
seg_list[0] = seg6_seg1;
seg_list[1] = seg6_seg2;
- nexthop_add_srv6_seg6(&sg.r.nhop, p_seg_list, 2);
+ nexthop_add_srv6_seg6(&sg.r.nhop, p_seg_list, 2, SRV6_HEADEND_BEHAVIOR_H_ENCAPS);
sg.r.vrf_id = vrf->vrf_id;
sharp_install_routes_helper(&sg.r.orig_prefix, sg.r.vrf_id, sg.r.inst, 0, &sg.r.nhop_group,
nexthop_add_srv6_seg6local(&nh, seg6l_act, &seg6l_ctx);
if (num_segs)
- nexthop_add_srv6_seg6(&nh, segs, num_segs);
+ nexthop_add_srv6_seg6(&nh, segs, num_segs, srv6_encap_behavior);
return nh;
}
&seg6l_ctx);
if (num_segs)
- nexthop_add_srv6_seg6(nh, segs, num_segs);
+ nexthop_add_srv6_seg6(nh, segs, num_segs, srv6_encap_behavior);
if (rtnh->rtnh_flags & RTNH_F_ONLINK)
SET_FLAG(nh->flags, NEXTHOP_FLAG_ONLINK);
if (IS_ZEBRA_DEBUG_RECV)
zlog_debug("%s: adding seg6", __func__);
- nexthop_add_srv6_seg6(nexthop, &api_nh->seg6_segs[0],
- api_nh->seg_num);
+ nexthop_add_srv6_seg6(nexthop, &api_nh->seg6_segs[0], api_nh->seg_num,
+ api_nh->srv6_encap_behavior);
}
if (IS_ZEBRA_DEBUG_RECV) {
&nexthop->nh_srv6
->seg6local_ctx);
if (nexthop->nh_srv6->seg6_segs)
- nexthop_add_srv6_seg6(resolved_hop,
- &nexthop->nh_srv6->seg6_segs->seg[0],
- nexthop->nh_srv6->seg6_segs
- ->num_segs);
+ nexthop_add_srv6_seg6(resolved_hop, &nexthop->nh_srv6->seg6_segs->seg[0],
+ nexthop->nh_srv6->seg6_segs->num_segs,
+ nexthop->nh_srv6->seg6_segs->encap_behavior);
}
resolved_hop->rparent = nexthop;