-#ifdef IP6_MAP_T_DUAL_LOOP
- while (n_left_from >= 4 && n_left_to_next >= 2)
- {
- u32 pi0, pi1;
- vlib_buffer_t *p0, *p1;
- ip6_header_t *ip60, *ip61;
- u8 error0, error1;
- ip6_mapt_next_t next0, next1;
- u32 l4_len0, l4_len1;
- i32 map_port0, map_port1;
- map_domain_t *d0, *d1;
- ip6_frag_hdr_t *frag0, *frag1;
- next0 = next1 = 0; //Because compiler whines
-
- pi0 = to_next[0] = from[0];
- pi1 = to_next[1] = from[1];
- from += 2;
- n_left_from -= 2;
- to_next += 2;
- n_left_to_next -= 2;
-
- error0 = MAP_ERROR_NONE;
- error1 = MAP_ERROR_NONE;
-
- p0 = vlib_get_buffer (vm, pi0);
- p1 = vlib_get_buffer (vm, pi1);
- ip60 = vlib_buffer_get_current (p0);
- ip61 = vlib_buffer_get_current (p1);
-
- if (mm->is_ce)
- {
- u32 daddr0, daddr1;
- daddr0 = 0; /* TODO */
- daddr1 = 0; /* TODO */
- /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */
-
- daddr0 = map_get_ip4 (&ip60->dst_address, 0 /*TODO*/);
- daddr1 = map_get_ip4 (&ip61->dst_address, 0 /*TODO*/);
- d0 =
- ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX],
- (ip4_address_t *) & daddr0,
- &vnet_buffer (p0)->map_t.map_domain_index,
- &error0);
- d1 =
- ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX],
- (ip4_address_t *) & daddr1,
- &vnet_buffer (p1)->map_t.map_domain_index,
- &error1);
-
- daddr0 = map_get_ip4 (&ip60->dst_address, d0->flags);
- daddr1 = map_get_ip4 (&ip61->dst_address, d1->flags);
-
- vnet_buffer (p0)->map_t.v6.daddr = daddr0;
- vnet_buffer (p1)->map_t.v6.daddr = daddr1;
- vnet_buffer (p0)->map_t.v6.saddr =
- ip6_map_t_embedded_address (d0, &ip60->src_address);
- vnet_buffer (p1)->map_t.v6.saddr =
- ip6_map_t_embedded_address (d1, &ip61->src_address);
- }
- else
- {
- u32 saddr0, saddr1;
- saddr0 = 0; /* TODO */
- saddr1 = 0; /* TODO */
- /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */
-
- saddr0 = map_get_ip4 (&ip60->src_address, 0 /*TODO*/);
- saddr1 = map_get_ip4 (&ip61->src_address, 0 /*TODO*/);
- d0 =
- ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX],
- (ip4_address_t *) & saddr0,
- &vnet_buffer (p0)->map_t.map_domain_index,
- &error0);
- d1 =
- ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX],
- (ip4_address_t *) & saddr1,
- &vnet_buffer (p1)->map_t.map_domain_index,
- &error1);
-
- saddr0 = map_get_ip4 (&ip60->src_address, d0->flags);
- saddr1 = map_get_ip4 (&ip61->src_address, d1->flags);
-
- vnet_buffer (p0)->map_t.v6.saddr = saddr0;
- vnet_buffer (p1)->map_t.v6.saddr = saddr1;
- vnet_buffer (p0)->map_t.v6.daddr =
- ip6_map_t_embedded_address (d0, &ip60->dst_address);
- vnet_buffer (p1)->map_t.v6.daddr =
- ip6_map_t_embedded_address (d1, &ip61->dst_address);
- }
-
- vnet_buffer (p0)->map_t.mtu = d0->mtu ? d0->mtu : ~0;
- vnet_buffer (p1)->map_t.mtu = d1->mtu ? d1->mtu : ~0;
-
- if (PREDICT_FALSE (ip6_parse (ip60, p0->current_length,
- &(vnet_buffer (p0)->map_t.
- v6.l4_protocol),
- &(vnet_buffer (p0)->map_t.
- v6.l4_offset),
- &(vnet_buffer (p0)->map_t.
- v6.frag_offset))))
- {
- error0 = MAP_ERROR_MALFORMED;
- next0 = IP6_MAPT_NEXT_DROP;
- }
-
- if (PREDICT_FALSE (ip6_parse (ip61, p1->current_length,
- &(vnet_buffer (p1)->map_t.
- v6.l4_protocol),
- &(vnet_buffer (p1)->map_t.
- v6.l4_offset),
- &(vnet_buffer (p1)->map_t.
- v6.frag_offset))))
- {
- error1 = MAP_ERROR_MALFORMED;
- next1 = IP6_MAPT_NEXT_DROP;
- }
-
- map_port0 = map_port1 = -1;
- l4_len0 = (u32) clib_net_to_host_u16 (ip60->payload_length) +
- sizeof (*ip60) - vnet_buffer (p0)->map_t.v6.l4_offset;
- l4_len1 = (u32) clib_net_to_host_u16 (ip61->payload_length) +
- sizeof (*ip60) - vnet_buffer (p1)->map_t.v6.l4_offset;
- frag0 =
- (ip6_frag_hdr_t *) u8_ptr_add (ip60,
- vnet_buffer (p0)->map_t.
- v6.frag_offset);
- frag1 =
- (ip6_frag_hdr_t *) u8_ptr_add (ip61,
- vnet_buffer (p1)->map_t.
- v6.frag_offset);
-
- ip6_map_t_classify (p0, ip60, d0, &map_port0, &error0, &next0,
- l4_len0, frag0);
- ip6_map_t_classify (p1, ip61, d1, &map_port1, &error1, &next1,
- l4_len1, frag1);
-
- if (PREDICT_FALSE
- ((map_port0 != -1)
- && (ip60->src_address.as_u64[0] !=
- map_get_pfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr,
- map_port0)
- || ip60->src_address.as_u64[1] != map_get_sfx_net (d0,
- vnet_buffer
- (p0)->map_t.v6.saddr,
- map_port0))))
- {
- error0 = MAP_ERROR_SEC_CHECK;
- }
-
- if (PREDICT_FALSE
- ((map_port1 != -1)
- && (ip61->src_address.as_u64[0] !=
- map_get_pfx_net (d1, vnet_buffer (p1)->map_t.v6.saddr,
- map_port1)
- || ip61->src_address.as_u64[1] != map_get_sfx_net (d1,
- vnet_buffer
- (p1)->map_t.v6.saddr,
- map_port1))))
- {
- error1 = MAP_ERROR_SEC_CHECK;
- }
-
- if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset &&
- !ip6_frag_hdr_offset ((ip6_frag_hdr_t *)
- u8_ptr_add (ip60,
- vnet_buffer
- (p0)->map_t.
- v6.frag_offset)))
- && (map_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules)
- && (error0 == MAP_ERROR_NONE))
- {
- ip6_map_fragment_cache (ip60,
- (ip6_frag_hdr_t *) u8_ptr_add (ip60,
- vnet_buffer
- (p0)->map_t.
- v6.frag_offset),
- d0, map_port0);
- }
-
- if (PREDICT_FALSE (vnet_buffer (p1)->map_t.v6.frag_offset &&
- !ip6_frag_hdr_offset ((ip6_frag_hdr_t *)
- u8_ptr_add (ip61,
- vnet_buffer
- (p1)->map_t.
- v6.frag_offset)))
- && (map_port1 != -1) && (d1->ea_bits_len != 0 || !d1->rules)
- && (error1 == MAP_ERROR_NONE))
- {
- ip6_map_fragment_cache (ip61,
- (ip6_frag_hdr_t *) u8_ptr_add (ip61,
- vnet_buffer
- (p1)->map_t.
- v6.frag_offset),
- d1, map_port1);
- }
-
- if (PREDICT_TRUE
- (error0 == MAP_ERROR_NONE && next0 != IP6_MAPT_NEXT_MAPT_ICMP))
- {
- vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX,
- thread_index,
- vnet_buffer (p0)->
- map_t.map_domain_index, 1,
- clib_net_to_host_u16
- (ip60->payload_length));
- }
-
- if (PREDICT_TRUE
- (error1 == MAP_ERROR_NONE && next1 != IP6_MAPT_NEXT_MAPT_ICMP))
- {
- vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX,
- thread_index,
- vnet_buffer (p1)->
- map_t.map_domain_index, 1,
- clib_net_to_host_u16
- (ip61->payload_length));
- }
-
- next0 = (error0 != MAP_ERROR_NONE) ? IP6_MAPT_NEXT_DROP : next0;
- next1 = (error1 != MAP_ERROR_NONE) ? IP6_MAPT_NEXT_DROP : next1;
- p0->error = error_node->errors[error0];
- p1->error = error_node->errors[error1];
- vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next,
- n_left_to_next, pi0, pi1, next0,
- next1);
- }
-#endif
-