summaryrefslogtreecommitdiff
path: root/tcpdump.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-05-08 12:29:22 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-05-08 13:49:34 +0200
commit8d3c2ed39e1b365da42c3aa5d2c5d6a6a5796bac (patch)
tree54d6db395804ba13ea936463403e57e7e79a2f3d /tcpdump.c
parentf025901fd26f452ea789bb11f3c37c2c84c53c07 (diff)
downloadtcpdump-8d3c2ed39e1b365da42c3aa5d2c5d6a6a5796bac.tar.gz
Set default linktype LINUX_SLL2 when capturing on the "any" device
Diffstat (limited to 'tcpdump.c')
-rw-r--r--tcpdump.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tcpdump.c b/tcpdump.c
index 376d9a20..06d3d9b9 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -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 */
@@ -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);