Skip to content

Commit

Permalink
Set default linktype LINUX_SLL2 when capturing on the "any" device
Browse files Browse the repository at this point in the history
  • Loading branch information
fxlb committed May 8, 2020
1 parent f025901 commit 8d3c2ed
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tcpdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,14 @@ main(int argc, char **argv)
show_remote_devices_and_exit();
#endif

#if defined(DLT_LINUX_SLL2) && defined(HAVE_PCAP_SET_DATALINK)
/* Set default linktype DLT_LINUX_SLL2 when capturing on the "any" device */
if (device != NULL &&
strncmp (device, "any", strlen("any")) == 0
&& yflag_dlt == -1)
yflag_dlt = DLT_LINUX_SLL2;
#endif

switch (ndo->ndo_tflag) {

case 0: /* Default */
Expand Down Expand Up @@ -2180,7 +2188,8 @@ main(int argc, char **argv)
}
#endif
(void)fprintf(stderr, "%s: data link type %s\n",
program_name, yflag_dlt_name);
program_name,
pcap_datalink_val_to_name(yflag_dlt));
(void)fflush(stderr);
}
i = pcap_snapshot(pd);
Expand Down

0 comments on commit 8d3c2ed

Please sign in to comment.