27 #define foreach_cnat_ipv4_icmp_q_outside_input_error \ 28 _(CNAT_V4_ICMP_Q_O2I_T_PKT, "cnat v4 icmp_q o2i packet transmit") \ 29 _(CNAT_V4_ICMP_Q_O2I_MISS_PKT, "cnat v4 icmp_q o2i drop") \ 30 _(CNAT_V4_ICMP_Q_O2I_TTL_GEN, "cnat v4 icmp_q o2i ttl generate") \ 31 _(CNAT_V4_ICMP_Q_O2I_TTL_DROP, "cnat v4 icmp_q o2i ttl drop") \ 32 _(CNAT_V4_ICMP_Q_O2I_NO_SESSION_DROP, "cnat v4 icmp_q o2i no session drop") 35 #define _(sym,str) sym, 42 #define _(sym,string) string, 79 if(cnat_static_dest_db_get_translation(ip->
src_addr, &postmap_ip, vrf, direction) ==
CNAT_SUCCESS) {
82 old_ip = spp_net_to_host_byte_order_32(&(ip->
src_addr));
83 old_postmap_ip = spp_net_to_host_byte_order_32(&postmap_ip);
86 ((
u16)(old_ip >> 16)),
87 (spp_net_to_host_byte_order_16(&(ip->
checksum))),
88 ((
u16)(old_postmap_ip & 0xFFFF)),
89 ((
u16)(old_postmap_ip >> 16)))
91 spp_host_to_net_byte_order_16(new_l3_c);
106 (clib_net_to_host_u16(ip->
checksum)),
107 (clib_net_to_host_u16(icmp->
checksum)),
115 clib_host_to_net_u16(new_l3_c);
121 clib_host_to_net_u16(new_l4_c);
128 #define stage0 generic_stage0 164 #define SPP_LOG2_CACHE_LINE_BYTES 6 165 #define SPP_CACHE_LINE_BYTES (1 << SPP_LOG2_CACHE_LINE_BYTES) 171 uword prefetch_target0, prefetch_target1;
187 prefetch_target1 = prefetch_target0 +
222 }
while (db_index !=
EMPTY);
237 int counter = CNAT_V4_ICMP_Q_O2I_T_PKT;
249 u32 vrf_index __attribute__((unused)) = 0;
254 dest_info.
k.
port = 0;
258 printf(
"\nDUMPING ICMP PKT BEFORE\n");
282 counter = CNAT_V4_ICMP_Q_O2I_NO_SESSION_DROP;
302 counter = CNAT_V4_ICMP_Q_O2I_NO_SESSION_DROP;
324 printf(
"\nDUMPING ICMP PKT AFTER\n");
334 counter = CNAT_V4_ICMP_Q_O2I_MISS_PKT;
338 em->
counters[node_counter_base_index + counter] += 1;
349 return dispatch_pipeline (vm, node, frame);
355 .name =
"vcgn-v4-icmp-q-o2i",
356 .vector_size =
sizeof (
u32),
cnat_main_db_entry_t * cnat_main_db
#define CNAT_UPDATE_L3_ICMP_CHECKSUM(old_l3_1, old_l3_2, old_l4, old_l3_c, old_l4_c, new_l3_1, new_l3_2, new_l4)
cnat_session_entry_t * cnat_create_session_db_entry(cnat_key_t *ko, cnat_main_db_entry_t *bdb, u8 log)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
struct _vlib_node_registration vlib_node_registration_t
#define STRUCT_OFFSET_OF(t, f)
cnat_session_entry_t * cnat_handle_1to2_session(cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
index_slist_t out2in_hash
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
vlib_error_main_t error_main
#define CLIB_PREFETCH(addr, size, type)
void cnat_add_dest_n_log(cnat_main_db_entry_t *mdb, cnat_key_t *dest_info)
#define CNAT_UPDATE_L3_CHECKSUM_DECLARE
index_slist_t * cnat_out2in_hash
cnat_vrfmap_t * cnat_map_by_vrf
#define CNAT_MAIN_HASH_MASK
always_inline void ipv4_decr_ttl_n_calc_csum(ipv4_header *ipv4)
#define VLIB_REGISTER_NODE(x,...)
#define CNAT_UPDATE_L3_L4_CHECKSUM_DECLARE
#define CNAT_V4_GET_HASH(key64, hash, mask)
#define CLIB_CACHE_LINE_BYTES
void print_icmp_pkt(ipv4_header *ip)
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define CNAT_UPDATE_L3_CHECKSUM(old_l3_1, old_l3_2, old_l3_c,new_l3_1, new_l3_2)