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0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
73 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
74 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
75 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
76 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
77 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
79 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
93 return format (s,
"SRv6-END-rewrite: src %U dst %U\n\tTEID: 0x%x",
95 clib_net_to_host_u32 (t->
teid));
106 "SRv6-END-rewrite: src %U dst %U\n\tTEID: 0x%x\n\tsr_prefix: %U/%d",
112 #define foreach_srv6_end_v4_error \
113 _(M_GTP4_E_PACKETS, "srv6 End.M.GTP4.E packets") \
114 _(M_GTP4_E_BAD_PACKETS, "srv6 End.M.GTP4.E bad packets")
116 #define foreach_srv6_t_v4_d_error \
117 _(M_GTP4_D_PACKETS, "srv6 T.M.GTP4.D packets") \
118 _(M_GTP4_D_BAD_PACKETS, "srv6 T.M.GTP4.D bad packets")
120 #define foreach_srv6_end_v6_e_error \
121 _(M_GTP6_E_PACKETS, "srv6 End.M.GTP6.E packets") \
122 _(M_GTP6_E_BAD_PACKETS, "srv6 End.M.GTP6.E bad packets")
124 #define foreach_srv6_end_v6_d_error \
125 _(M_GTP6_D_PACKETS, "srv6 End.M.GTP6.D packets") \
126 _(M_GTP6_D_BAD_PACKETS, "srv6 End.M.GTP6.D bad packets")
128 #define foreach_srv6_end_v6_d_di_error \
129 _(M_GTP6_D_DI_PACKETS, "srv6 End.M.GTP6.D.DI packets") \
130 _(M_GTP6_D_DI_BAD_PACKETS, "srv6 End.M.GTP6.D.DI bad packets")
132 #define foreach_srv6_end_v6_dt_error \
133 _(M_GTP6_DT_PACKETS, "srv6 End.M.GTP6.DT packets") \
134 _(M_GTP6_DT_BAD_PACKETS, "srv6 End.M.GTP6.DT bad packets")
136 #define foreach_srv6_t_v4_dt_error \
137 _(M_GTP4_DT_PACKETS, "srv6 T.M.GTP4.DT packets") \
138 _(M_GTP4_DT_BAD_PACKETS, "srv6 T.M.GTP4.DT bad packets")
142 #define _(sym,str) SRV6_END_ERROR_##sym,
150 #define _(sym,str) SRV6_T_ERROR_##sym,
158 #define _(sym,str) SRV6_END_ERROR_##sym,
166 #define _(sym,str) SRV6_END_ERROR_##sym,
174 #define _(sym,str) SRV6_END_ERROR_##sym,
182 #define _(sym,str) SRV6_END_ERROR_##sym,
190 #define _(sym,str) SRV6_T_ERROR_##sym,
197 #define _(sym,string) string,
203 #define _(sym,string) string,
209 #define _(sym,string) string,
215 #define _(sym,string) string,
221 #define _(sym,string) string,
227 #define _(sym,string) string,
233 #define _(sym,string) string,
295 return val[0] ^ val[1] ^ val[2] ^ val[3];
297 return val[0] ^ val[1];
306 val = clib_net_to_host_u16 (tag);
329 u32 good_n = 0, bad_n = 0;
349 ip6_address_t src0, dst0;
407 tag = ip6srv0->
sr.
tag;
419 qfi = dst0.as_u8[
offset + 4];
443 qfi |= dst0.as_u8[
offset + 4] << shift;
444 qfi |= dst0.as_u8[
offset + 5] >> (8 - shift);
500 sizeof (ip6_address_t) *
509 ie_size = sub_tlv->
length;
548 hdr0->
gtpu.
length = clib_host_to_net_u16 (len0);
607 ie_ptr = (
u8 *) ((
u8 *) hdr0 + (hdrlen - ie_size));
639 hdr0->
udp.
length = clib_host_to_net_u16 (len0 +
644 hdr0->
ip4.
length = clib_host_to_net_u16 (len0 +
672 n_left_to_next, bi0, next0);
679 SRV6_END_ERROR_M_GTP4_E_BAD_PACKETS, bad_n);
682 SRV6_END_ERROR_M_GTP4_E_PACKETS, good_n);
684 return frame->n_vectors;
696 u32 good_n = 0, bad_n = 0;
740 if (
ip4->protocol != IP_PROTOCOL_UDP
837 seg.as_u8[
offset + 4] = qfi;
857 dstp[
index] << (8 - shift);
871 seg.as_u8[
offset + 4] |= qfi >> shift;
872 seg.as_u8[
offset + 5] |= qfi << (8 - shift);
882 seqp[
index] >> shift;
884 seqp[
index] << (8 - shift);
892 teidp[
index] >> shift;
894 teidp[
index] << (8 - shift);
903 payload_len = clib_net_to_host_u16 (hdr->
gtpu.
length);
904 if (payload_len != 0)
912 ies = (
u8 *) ((
u8 *) hdr + hdr_len);
934 srcp[
offset] << (8 - shift);
970 hdr_len +=
sizeof (ip6_address_t);
979 hdr_len +=
sizeof (ip6_address_t);
989 tlv_siz = (tlv_siz & ~0x07) + (tlv_siz & 0x07 ? 0x08 : 0x0);
1009 ip6srv->
sr.
length +=
sizeof (ip6_address_t) / 8;
1017 sizeof (ip6_address_t));
1021 ip6srv->
ip.
protocol = IP_PROTOCOL_IPV6_ROUTE;
1030 sizeof (ip6_address_t)) / 8) - 1;
1040 ip6srv->
sr.
length +=
sizeof (ip6_address_t) / 8;
1049 if ((clib_net_to_host_u32
1059 if ((clib_net_to_host_u32
1072 if ((clib_net_to_host_u32
1101 ip6srv->
ip.
protocol = IP_PROTOCOL_IPV6_ROUTE;
1111 ip6srv->
sr.
length =
sizeof (ip6_address_t) / 8;
1118 if ((clib_net_to_host_u32
1128 if ((clib_net_to_host_u32
1141 if ((clib_net_to_host_u32
1180 clib_host_to_net_u16 (len0 + hdr_len -
sizeof (
ip6_header_t));
1190 sizeof (tr->
src.as_u8));
1192 sizeof (tr->
dst.as_u8));
1198 n_left_to_next, bi0, next0);
1205 SRV6_T_ERROR_M_GTP4_D_BAD_PACKETS, bad_n);
1208 SRV6_T_ERROR_M_GTP4_D_PACKETS, good_n);
1210 return frame->n_vectors;
1215 .name =
"srv6-end-m-gtp4-e",.vector_size =
sizeof (
u32),.format_trace =
1227 .name =
"srv6-t-m-gtp4-d",.vector_size =
sizeof (
u32),.format_trace =
1247 u32 good_n = 0, bad_n = 0;
1266 ip6_address_t dst0, src0, seg0;
1284 n_left_to_next -= 1;
1296 tag = ip6srv0->
sr.
tag;
1334 qfi = dst0.as_u8[
offset];
1351 qfi |= dst0.as_u8[
offset] << shift;
1352 qfi |= dst0.as_u8[
offset + 1] >> (8 - shift);
1370 *teid8p = dst0.as_u8[
offset +
index + 1] << shift;
1408 sizeof (ip6_address_t) *
1417 ie_size = sub_tlv->
length;
1446 hdr0->
gtpu.
length = clib_host_to_net_u16 (len0);
1504 ie_ptr = (
u8 *) ((
u8 *) hdr0 + (hdrlen - ie_size));
1510 hdr0->
udp.
length = clib_host_to_net_u16 (len0 +
1516 sizeof (ip6_address_t));
1518 sizeof (ip6_address_t));
1540 sizeof (ip6_address_t));
1542 sizeof (ip6_address_t));
1554 n_left_to_next, bi0, next0);
1561 SRV6_END_ERROR_M_GTP6_E_BAD_PACKETS, bad_n);
1564 SRV6_END_ERROR_M_GTP6_E_PACKETS, good_n);
1566 return frame->n_vectors;
1579 u32 good_n = 0, bad_n = 0;
1601 ip6_address_t seg0, src0;
1625 n_left_to_next -= 1;
1659 seqp = (
u8 *) & seq;
1676 qfip = (
u8 *) & qfi;
1714 seg0.as_u8[
offset] = qfi;
1725 for (idx = 0; idx < 2; idx++)
1727 seg0.as_u8[
offset + idx + 1] |= seqp[idx] >> shift;
1728 seg0.as_u8[
offset + idx + 2] |=
1729 seqp[idx] << (8 - shift);
1734 for (idx = 0; idx < 4; idx++)
1736 seg0.as_u8[
offset + idx + 1] |= teidp[idx] >> shift;
1737 seg0.as_u8[
offset + idx + 2] |=
1738 teidp[idx] << (8 - shift);
1753 seg0.as_u8[
offset] |= qfi >> shift;
1754 seg0.as_u8[
offset + 1] |= qfi << (8 - shift);
1762 payload_len = clib_net_to_host_u16 (hdr0->
gtpu.
length);
1763 if (payload_len != 0)
1771 ies = (
u8 *) ((
u8 *) hdr0 + hdrlen);
1818 hdr_len +=
sizeof (ip6_address_t);
1826 hdr_len +=
sizeof (ip6_address_t);
1836 tlv_siz = (tlv_siz & ~0x07) + (tlv_siz & 0x07 ? 0x08 : 0x0);
1860 ip6srv->
sr.
length +=
sizeof (ip6_address_t) / 8;
1868 sizeof (ip6_address_t));
1873 ip6srv->
ip.
protocol = IP_PROTOCOL_IPV6_ROUTE;
1880 sizeof (ip6_address_t)) / 8) - 1;
1892 ip6srv->
sr.
length +=
sizeof (ip6_address_t) / 8;
1900 if ((clib_net_to_host_u32
1910 if ((clib_net_to_host_u32
1923 if ((clib_net_to_host_u32
1953 ip6srv->
ip.
protocol = IP_PROTOCOL_IPV6_ROUTE;
1963 ip6srv->
sr.
length =
sizeof (ip6_address_t) / 8;
1970 if ((clib_net_to_host_u32
1978 if ((clib_net_to_host_u32
1991 if ((clib_net_to_host_u32
2028 clib_host_to_net_u16 (len0 + hdr_len -
sizeof (
ip6_header_t));
2038 sizeof (ip6_address_t));
2040 sizeof (ip6_address_t));
2043 sizeof (ip6_address_t));
2056 n_left_to_next, bi0, next0);
2063 SRV6_END_ERROR_M_GTP6_D_BAD_PACKETS, bad_n);
2066 SRV6_END_ERROR_M_GTP6_D_PACKETS, good_n);
2068 return frame->n_vectors;
2082 u32 good_n = 0, bad_n = 0;
2129 n_left_to_next -= 1;
2164 seqp = (
u8 *) & seq;
2217 seg0.as_u8[
offset] = qfi;
2228 for (idx = 0; idx < 2; idx++)
2230 seg0.as_u8[
offset + idx + 1] |= seqp[idx] >> shift;
2231 seg0.as_u8[
offset + idx + 2] |=
2232 seqp[idx] << (8 - shift);
2237 for (idx = 0; idx < 4; idx++)
2239 seg0.as_u8[
offset + idx + 1] |= teidp[idx] >> shift;
2240 seg0.as_u8[
offset + idx + 2] |=
2241 teidp[idx] << (8 - shift);
2256 seg0.as_u8[
offset] |= qfi >> shift;
2257 seg0.as_u8[
offset + 1] |= qfi << (8 - shift);
2265 payload_len = clib_net_to_host_u16 (hdr0->
gtpu.
length);
2266 if (payload_len != 0)
2274 ies = (
u8 *) ((
u8 *) hdr0 + hdrlen);
2322 hdr_len +=
sizeof (ip6_address_t) * 2;
2330 tlv_siz = (tlv_siz & ~0x07) + (tlv_siz & 0x07 ? 0x08 : 0x0);
2354 ip6srv->
sr.
length += ((
sizeof (ip6_address_t) * 2) / 8);
2364 sizeof (ip6_address_t));
2369 ip6srv->
ip.
protocol = IP_PROTOCOL_IPV6_ROUTE;
2376 2 *
sizeof (ip6_address_t)) / 8) - 1;
2389 ip6srv->
sr.
length +=
sizeof (ip6_address_t) / 8;
2406 sizeof (ip6_address_t)) / 8) - 1;
2434 clib_host_to_net_u16 (len0 + hdr_len -
sizeof (
ip6_header_t));
2435 ip6srv->
ip.
protocol = IP_PROTOCOL_IPV6_ROUTE;
2441 if ((clib_net_to_host_u32
2451 if ((clib_net_to_host_u32
2464 if ((clib_net_to_host_u32
2492 sizeof (ip6_address_t));
2494 sizeof (ip6_address_t));
2497 sizeof (ip6_address_t));
2511 n_left_to_next, bi0, next0);
2518 SRV6_END_ERROR_M_GTP6_D_DI_BAD_PACKETS, bad_n);
2521 SRV6_END_ERROR_M_GTP6_D_DI_PACKETS, good_n);
2523 return frame->n_vectors;
2536 u32 good_n = 0, bad_n = 0;
2570 n_left_to_next -= 1;
2597 sizeof (ip6_address_t));
2599 sizeof (ip6_address_t));
2627 if ((
ip4->ip_version_and_header_length & 0xf0) != 0x40)
2641 if ((clib_net_to_host_u32
2642 (
ip6->ip_version_traffic_class_and_flow_label) >> 28)
2651 if ((
ip6->dst_address.as_u8[0] == 0xff)
2652 && ((
ip6->dst_address.as_u8[1] & 0xc0) == 0x80))
2667 if ((clib_net_to_host_u32
2668 (
ip6->ip_version_traffic_class_and_flow_label) >> 28)
2672 if ((
ip6->dst_address.as_u8[0] == 0xff)
2673 && ((
ip6->dst_address.as_u8[1] & 0xc0) == 0x80))
2686 if ((clib_net_to_host_u32
2687 (
ip6->ip_version_traffic_class_and_flow_label) >> 28)
2717 sizeof (ip6_address_t));
2719 sizeof (ip6_address_t));
2732 n_left_to_next, bi0, next0);
2739 SRV6_END_ERROR_M_GTP6_DT_BAD_PACKETS, bad_n);
2742 SRV6_END_ERROR_M_GTP6_DT_PACKETS, good_n);
2744 return frame->n_vectors;
2756 u32 good_n = 0, bad_n = 0;
2790 n_left_to_next -= 1;
2847 if ((
ip4->ip_version_and_header_length & 0xf0) != 0x40)
2861 if ((clib_net_to_host_u32
2862 (
ip6->ip_version_traffic_class_and_flow_label) >> 28)
2871 if ((
ip6->dst_address.as_u8[0] == 0xff)
2872 && ((
ip6->dst_address.as_u8[1] & 0xc0) == 0x80))
2888 if ((clib_net_to_host_u32
2889 (
ip6->ip_version_traffic_class_and_flow_label) >> 28)
2893 if ((
ip6->dst_address.as_u8[0] == 0xff)
2894 && ((
ip6->dst_address.as_u8[1] & 0xc0) == 0x80))
2908 if ((clib_net_to_host_u32
2909 (
ip6->ip_version_traffic_class_and_flow_label) >> 28)
2939 sizeof (ip6_address_t));
2941 sizeof (ip6_address_t));
2948 n_left_to_next, bi0, next0);
2955 SRV6_T_ERROR_M_GTP4_DT_BAD_PACKETS, bad_n);
2958 SRV6_T_ERROR_M_GTP4_DT_PACKETS, good_n);
2960 return frame->n_vectors;
2965 .name =
"srv6-end-m-gtp6-e",.vector_size =
sizeof (
u32),.format_trace =
2977 .name =
"srv6-end-m-gtp6-d",.vector_size =
sizeof (
u32),.format_trace =
2989 .name =
"srv6-end-m-gtp6-d-di",.vector_size =
sizeof (
u32),.format_trace =
3001 .name =
"srv6-end-m-gtp6-dt",.vector_size =
sizeof (
u32),.format_trace =
3015 .name =
"srv6-t-m-gtp4-dt",.vector_size =
sizeof (
u32),.format_trace =