Skip to content

Commit d5f22fb

Browse files
committed
allow to force a cooked capture
Using a datalink header can be used to show packets direction
1 parent 17aa427 commit d5f22fb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tcpdump.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ static int Qflag = -1; /* restrict captured packet by send/receive direction *
196196
#ifdef HAVE_PCAP_DUMP_FLUSH
197197
static int Uflag; /* "unbuffered" output of dump files */
198198
#endif
199+
static int yflag_dlt = -1;
199200
static int Wflag; /* recycle output files after this number of files */
200201
static int WflagChars;
201202
static char *zflag = NULL; /* compress each savefile using a specified command (like gzip or bzip2) */
@@ -1315,6 +1316,11 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
13151316
pcap_tstamp_type_val_to_name(jflag), device,
13161317
pcap_statustostr(status));
13171318
}
1319+
#endif
1320+
#ifdef __linux__
1321+
/* SLL is always possible on Linux */
1322+
if (yflag_dlt == DLT_LINUX_SLL || yflag_dlt == DLT_LINUX_SLL2)
1323+
pcap_cook(pc);
13181324
#endif
13191325
status = pcap_activate(pc);
13201326
if (status < 0) {
@@ -1446,7 +1452,6 @@ main(int argc, char **argv)
14461452
int cansandbox;
14471453
#endif /* HAVE_CAPSICUM */
14481454
int Oflag = 1; /* run filter code optimizer */
1449-
int yflag_dlt = -1;
14501455
const char *yflag_dlt_name = NULL;
14511456
int print = 0;
14521457

0 commit comments

Comments
 (0)