]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Set default linktype LINUX_SLL2 when capturing on the "any" device 850/head
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 8 May 2020 10:29:22 +0000 (12:29 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 8 May 2020 11:49:34 +0000 (13:49 +0200)
tcpdump.c

index 376d9a208bf95e2ba4aab2e1da6ad7998f7bc7ad..06d3d9b9d624758f5ba26703b08a1a61eb589347 100644 (file)
--- 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);