diff options
| author | lijia <[email protected]> | 2020-10-30 01:29:48 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2020-10-30 01:29:48 +0800 |
| commit | 6cf0bb2a731b3f062ba2e42b15b88b8ff22baf5e (patch) | |
| tree | 67c242813b0451791edb6b16a26d364adc07da1d | |
| parent | f7a99f4df332e343c6d3f6ca0fe6be73297da889 (diff) | |
1.修复MESA_dir_reverse()方向转换错误; 2.增加pkt_dump来源, 默认in, forward, inject三类都会被捕获, 便于debug;
| -rw-r--r-- | bin/etc/sapp.toml | 4 | ||||
| -rw-r--r-- | src/packet_io/packet_io.c | 5 | ||||
| -rw-r--r-- | src/packet_io/packet_io_marsio.c | 23 | ||||
| -rw-r--r-- | src/packet_io/sendpacket.c | 22 |
4 files changed, 47 insertions, 7 deletions
diff --git a/bin/etc/sapp.toml b/bin/etc/sapp.toml index 44d4eac..ffdf87a 100644 --- a/bin/etc/sapp.toml +++ b/bin/etc/sapp.toml @@ -87,7 +87,7 @@ dictator_enable=1 tcp_drop_pure_ack_pkt=0 tcp_syn_option_parse_enabled=1 skip_not_ip_layer_over_eth=0 - treat_vlan_as_mac_in_mac=1 + treat_vlan_as_mac_in_mac=0 reverse_ethernet_addr=1 @@ -134,7 +134,7 @@ dictator_enable=1 symbol_conflict_enabled=0 [profiling.log] - level=20 + level=30 interval=5 [profiling.log.local] diff --git a/src/packet_io/packet_io.c b/src/packet_io/packet_io.c index f00cc36..3cf3c3a 100644 --- a/src/packet_io/packet_io.c +++ b/src/packet_io/packet_io.c @@ -682,6 +682,11 @@ static int mesa_default_pkt_cb(const raw_pkt_t *p_raw_pkt, unsigned char dir, in if((DEPOLYMENT_MODE_INLINE == sapp_global_val->config.packet_io.depolyment_mode_bin) && (PASS == ret)){ packet_io_hook_forward((raw_pkt_t *)p_raw_pkt, p_raw_pkt->route_dir, thread_num); + + /* 2020-10-30 lijia add, in/out/inject�İ���tcpdump_mesa, ����debug. */ + { + cycle_pkt_dump(thread_num, p_raw_pkt); + } } return ret; diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c index ad70174..855f0c3 100644 --- a/src/packet_io/packet_io_marsio.c +++ b/src/packet_io/packet_io_marsio.c @@ -288,6 +288,8 @@ void marsio_dl_io_free_sendbuf(void *phandle, int thread_seq) return; } + + int marsio_dl_io_raw_pkt_send(void *phandle, unsigned char *data,int datalen, void *arg, int thread_seq, unsigned char route_dir, const raw_pkt_t *raw_pkt) { @@ -303,6 +305,10 @@ int marsio_dl_io_raw_pkt_send(void *phandle, unsigned char *data,int datalen, vo /* �˴�ʹ��append������mtod, append�ڲ�ʵ�ʰ�����set datalen�IJ��� */ real_buf = ptr_marsio_buff_append(send_mbuf[0], datalen); + if(NULL == real_buf){ + ptr_marsio_buff_free(sapp_marsio4_instance, send_mbuf, 1, MARSIO_SOCKET_ID_ANY, thread_seq); + return -1; + } memcpy(real_buf, data, datalen); @@ -313,11 +319,26 @@ int marsio_dl_io_raw_pkt_send(void *phandle, unsigned char *data,int datalen, vo ret = ptr_marsio_send_burst_with_options((struct mr_sendpath *)arg, thread_seq, send_mbuf, 1, MARSIO_SEND_OPT_FAST|MARSIO_SEND_OPT_REHASH); if(ret < 0){ + ptr_marsio_buff_free(sapp_marsio4_instance, send_mbuf, 1, MARSIO_SOCKET_ID_ANY, thread_seq); return -1; } + /* ���ͽӿ��Զ�free */ //marsio_buff_free(sapp_marsio4_instance, send_mbuf, 1, MARSIO_SOCKET_ID_ANY, thread_seq); - + + /* 2020-10-30 lijia add, in/out/inject�İ���tcpdump_mesa, ����debug. */ + { + raw_pkt_t to_tcpdump_mesa; + to_tcpdump_mesa.magic_num = RAW_PKT_MAGIC_NUM; + to_tcpdump_mesa.low_layer_type = ADDR_TYPE_MAC; + to_tcpdump_mesa.raw_pkt_data = ptr_marsio_buff_mtod(send_mbuf[0]); + to_tcpdump_mesa.raw_pkt_len = ptr_marsio_buff_buflen(send_mbuf[0]); + to_tcpdump_mesa.__lib_raw_pkt_data = to_tcpdump_mesa.raw_pkt_data; + to_tcpdump_mesa.__lib_raw_pkt_len = to_tcpdump_mesa.raw_pkt_len; + + cycle_pkt_dump(thread_seq, &to_tcpdump_mesa); + } + return datalen; } diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c index a16050e..6263678 100644 --- a/src/packet_io/sendpacket.c +++ b/src/packet_io/sendpacket.c @@ -3238,13 +3238,27 @@ int sendpacket_init_new(int tot_thread_num) ****************************************************************************************/ unsigned char MESA_dir_reverse(unsigned char raw_dir) { - raw_dir ^= DIR_BIT_USE_MASK; /* ͬʱ����sapp�;ɰ�WY���, ��ߺ����bitλͬʱ���� */ + unsigned char reverse_dir; + + switch(raw_dir){ + case 0: + reverse_dir = 1; + break; + + case 0x80: + reverse_dir = 0; + break; - if(raw_dir > 1){ - raw_dir = raw_dir >> 7; /* sappʹ�����λBit, ijЩ�Ͼɲ��ʹ�����λ��Ϊdirʱ, �ƶ������λ */ + case 0x01: + reverse_dir = 0; + break; + + case 0x81: + reverse_dir = 0; + break; } - return raw_dir; + return reverse_dir; } |
