]> The Tcpdump Group git mirrors - libpcap/commitdiff
Cope with the NetBSD issue in a different way.
authorGuy Harris <[email protected]>
Sun, 7 Aug 2016 22:56:11 +0000 (15:56 -0700)
committerGuy Harris <[email protected]>
Sun, 7 Aug 2016 22:56:11 +0000 (15:56 -0700)
Define DLT_USB the way we used to, and undefine DLT_MATCHING_MAX before
defining it.  (We arguably never should have exported it, as the only
code that should be using it is the LINKTYPE_ <-> DLT_ converting code,
but....)

fad-getad.c
fad-helpers.c
inet.c
nametoaddr.c
pcap/dlt.h

index bd869c70eeb6ea67f61ec8def2083a98ae811f54..b67b5cdcd46aa9c2c34dc508e62c1d637555d8c1 100644 (file)
 
 #include <net/if.h>
 
-/*
- * NetBSD insists on having <net/if.h> pull in <net/dlt.h>, so that
- * including <net/if.h> defines a bunch of stuff we later define in our
- * pcap/dlt.h; those definitions will be different, if they haven't
- * picked up all of our changes yet.
- *
- * Undefine some of the offending items.
- */
-#ifdef __NetBSD__
-#undef DLT_USB                 /* we now define it as DLT_FREEBSD_USB */
-#undef DLT_MATCHING_MAX                /* we may define more DLT_ values than they do */
-#endif
-
 #include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
index 9906e487f96525d3579639fc5d19c8230307d888..4bdac732a86e58d2238da15ec4f7a39bd96742d0 100644 (file)
@@ -54,20 +54,6 @@ struct mbuf;         /* Squelch compiler warnings on some platforms for */
 struct rtentry;                /* declarations in <net/if.h> */
 #include <net/if.h>
 #include <netinet/in.h>
-
-/*
- * NetBSD insists on having <net/if.h> pull in <net/dlt.h>, so that
- * including <net/if.h> defines a bunch of stuff we later define in our
- * pcap/dlt.h; those definitions will be different, if they haven't
- * picked up all of our changes yet.
- *
- * Undefine some of the offending items.
- */
-#ifdef __NetBSD__
-#undef DLT_USB                 /* we now define it as DLT_FREEBSD_USB */
-#undef DLT_MATCHING_MAX                /* we may define more DLT_ values than they do */
-#endif
-
 #endif /* _WIN32 */
 
 #include <ctype.h>
diff --git a/inet.c b/inet.c
index 73929c3d4e49a1a42c49b93e5da34b1e65c21e64..16a483d4963de99995fa21d04fa2cab4b3699180 100644 (file)
--- a/inet.c
+++ b/inet.c
@@ -54,20 +54,6 @@ struct mbuf;         /* Squelch compiler warnings on some platforms for */
 struct rtentry;                /* declarations in <net/if.h> */
 #include <net/if.h>
 #include <netinet/in.h>
-
-/*
- * NetBSD insists on having <net/if.h> pull in <net/dlt.h>, so that
- * including <net/if.h> defines a bunch of stuff we later define in our
- * pcap/dlt.h; those definitions will be different, if they haven't
- * picked up all of our changes yet.
- *
- * Undefine some of the offending items.
- */
-#ifdef __NetBSD__
-#undef DLT_USB                 /* we now define it as DLT_FREEBSD_USB */
-#undef DLT_MATCHING_MAX                /* we may define more DLT_ values than they do */
-#endif
-
 #endif /* _WIN32 */
 
 #include <errno.h>
index 8fc2e8d9f2bfad3f648377f42cba23612d7d0ce6..71280b31c48d73cd46af38c7aee240e10ef60ad0 100644 (file)
@@ -81,20 +81,6 @@ struct mbuf;         /* Squelch compiler warnings on some platforms for */
 struct rtentry;                /* declarations in <net/if.h> */
 #include <net/if.h>    /* for "struct ifnet" in "struct arpcom" on Solaris */
 #include <netinet/if_ether.h>
-
-/*
- * NetBSD insists on having <net/if.h> pull in <net/dlt.h>, so that
- * including <net/if.h> defines a bunch of stuff we later define in our
- * pcap/dlt.h; those definitions will be different, if they haven't
- * picked up all of our changes yet.
- *
- * Undefine some of the offending items.
- */
-#ifdef __NetBSD__
-#undef DLT_USB                 /* we now define it as DLT_FREEBSD_USB */
-#undef DLT_MATCHING_MAX                /* we may define more DLT_ values than they do */
-#endif
-
 #endif /* HAVE_NETINET_IF_ETHER_H */
 #ifdef NETINET_ETHER_H_DECLARES_ETHER_HOSTTON
 #include <netinet/ether.h>
index fb69e3a85c3d989ba64b2319671f89037c643716..4cebe31c636bbf2a62da7573169cf1f48b74135f 100644 (file)
  *
  * This is now used by FreeBSD for its BPF taps for USB; that has its
  * own headers.  So it is written, so it is done.
+ *
+ * For source-code compatibility, we also define DLT_USB to have this
+ * value.  We do it numerically so that, if code that includes this
+ * file (directly or indirectly) also includes an OS header that also
+ * defines DLT_USB as 186, we don't get a redefinition warning.
+ * (NetBSD 7 does that.)
  */
 #define DLT_USB_FREEBSD                186
-#define DLT_USB                        DLT_USB_FREEBSD /* source compatibility */
+#define DLT_USB                        186
 
 /*
  * Bluetooth HCI UART transport layer (part H:4); requested by
  */
 #define DLT_ISO_14443           264
 
+/*
+ * In case the code that includes this file (directly or indirectly)
+ * has also included OS files that happen to define DLT_MATCHING_MAX,
+ * with a different value (perhaps because that OS hasn't picked up
+ * the latest version of our DLT definitions), we undefine the
+ * previous value of DLT_MATCHING_MAX.
+ */
+#ifdef DLT_MATCHING_MAX
+#undef DLT_MATCHING_MAX
+#endif
 #define DLT_MATCHING_MAX       264     /* highest value in the "matching" range */
 
 /*