50 #define foreach_det44_out2in_error \
51 _(UNSUPPORTED_PROTOCOL, "Unsupported protocol") \
52 _(NO_TRANSLATION, "No translation") \
53 _(BAD_ICMP_TYPE, "unsupported ICMP type") \
54 _(OUT2IN_PACKETS, "Good out2in packets processed")
58 #define _(sym,str) DET44_OUT2IN_ERROR_##sym,
65 #define _(sym,string) string,
79 "DET44_OUT2IN: sw_if_index %d, next index %d, session index %d",
84 #ifndef CLIB_MARCH_VARIANT
108 icmp46_header_t *icmp0;
116 icmp46_header_t *inner_icmp0;
146 case NAT_PROTOCOL_ICMP:
147 inner_icmp0 = (icmp46_header_t *) l4_header;
152 case NAT_PROTOCOL_UDP:
153 case NAT_PROTOCOL_TCP:
158 b0->
error =
node->errors[DET44_OUT2IN_ERROR_UNSUPPORTED_PROTOCOL];
180 clib_net_to_host_u16 (key0.
out_port), &new_addr0);
196 clib_net_to_host_u16 (key0.
out_port),
198 b0->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
204 (
vnet_buffer (b0)->
ip.reass.icmp_type_or_tcp_flags != ICMP4_echo_reply
206 reass.icmp_type_or_tcp_flags)))
208 b0->
error =
node->errors[DET44_OUT2IN_ERROR_BAD_ICMP_TYPE];
231 #ifndef CLIB_MARCH_VARIANT
235 icmp46_header_t * icmp0,
242 u32 new_addr0, old_addr0, next0_tmp, fib_index;
243 u16 old_id0, new_id0,
port, checksum0;
245 icmp46_header_t *inner_icmp0;
256 d, e, &dont_translate);
271 if (checksum0 != 0 && checksum0 != 0xffff)
290 if (icmp0->checksum == 0)
291 icmp0->checksum = 0xffff;
302 sum0 = icmp0->checksum;
324 sum0 = icmp0->checksum;
331 case NAT_PROTOCOL_ICMP:
332 inner_icmp0 = (icmp46_header_t *) l4_header;
339 sum0 = icmp0->checksum;
345 case NAT_PROTOCOL_UDP:
346 case NAT_PROTOCOL_TCP:
351 sum0 = icmp0->checksum;
372 u32 pkts_processed = 0;
388 u32 sw_if_index0, sw_if_index1;
392 u16 new_port0, old_port0, old_port1, new_port1;
399 u32 rx_fib_index0, rx_fib_index1;
400 icmp46_header_t *icmp0, *icmp1;
433 ICMP4_time_exceeded_ttl_exceeded_in_transit,
445 icmp0 = (icmp46_header_t *) udp0;
448 rx_fib_index0,
node, next0,
463 b0->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
468 clib_net_to_host_u16 (tcp0->dst), &new_addr0);
475 clib_net_to_host_u16 (tcp0->src),
477 clib_net_to_host_u16 (tcp0->dst),
480 b0->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
498 && ses0->
state == DET44_SESSION_TCP_ESTABLISHED)
499 ses0->
state = DET44_SESSION_TCP_CLOSE_WAIT;
501 && ses0->
state == DET44_SESSION_TCP_LAST_ACK)
504 sum0 = tcp0->checksum;
528 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
551 ICMP4_time_exceeded_ttl_exceeded_in_transit,
563 icmp1 = (icmp46_header_t *) udp1;
566 rx_fib_index1,
node, next1,
581 b1->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
586 clib_net_to_host_u16 (tcp1->dst), &new_addr1);
593 clib_net_to_host_u16 (tcp1->src),
595 clib_net_to_host_u16 (tcp1->dst),
598 b1->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
602 udp1->
dst_port = new_port1 = ses1->in_port;
616 && ses1->state == DET44_SESSION_TCP_ESTABLISHED)
617 ses1->state = DET44_SESSION_TCP_CLOSE_WAIT;
619 && ses1->state == DET44_SESSION_TCP_LAST_ACK)
622 sum1 = tcp1->checksum;
646 && (b1->
flags & VLIB_BUFFER_IS_TRACED)))
673 u16 new_port0, old_port0;
681 icmp46_header_t *icmp0;
696 ICMP4_time_exceeded_ttl_exceeded_in_transit,
708 icmp0 = (icmp46_header_t *) udp0;
711 rx_fib_index0,
node, next0,
726 b0->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
731 clib_net_to_host_u16 (tcp0->dst), &new_addr0);
738 clib_net_to_host_u16 (tcp0->src),
740 clib_net_to_host_u16 (tcp0->dst),
743 b0->
error =
node->errors[DET44_OUT2IN_ERROR_NO_TRANSLATION];
761 && ses0->
state == DET44_SESSION_TCP_ESTABLISHED)
762 ses0->
state = DET44_SESSION_TCP_CLOSE_WAIT;
764 && ses0->
state == DET44_SESSION_TCP_LAST_ACK)
767 sum0 = tcp0->checksum;
791 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
813 DET44_OUT2IN_ERROR_OUT2IN_PACKETS,
815 return frame->n_vectors;
820 .name =
"det44-out2in",
821 .vector_size =
sizeof (
u32),