27 nsh_base_header_t *nsh_base;
28 nsh_tlv_header_t *opt0;
29 nsh_tlv_header_t *limit0;
30 nsh_tlv_header_t *nsh_md2;
32 u8 old_option_size = 0;
33 u8 new_option_size = 0;
36 opt0 = (nsh_tlv_header_t *) (nsh_entry->
tlvs_data);
39 nsh_md2 = (nsh_tlv_header_t *) ((
u8 *) hdr +
40 sizeof (nsh_base_header_t));
46 old_option_size =
sizeof (nsh_tlv_header_t) + opt0->length;
48 old_option_size = ((old_option_size + 3) >> 2) << 2;
51 if (nsh_option == NULL)
64 new_option_size =
sizeof (nsh_tlv_header_t) + nsh_md2->length;
66 new_option_size = ((new_option_size + 3) >> 2) << 2;
69 nsh_md2 = (nsh_tlv_header_t *) (((
u8 *) nsh_md2) + new_option_size);
70 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
76 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
81 nsh_base = (nsh_base_header_t *) nsh_entry->
rewrite;
89 nsh_base_header_t * hdr,
94 nsh_base_header_t *nsh_base;
95 nsh_tlv_header_t *opt0;
96 nsh_tlv_header_t *limit0;
97 nsh_tlv_header_t *nsh_md2;
99 u8 old_option_size = 0;
100 u8 new_option_size = 0;
107 (nsh_tlv_header_t *) (nsh_entry->
rewrite + sizeof (nsh_base_header_t));
111 while (opt0 < limit0)
113 old_option_size =
sizeof (nsh_tlv_header_t) + opt0->length;
115 old_option_size = ((old_option_size + 3) >> 2) << 2;
118 if (nsh_option == NULL)
125 if ((*
nm->swap_options[nsh_option->
option_id]) (
b, opt0, nsh_md2))
131 new_option_size =
sizeof (nsh_tlv_header_t) + nsh_md2->length;
133 new_option_size = ((new_option_size + 3) >> 2) << 2;
135 nsh_md2 = (nsh_tlv_header_t *) (((
u8 *) nsh_md2) + new_option_size);
137 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
143 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
148 nsh_base = (nsh_base_header_t *) nsh_entry->
rewrite;
156 nsh_base_header_t * hdr,
170 while (opt0 < limit0)
173 if (nsh_option == NULL)
175 *
next = drop_node_val;
181 if ((*
nm->pop_options[nsh_option->
option_id]) (
b, opt0))
183 *
next = drop_node_val;
188 option_len = ((opt0->length + 3) >> 2) << 2;
193 (
nm->decap_v4_next_override) ? (
nm->decap_v4_next_override) : (*next);
194 *header_len = (
nm->decap_v4_next_override) ? 0 : (*header_len);
223 u32 next0 = NSH_NODE_NEXT_DROP, next1 = NSH_NODE_NEXT_DROP;
224 uword *entry0, *entry1;
225 nsh_base_header_t *hdr0 = 0, *hdr1 = 0;
226 u32 header_len0 = 0, header_len1 = 0;
227 u32 nsp_nsi0, nsp_nsi1;
232 nsh_base_header_t *encap_hdr0 = 0, *encap_hdr1 = 0;
233 u32 encap_hdr_len0 = 0, encap_hdr_len1 = 0;
237 u32 sw_if_index0 = 0, sw_if_index1 = 0;
274 nsp_nsi0 = hdr0->nsp_nsi;
281 error0 = NSH_NODE_ERROR_INVALID_TTL;
289 l2_classify.opaque_index);
294 char placeholder_dst_address[6] =
295 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
296 char placeholder_src_address[6] =
297 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
299 placeholder_dst_address, 6);
301 placeholder_src_address, 6);
302 placeholder_eth0.
type = 0x0800;
309 nsp_nsi0 =
nm->tunnel_index_by_sw_if_index[sw_if_index0];
320 error0 = NSH_NODE_ERROR_NO_PROXY;
327 error0 = NSH_NODE_ERROR_NO_PROXY;
336 error0 = NSH_NODE_ERROR_NO_MAPPING;
344 error0 = NSH_NODE_ERROR_NO_MAPPING;
362 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
377 error0 = NSH_NODE_ERROR_NO_ENTRY;
383 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
393 &next0, NSH_NODE_NEXT_DROP);
396 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
432 b0->
error = error0 ?
node->errors[error0] : 0;
445 nsp_nsi1 = hdr1->nsp_nsi;
452 error1 = NSH_NODE_ERROR_INVALID_TTL;
460 l2_classify.opaque_index);
465 char placeholder_dst_address[6] =
466 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
467 char placeholder_src_address[6] =
468 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
470 placeholder_dst_address, 6);
472 placeholder_src_address, 6);
473 placeholder_eth1.
type = 0x0800;
480 nsp_nsi1 =
nm->tunnel_index_by_sw_if_index[sw_if_index1];
491 error1 = NSH_NODE_ERROR_NO_PROXY;
498 error1 = NSH_NODE_ERROR_NO_PROXY;
507 error1 = NSH_NODE_ERROR_NO_MAPPING;
515 error1 = NSH_NODE_ERROR_NO_MAPPING;
520 next1 = map1->next_node;
533 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
537 map1->rx_sw_if_index;
545 entry1 =
hash_get_mem (
nm->nsh_entry_by_key, &map1->mapped_nsp_nsi);
548 error1 = NSH_NODE_ERROR_NO_ENTRY;
554 encap_hdr1 = (nsh_base_header_t *) (nsh_entry1->rewrite);
556 encap_hdr_len1 = nsh_entry1->rewrite_size;
564 &next1, NSH_NODE_NEXT_DROP);
567 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
576 encap_hdr_len1 = nsh_entry1->rewrite_size;
588 encap_hdr_len1 = nsh_entry1->rewrite_size;
603 b1->
error = error1 ?
node->errors[error1] : 0;
614 n_left_to_next, bi0, bi1, next0,
623 u32 next0 = NSH_NODE_NEXT_DROP;
625 nsh_base_header_t *hdr0 = 0;
632 nsh_base_header_t *encap_hdr0 = 0;
633 u32 encap_hdr_len0 = 0;
637 u32 sw_if_index0 = 0;
653 nsp_nsi0 = hdr0->nsp_nsi;
660 error0 = NSH_NODE_ERROR_INVALID_TTL;
668 l2_classify.opaque_index);
673 char placeholder_dst_address[6] =
674 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
675 char placeholder_src_address[6] =
676 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
678 placeholder_dst_address, 6);
680 placeholder_src_address, 6);
681 placeholder_eth0.
type = 0x0800;
688 nsp_nsi0 =
nm->tunnel_index_by_sw_if_index[sw_if_index0];
699 error0 = NSH_NODE_ERROR_NO_PROXY;
706 error0 = NSH_NODE_ERROR_NO_PROXY;
716 error0 = NSH_NODE_ERROR_NO_MAPPING;
725 error0 = NSH_NODE_ERROR_NO_MAPPING;
744 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
759 error0 = NSH_NODE_ERROR_NO_ENTRY;
765 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
775 &next0, NSH_NODE_NEXT_DROP);
778 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
812 trace00:b0->
error = error0 ?
node->errors[error0] : 0;
823 n_left_to_next, bi0, next0);
904 #define _(sym,string) string,
914 .vector_size =
sizeof (
u32),
922 #define _(s,n) [NSH_NODE_NEXT_##s] = n,
932 .vector_size =
sizeof (
u32),
940 #define _(s,n) [NSH_NODE_NEXT_##s] = n,
949 .name =
"nsh-classifier",
950 .vector_size =
sizeof (
u32),
958 #define _(s,n) [NSH_NODE_NEXT_##s] = n,
967 .name =
"nsh-aware-vnf-proxy",
968 .vector_size =
sizeof (
u32),
976 #define _(s,n) [NSH_NODE_NEXT_##s] = n,