]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Merge pull request #372 from fxlb/print-telnet
[tcpdump] / tcpdump.c
index 1e3d906d0a1210c070d6a39eab4cb0fab379f3f1..aeb43cc4f55050bcd41193326bc76fe10148d09e 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -174,12 +174,6 @@ static const struct printer printers[] = {
        { token_if_print,       DLT_IEEE802 },
 #ifdef DLT_LANE8023
        { lane_if_print,        DLT_LANE8023 },
-#endif
-#ifdef DLT_CIP
-       { cip_if_print,         DLT_CIP },
-#endif
-#ifdef DLT_ATM_CLIP
-       { cip_if_print,         DLT_ATM_CLIP },
 #endif
        { sl_if_print,          DLT_SLIP },
 #ifdef DLT_SLIP_BSDOS
@@ -193,10 +187,6 @@ static const struct printer printers[] = {
        { ppp_bsdos_if_print,   DLT_PPP_BSDOS },
 #endif
        { fddi_if_print,        DLT_FDDI },
-       { null_if_print,        DLT_NULL },
-#ifdef DLT_LOOP
-       { null_if_print,        DLT_LOOP },
-#endif
        { raw_if_print,         DLT_RAW },
        { atm_if_print,         DLT_ATM_RFC1483 },
 #ifdef DLT_C_HDLC
@@ -232,9 +222,6 @@ static const struct printer printers[] = {
 #ifdef DLT_SUNATM
        { sunatm_if_print,      DLT_SUNATM },
 #endif
-#ifdef DLT_IP_OVER_FC
-       { ipfc_if_print,        DLT_IP_OVER_FC },
-#endif
 #ifdef DLT_PRISM_HEADER
        { prism_if_print,       DLT_PRISM_HEADER },
 #endif
@@ -343,6 +330,19 @@ static const struct ndo_printer ndo_printers[] = {
 #endif
 #if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
        { nflog_if_print,       DLT_NFLOG},
+#endif
+#ifdef DLT_CIP
+       { cip_if_print,         DLT_CIP },
+#endif
+#ifdef DLT_ATM_CLIP
+       { cip_if_print,         DLT_ATM_CLIP },
+#endif
+#ifdef DLT_IP_OVER_FC
+       { ipfc_if_print,        DLT_IP_OVER_FC },
+#endif
+       { null_if_print,        DLT_NULL },
+#ifdef DLT_LOOP
+       { null_if_print,        DLT_LOOP },
 #endif
        { NULL,                 0 },
 };
@@ -729,7 +729,7 @@ int
 main(int argc, char **argv)
 {
        register int cnt, op, i;
-       bpf_u_int32 localnet, netmask;
+       bpf_u_int32 localnet =0 , netmask = 0;
        register char *cp, *infile, *cmdbuf, *device, *RFileName, *VFileName, *WFileName;
        pcap_handler callback;
        int type;
@@ -1254,8 +1254,6 @@ main(int argc, char **argv)
                            RFileName, dlt_name,
                            pcap_datalink_val_to_description(dlt));
                }
-               localnet = 0;
-               netmask = 0;
        } else {
                /*
                 * We're doing a live capture.
@@ -1415,11 +1413,12 @@ main(int argc, char **argv)
                        warning("snaplen raised from %d to %d", snaplen, i);
                        snaplen = i;
                }
-               if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) {
-                       localnet = 0;
-                       netmask = 0;
-                       warning("%s", ebuf);
-               }
+                if(fflag != 0) {
+                        if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) {
+                                warning("foreign (-f) flag used but: %s", ebuf);
+                        }
+                }
+
        }
        if (infile)
                cmdbuf = read_infile(infile);