Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libpcap - add our fixes



details:   https://anonhg.NetBSD.org/src/rev/727e41fb71c6
branches:  trunk
changeset: 759271:727e41fb71c6
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Dec 05 01:45:46 2010 +0000

description:
- add our fixes
- make compile with WARNS=5
- add glue

diffstat:

 external/bsd/libpcap/Makefile           |    5 +
 external/bsd/libpcap/dist/gencode.c     |    4 +-
 external/bsd/libpcap/dist/optimize.c    |   10 +-
 external/bsd/libpcap/dist/pcap-bpf.c    |   13 +-
 external/bsd/libpcap/dist/pcap-namedb.h |    2 +
 external/bsd/libpcap/dist/pcap.c        |    3 +-
 external/bsd/libpcap/dist/pcap.h        |    2 +
 external/bsd/libpcap/dist/pcap/bpf.h    |    2 +-
 external/bsd/libpcap/dist/scanner.l     |    3 +-
 external/bsd/libpcap/include/config.h   |  279 ++++++++++++++++++++++++++++++++
 external/bsd/libpcap/lib/Makefile       |   98 +++++++++++
 external/bsd/libpcap/lib/shlib_version  |    5 +
 external/bsd/libpcap/lib/version.c      |    3 +
 external/bsd/libpcap/lib/version.h      |    3 +
 14 files changed, 417 insertions(+), 15 deletions(-)

diffs (truncated from 613 to 300 lines):

diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libpcap/Makefile     Sun Dec 05 01:45:46 2010 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: Makefile,v 1.1 2010/12/05 01:45:46 christos Exp $
+
+SUBDIR=        lib
+
+.include <bsd.subdir.mk>
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/gencode.c
--- a/external/bsd/libpcap/dist/gencode.c       Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/gencode.c       Sun Dec 05 01:45:46 2010 +0000
@@ -6119,7 +6119,7 @@
                        ai = res;
                        b = tmp = NULL;
                        tproto = tproto6 = proto;
-                       if (off_linktype == -1 && tproto == Q_DEFAULT) {
+                       if (off_linktype == (u_int)-1 && tproto == Q_DEFAULT) {
                                tproto = Q_IP;
                                tproto6 = Q_IPV6;
                        }
@@ -6468,7 +6468,7 @@
                bpf_error("%s resolved to multiple address", s1);
        addr = &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr;
 
-       if (sizeof(mask) * 8 < masklen)
+       if ((int)sizeof(mask) * 8 < masklen)
                bpf_error("mask length must be <= %u", (unsigned int)(sizeof(mask) * 8));
        memset(&mask, 0, sizeof(mask));
        memset(&mask, 0xff, masklen / 8);
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/optimize.c
--- a/external/bsd/libpcap/dist/optimize.c      Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/optimize.c      Sun Dec 05 01:45:46 2010 +0000
@@ -920,7 +920,7 @@
        if (b->s.code == (BPF_JMP|BPF_K|BPF_JSET)) {
                if (b->s.k == 0)
                        JT(b) = JF(b);
-               if (b->s.k == 0xffffffff)
+               if (b->s.k == (int)0xffffffff)
                        JF(b) = JT(b);
        }
        /*
@@ -948,11 +948,11 @@
                        break;
 
                case BPF_JGT:
-                       v = (unsigned)v > b->s.k;
+                       v = (unsigned)v > (unsigned)b->s.k;
                        break;
 
                case BPF_JGE:
-                       v = (unsigned)v >= b->s.k;
+                       v = (unsigned)v >= (unsigned)b->s.k;
                        break;
 
                case BPF_JSET:
@@ -2093,7 +2093,7 @@
 {
        struct bpf_insn *dst;
        struct slist *src;
-       int slen;
+       u_int slen;
        u_int off;
        int extrajmps;          /* number of extra jumps inserted */
        struct slist **offset = NULL;
@@ -2151,7 +2151,7 @@
                        goto filled;
 
            {
-               int i;
+               u_int i;
                int jt, jf;
                const char *ljerr = "%s for block-local relative jump: off=%d";
 
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/pcap-bpf.c
--- a/external/bsd/libpcap/dist/pcap-bpf.c      Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/pcap-bpf.c      Sun Dec 05 01:45:46 2010 +0000
@@ -51,6 +51,9 @@
 #include <sys/ioccom.h>
 #endif
 #include <sys/utsname.h>
+#ifdef __NetBSD__
+#include <paths.h>
+#endif
 
 #ifdef HAVE_ZEROCOPY_BPF
 #include <machine/atomic.h>
@@ -773,7 +776,7 @@
        register u_char *bp, *ep;
        u_char *datap;
 #ifdef PCAP_FDDIPAD
-       register int pad;
+       register u_int pad;
 #endif
 #ifdef HAVE_ZEROCOPY_BPF
        int i;
@@ -898,7 +901,7 @@
        pad = p->fddipad;
 #endif
        while (bp < ep) {
-               register int caplen, hdrlen;
+               register u_int caplen, hdrlen;
 
                /*
                 * Has "pcap_breakloop()" been called?
@@ -1401,7 +1404,7 @@
 #ifdef BIOCGDLTLIST
        struct bpf_dltlist bdl;
 #if defined(__APPLE__) || defined(HAVE_BSD_IEEE80211)
-       int new_dlt;
+       u_int new_dlt;
 #endif
 #endif /* BIOCGDLTLIST */
 #if defined(BIOCGHDRCMPLT) && defined(BIOCSHDRCMPLT)
@@ -1873,7 +1876,7 @@
                 * already in that mode.
                 */
                new_dlt = find_802_11(&bdl);
-               if (new_dlt != -1) {
+               if (new_dlt != (unsigned)-1) {
                        /*
                         * We have at least one 802.11 DLT_ value.
                         * new_dlt is the best of the 802.11
@@ -2343,7 +2346,7 @@
 find_802_11(struct bpf_dltlist *bdlp)
 {
        int new_dlt;
-       int i;
+       u_int i;
 
        /*
         * Scan the list of DLT_ values, looking for 802.11 values,
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/pcap-namedb.h
--- a/external/bsd/libpcap/dist/pcap-namedb.h   Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/pcap-namedb.h   Sun Dec 05 01:45:46 2010 +0000
@@ -1,3 +1,5 @@
+/* $NetBSD: pcap-namedb.h,v 1.2 2010/12/05 01:45:46 christos Exp $ */
+
 /*
  * Copyright (c) 1994, 1996
  *     The Regents of the University of California.  All rights reserved.
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/pcap.c
--- a/external/bsd/libpcap/dist/pcap.c  Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/pcap.c  Sun Dec 05 01:45:46 2010 +0000
@@ -532,7 +532,7 @@
                return (0);
        }
        for (i = 0; i < p->dlt_count; i++)
-               if (p->dlt_list[i] == dlt)
+               if (p->dlt_list[i] == (u_int)dlt)
                        break;
        if (i >= p->dlt_count)
                goto unsupported;
@@ -604,6 +604,7 @@
        DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"),
        DLT_CHOICE(DLT_LTALK, "Localtalk"),
        DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"),
+       DLT_CHOICE(DLT_PFSYNC, "Packet filter state syncing"),   
        DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"),
        DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"),
        DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"),
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/pcap.h
--- a/external/bsd/libpcap/dist/pcap.h  Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/pcap.h  Sun Dec 05 01:45:46 2010 +0000
@@ -32,6 +32,8 @@
  *
  * @(#) Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006-10-04 18:09:22 guy Exp (LBL)
  */
+/* $NetBSD: pcap.h,v 1.2 2010/12/05 01:45:46 christos Exp $ */
+
 
 /*
  * For backwards compatibility.
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/pcap/bpf.h
--- a/external/bsd/libpcap/dist/pcap/bpf.h      Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/pcap/bpf.h      Sun Dec 05 01:45:46 2010 +0000
@@ -298,7 +298,7 @@
  *
  * XXX: is there a conflict with DLT_PFSYNC 18 as well?
  */
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
 #define DLT_OLD_PFLOG  17
 #define DLT_PFSYNC     18
 #endif
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/dist/scanner.l
--- a/external/bsd/libpcap/dist/scanner.l       Sun Dec 05 01:28:28 2010 +0000
+++ b/external/bsd/libpcap/dist/scanner.l       Sun Dec 05 01:45:46 2010 +0000
@@ -77,7 +77,6 @@
 static inline int xdtoi(int);
 
 #ifdef FLEX_SCANNER
-#define YY_NO_UNPUT
 static YY_BUFFER_STATE in_buffer;
 #else
 static const char *in_buffer;
@@ -185,6 +184,8 @@
 
 
 
+%option nounput
+
 %%
 dst            return DST;
 src            return SRC;
diff -r 9e69f263602e -r 727e41fb71c6 external/bsd/libpcap/include/config.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libpcap/include/config.h     Sun Dec 05 01:45:46 2010 +0000
@@ -0,0 +1,279 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Enable optimizer debugging */
+/* #undef BDEBUG */
+
+/* define if you have a cloning BPF device */
+/* #undef HAVE_CLONING_BPF */
+
+/* define if you have the DAG API */
+/* #undef HAVE_DAG_API */
+
+/* define if you have dag_get_erf_types() */
+/* #undef HAVE_DAG_GET_ERF_TYPES */
+
+/* define if you have dag_get_stream_erf_types() */
+/* #undef HAVE_DAG_GET_STREAM_ERF_TYPES */
+
+/* define if you have streams capable DAG API */
+/* #undef HAVE_DAG_STREAMS_API */
+
+/* Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
+   don't. */
+#define HAVE_DECL_ETHER_HOSTTON 1
+
+/* define if you have a /dev/dlpi */
+/* #undef HAVE_DEV_DLPI */
+
+/* if passive_req_t primitive exists */
+/* #undef HAVE_DLPI_PASSIVE */
+
+/* Define to 1 if you have the `ether_hostton' function. */
+#define HAVE_ETHER_HOSTTON 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#define HAVE_FSEEKO 1
+
+/* on HP-UX 10.20 or later */
+/* #undef HAVE_HPUX10_20_OR_LATER */
+
+/* on HP-UX 9.x */
+/* #undef HAVE_HPUX9 */
+
+/* if ppa_info_t_dl_module_id exists */
+/* #undef HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* if libdlpi exists */
+/* #undef HAVE_LIBDLPI */
+
+/* if libnl exists */
+/* #undef HAVE_LIBNL */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* if tp_vlan_tci exists */
+/* #undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI */
+
+/* Define to 1 if you have the <linux/usbdevice_fs.h> header file. */
+/* #undef HAVE_LINUX_USBDEVICE_FS_H */
+
+/* Define to 1 if you have the <linux/wireless.h> header file. */
+/* #undef HAVE_LINUX_WIRELESS_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/ether.h> header file. */
+/* #undef HAVE_NETINET_ETHER_H */
+
+/* Define to 1 if you have the <netinet/if_ether.h> header file. */
+#define HAVE_NETINET_IF_ETHER_H 1
+
+/* Define to 1 if you have the <net/if_media.h> header file. */
+#define HAVE_NET_IF_MEDIA_H 1
+
+/* Define to 1 if you have the <net/pfvar.h> header file. */
+#define HAVE_NET_PFVAR_H 1
+
+/* if there's an os_proto.h for this platform, to use additional prototypes */
+/* #undef HAVE_OS_PROTO_H */
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
+/* define if net/pfvar.h defines PF_NAT through PF_NORDR */
+#define HAVE_PF_NAT_THROUGH_PF_NORDR 1
+



Home | Main Index | Thread Index | Old Index