78 u32 i, total_count, start_entry;
83 printf(
"Logging Entries Wrapped Around, displaying %d entries\n",
88 printf(
"Displaying %d entries\n", total_count);
91 printf(
"SEQ ACK IP_O IP_N PORT_O PORT_N L3_CRC_O L3_CRC_N L4_CRC_O L4_CRC_N\n");
93 for (i = 0; i < total_count; i++) {
96 printf(
"%04d: 0x%08x 0x%08x 0x%08x 0x%08x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n",
98 tcp_logging_array[entry].seq_num,
99 tcp_logging_array[entry].ack_num,
100 tcp_logging_array[entry].old_ip,
101 tcp_logging_array[entry].new_ip,
102 tcp_logging_array[entry].old_port,
103 tcp_logging_array[entry].new_port,
104 tcp_logging_array[entry].old_ip_crc,
105 tcp_logging_array[entry].new_ip_crc,
106 tcp_logging_array[entry].old_tcp_crc,
107 tcp_logging_array[entry].new_tcp_crc);
117 switch (enable_flag) {
121 printf(
"\nTCP Logging ALREADY DISABLED\n");
123 printf(
"\nTCP Logging DISABLED\n");
130 printf(
"\nTCP Logging ALREADY ENABLED\n");
136 printf(
"\nTCP Logging ENABLED\n");
146 printf(
"\ntcp_logging_enable_flag %d, tcp_log_count %d\n",
148 printf(
"To Enable TCP LOGGING provide a flag value of %d\n",
156 for (i=0;i<len;i++) {
157 if(i && (i & 0x3 ) == 0) printf(
" ");
158 if(i && (i & 0xf ) == 0) printf(
"\n");
173 printf(
"\n======== PRINTING PKT START======\n");
174 printf(
"======== IP PACKET LEN %d ===========\n", total_len);
175 for (i=0; i < 20; i++) {
176 printf(
" %02X ", *(pkt + i));
179 printf(
"\n======== ICMP HEADER =================\n");
180 for (i=20; i < 28; i++) {
181 printf(
" %02X ", *(pkt + i));
184 printf(
"\n======== ICMP BODY ===================\n");
185 for (i=28; i < total_len; i++) {
186 printf(
" %02X ", *(pkt + i));
189 printf(
"\n======== PRINTING PKT END =======\n");
195 u32 i, total_len, udp_len;
200 udp_len = total_len - 20;
202 printf(
"\n======== PRINTING PKT START======\n");
203 printf(
"======== IP PACKET LEN %d ===========\n", total_len);
204 for (i=0; i < 20; i++) {
205 printf(
" %02X ", *(pkt + i));
207 printf(
"\n======== UDP PSEUDO HEADER ==========\n");
208 for (i=12; i < 20; i++) {
209 printf(
" %02X ", *(pkt + i));
211 printf(
" 00 11 %02X %02X ", udp_len >> 8, udp_len & 0xff);
213 printf(
"\n======== UDP HEADER =================\n");
214 for (i=20; i < 28; i++) {
215 printf(
" %02X ", *(pkt + i));
217 printf(
"\n======== UDP BODY ===================\n");
218 for (i=28; i < total_len; i++) {
219 printf(
" %02X ", *(pkt + i));
222 printf(
"\n======== PRINTING PKT END =======\n");
228 u32 i, total_len, tcp_len;
233 tcp_len = total_len - 20;
235 printf(
"\n======== PRINTING PKT START======\n");
236 printf(
"======== IP PACKET LEN %d ===========\n", total_len);
237 for (i=0; i < 20; i++) {
238 printf(
" %02X ", *(pkt + i));
240 printf(
"\n======== TCP PSEUDO HEADER ==========\n");
241 for (i=12; i < 20; i++) {
242 printf(
" %02X ", *(pkt + i));
244 printf(
" 00 06 %02X %02X ", tcp_len >> 8, tcp_len & 0xff);
246 printf(
"\n======== TCP HEADER =================\n");
247 for (i=20; i < 40; i++) {
248 printf(
" %02X ", *(pkt + i));
250 printf(
"\n======== TCP BODY ===================\n");
251 for (i=40; i < total_len; i++) {
252 printf(
" %02X ", *(pkt + i));
255 printf(
"\n======== PRINTING PKT END =======\n");
275 u16 mss_old, mss_new;
322 u16 *ptr = (
u16*)(mss_ptr + 2);
324 mss_old = clib_net_to_host_u16(*ptr);
328 u16 mss_old_r, old_tcp_checksum_r;
330 *ptr = clib_host_to_net_u16(mss_new);
332 mss_old_r = ~mss_old;
340 sum32 = old_tcp_checksum_r + mss_old_r + mss_new;
345 clib_net_to_host_u32(tcp->
seq_num),
346 clib_net_to_host_u32(tcp->
ack_num),
#define TCP_LOGGING_DISABLE
sll srl srl sll sra u16x4 i
#define DSLITE_PRINTF(level,...)
#define MAX_TCP_LOGGING_COUNT
void tcp_in2out_nat_mss_n_checksum(ipv4_header *ip, tcp_hdr_type *tcp, u32 ipv4_addr, u16 port, cnat_main_db_entry_t *db)
void print_tcp_pkt(ipv4_header *ip)
#define TCP_LOGGING_PACKET_DUMP
u32 tcp_logging_enable_flag
void hex_dump(u8 *p, int len)
#define TCP_LOGGING_ENABLE
static void cnat_v4_recalculate_tcp_checksum(ipv4_header *ip, tcp_hdr_type *tcp, u32 *ip_addr_ptr, u16 *tcp_port_addr_ptr, u32 new_ip, u16 new_port)
void tcp_debug_logging(u32 seq_num, u32 ack_num, u32 old_ip, u32 new_ip, u16 old_port, u16 new_port, u16 old_ip_crc, u16 new_ip_crc, u16 old_tcp_crc, u16 new_tcp_crc)
static u32 tcp_logging_overflow
dslite_table_entry_t * dslite_table_db_ptr
void tcp_debug_logging_enable_disable(u32 enable_flag)
void print_udp_pkt(ipv4_header *ip)
#define V4_TCP_MSS_NOT_CONFIGURED_VALUE
#define CNAT_DB_DSLITE_FLAG
void tcp_debug_logging_dump(void)
static u32 tcp_logging_count
#define TCP_LOGGING_SUMMARY_DUMP
cnat_vrfmap_t * cnat_map_by_vrf
#define FILL_CHECKSUM(checksum_field, sum32)
void print_icmp_pkt(ipv4_header *ip)
u32 get_my_svi_intf_ip_addr()