return act;
}
-static int parse_encap_seg6(struct rtattr *tb, struct in6_addr *segs)
+static int parse_encap_seg6(struct rtattr *tb, struct in6_addr *segs,
+ enum srv6_headend_behavior *encap_behavior)
{
struct rtattr *tb_encap[SEG6_IPTUNNEL_MAX + 1] = {};
struct seg6_iptunnel_encap *ipt = NULL;
ipt = (struct seg6_iptunnel_encap *)
RTA_DATA(tb_encap[SEG6_IPTUNNEL_SRH]);
+ switch (ipt->mode) {
+ case SEG6_IPTUN_MODE_INLINE:
+ *encap_behavior = SRV6_HEADEND_BEHAVIOR_H_INSERT;
+ break;
+ case SEG6_IPTUN_MODE_ENCAP:
+ *encap_behavior = SRV6_HEADEND_BEHAVIOR_H_ENCAPS;
+ break;
+ case SEG6_IPTUN_MODE_ENCAP_RED:
+ *encap_behavior = SRV6_HEADEND_BEHAVIOR_H_ENCAPS_RED;
+ break;
+ case SEG6_IPTUN_MODE_L2ENCAP:
+ *encap_behavior = SRV6_HEADEND_BEHAVIOR_H_ENCAPS_L2;
+ break;
+ case SEG6_IPTUN_MODE_L2ENCAP_RED:
+ *encap_behavior = SRV6_HEADEND_BEHAVIOR_H_ENCAPS_L2_RED;
+ break;
+ }
+
for (i = ipt->srh[0].first_segment; i >= 0; i--)
memcpy(&segs[i], &ipt->srh[0].segments[i],
sizeof(struct in6_addr));
struct seg6local_context seg6l_ctx = {};
struct in6_addr segs[SRV6_MAX_SIDS] = {};
int num_segs = 0;
+ enum srv6_headend_behavior srv6_encap_behavior = SRV6_HEADEND_BEHAVIOR_H_ENCAPS;
vrf_id_t nh_vrf_id = vrf_id;
size_t sz = (afi == AFI_IP) ? 4 : 16;
if (tb[RTA_ENCAP] && tb[RTA_ENCAP_TYPE]
&& *(uint16_t *)RTA_DATA(tb[RTA_ENCAP_TYPE])
== LWTUNNEL_ENCAP_SEG6) {
- num_segs = parse_encap_seg6(tb[RTA_ENCAP], segs);
+ num_segs = parse_encap_seg6(tb[RTA_ENCAP], segs, &srv6_encap_behavior);
}
if (rtm->rtm_flags & RTNH_F_ONLINK)
struct seg6local_context seg6l_ctx = {};
struct in6_addr segs[SRV6_MAX_SIDS] = {};
int num_segs = 0;
+ enum srv6_headend_behavior srv6_encap_behavior = SRV6_HEADEND_BEHAVIOR_H_ENCAPS;
struct rtattr *rtnh_tb[RTA_MAX + 1] = {};
int len = RTA_PAYLOAD(tb[RTA_MULTIPATH]);
if (rtnh_tb[RTA_ENCAP] && rtnh_tb[RTA_ENCAP_TYPE]
&& *(uint16_t *)RTA_DATA(rtnh_tb[RTA_ENCAP_TYPE])
== LWTUNNEL_ENCAP_SEG6) {
- num_segs = parse_encap_seg6(rtnh_tb[RTA_ENCAP],
- segs);
+ num_segs = parse_encap_seg6(rtnh_tb[RTA_ENCAP], segs,
+ &srv6_encap_behavior);
}
}