🐞fix(dumpfile offset): 修复-o参数在-r模式下未生效的bug

This commit is contained in:
yangwei
2021-04-25 14:51:07 +08:00
parent 4ef2936f42
commit e55956215d

View File

@@ -2559,6 +2559,10 @@ main(int argc, char **argv)
/***************************** starting capture... ***********************************/
if(tcpdump_data_offset != 0 && greedy_seek_flag != 0){
printf("option -o and -g is exclusive, can't use at same time!\n");
exit(1);
}
if(0 == has_device_flag){
MESA_dump(callback, pcap_userdata, cmdbuf, cnt, sapp_cmd_port);
}
@@ -3046,8 +3050,14 @@ dump_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
++packets_captured;
++infodelay;
if(tcpdump_data_offset > 0)
{
pcap_dump(user, h, sp+tcpdump_data_offset);
}
else
{
pcap_dump(user, h, sp);
}
#ifdef HAVE_PCAP_DUMP_FLUSH
if (Uflag)
pcap_dump_flush((pcap_dumper_t *)user);
@@ -3123,8 +3133,14 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
++packets_captured;
++infodelay;
if(tcpdump_data_offset > 0)
{
pretty_print_packet((netdissect_options *)user, h, sp+tcpdump_data_offset, packets_captured);
}
else
{
pretty_print_packet((netdissect_options *)user, h, sp, packets_captured);
}
--infodelay;
if (infoprint)
@@ -3333,7 +3349,7 @@ print_usage(void)
(void)fprintf(stderr,
"\t\t[ -k thread-id ] to assign sapp recv thread id, support multi-range, for example: 1,3,5,7.\n");
(void)fprintf(stderr,
"\t\t[ -o offset ] to assign offset from MAC, for skip some low layer data, for example: vxlan=50, mac_in_mac=14.\n");
"\t\t[ -o offset ] to assign offset from MAC, for skip some low layer data, for example: jump vxlan using -o 50, jump mac_in_mac using -o 14.\n");
(void)fprintf(stderr,
"\t\t[ -P port ] to assign sapp recv command port.\n");
(void)fprintf(stderr,