]> The Tcpdump Group git mirrors - tcpdump/commitdiff
This commit makes ipnet_if_print the first NDO aware top-level
authorMichael Richardson <[email protected]>
Sun, 10 Jan 2010 19:36:07 +0000 (14:36 -0500)
committerMichael Richardson <[email protected]>
Sun, 10 Jan 2010 19:36:07 +0000 (14:36 -0500)
printer.
Merge commit 'origin/master'

Conflicts:
netdissect.h

1  2 
netdissect.h
print-ipnet.c
tcpdump.c

diff --cc netdissect.h
index 86b66a09bf672453e02595ebe80b33bb092f93ca,dd9f4b966bfd87ff12cd80558f1dabafa6e41308..7e87555cb3aee796f3977b8bde97b0f0f353734a
@@@ -437,9 -437,6 +437,8 @@@ extern void lwres_print(netdissect_opti
  extern void pptp_print(netdissect_options *,const u_char *, u_int);
  #endif
  
- extern void ipnet_print(netdissect_options *,const u_char *, u_int, u_int);
 +extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 +
  #if 0
  #ifdef INET6
  extern void ip6_print(netdissect_options *,const u_char *, u_int);
diff --cc print-ipnet.c
index 32aaeae660ddee3a79769f1453ef5718b4ce83f2,3a5b5a1aa18390d89b9045d12336a0840014d3e1..957bd4f52341ea74f0a6d4f0cde3d5d63fcd9b31
@@@ -91,9 -91,9 +91,10 @@@ ipnet_print(struct netdissect_options *
   * is the number of bytes actually captured.
   */
  u_int
- ipnet_if_print(struct netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 -ipnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
++ipnet_if_print(struct netdissect_options *ndo,
++               const struct pcap_pkthdr *h, const u_char *p)
  {
 -      ipnet_print(gndo, p, h->len, h->caplen);
 +      ipnet_print(ndo, p, h->len, h->caplen);
  
        return (sizeof(ipnet_hdr_t));
  }
diff --cc tcpdump.c
index b0c5ad6c05696e4c17242881800b5d7a2d23aff5,d50feb0896940ca2f040909d8ab506708d01fe1b..c60cb6b4f5990b302c1c983def59445faa6fc218
+++ b/tcpdump.c
@@@ -268,35 -259,37 +268,41 @@@ static struct printer printers[] = 
        { juniper_services_print, DLT_JUNIPER_SERVICES },
  #endif
  #ifdef DLT_JUNIPER_ETHER
-       { juniper_ether_print, DLT_JUNIPER_ETHER },
+       { juniper_ether_print,  DLT_JUNIPER_ETHER },
  #endif
  #ifdef DLT_JUNIPER_PPP
-       { juniper_ppp_print, DLT_JUNIPER_PPP },
+       { juniper_ppp_print,    DLT_JUNIPER_PPP },
  #endif
  #ifdef DLT_JUNIPER_FRELAY
-       { juniper_frelay_print, DLT_JUNIPER_FRELAY },
+       { juniper_frelay_print, DLT_JUNIPER_FRELAY },
  #endif
  #ifdef DLT_JUNIPER_CHDLC
-       { juniper_chdlc_print, DLT_JUNIPER_CHDLC },
+       { juniper_chdlc_print,  DLT_JUNIPER_CHDLC },
  #endif
  #ifdef DLT_MFR
-       { mfr_if_print, DLT_MFR },
+       { mfr_if_print,         DLT_MFR },
  #endif
  #if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
-       { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
+       { bt_if_print,          DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
  #endif
  #if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX)
-       { usb_linux_print, DLT_USB_LINUX},
+       { usb_linux_print,      DLT_USB_LINUX},
  #endif
  #if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX_MMAPPED)
-       { usb_linux_print, DLT_USB_LINUX_MMAPPED},
+       { usb_linux_print,      DLT_USB_LINUX_MMAPPED},
  #endif
 +      { NULL,                 0 },
 +};
 +
 +static struct ndo_printer ndo_printers[] = {
  #ifdef DLT_IPNET
-       { ipnet_if_print, DLT_IPNET },
+       { ipnet_if_print,       DLT_IPNET },
+ #endif
+ #ifdef DLT_IPV4
+       { raw_if_print,         DLT_IPV4 },
+ #endif
+ #ifdef DLT_IPV6
+       { raw_if_print,         DLT_IPV6 },
  #endif
        { NULL,                 0 },
  };
@@@ -314,21 -307,10 +320,23 @@@ lookup_printer(int type
        /* NOTREACHED */
  }
  
 +static if_ndo_printer
 +lookup_ndo_printer(int type)
 +{
 +      struct ndo_printer *p;
 +
 +      for (p = ndo_printers; p->f; ++p)
 +              if (type == p->type)
 +                      return p->f;
 +
 +      return NULL;
 +      /* NOTREACHED */
 +}
 +
  static pcap_t *pd;
  
+ static int supports_monitor_mode;
  extern int optind;
  extern int opterr;
  extern char *optarg;