]> The Tcpdump Group git mirrors - libpcap/commitdiff
Pick up changes from NetBSD: libpcap-0.9.6
authorguy <guy>
Mon, 11 Jun 2007 09:52:04 +0000 (09:52 +0000)
committerguy <guy>
Mon, 11 Jun 2007 09:52:04 +0000 (09:52 +0000)
    several files:

date: 2006/02/27 15:53:24;  author: drochner;  state: Exp;
avoid shadowing globals, for WARNS=2

date: 2006/02/27 15:55:30;  author: drochner;  state: Exp;
minor constification, good for WARNS=3 now

date: 2006/02/27 15:57:17;  author: drochner;  state: Exp;
NetBSD adaption:

...

-const pcap_strerror() for consistency

    gencode.c:

date: 2006/04/26 09:24:33;  author: tron;  state: Exp;
Add missing "const" keywords to match declarations in "pcap.h".

date: 2006/10/15 19:27:21;  author: christos;  state: Exp;
add a volatile variable to prevent vfork/longjmp clobbering.

    optimize.c:

date: 2006/05/17 17:48:36;  author: drochner;  state: Exp;
Make the optimizer use unsigned numbers as the kernel does.
While it is not agreed on that purely unsigned arithmetics is nice,
different behaviour of optimized and unoptimized code is less desirable.

    pcap-bpf.c:

date: 2006/02/27 15:51:38;  author: drochner;  state: Exp;
pull in from NetBSD's libpcap: use cloning bpf device on NetBSD

Have the configure script check for paths.h, so that we can include it
only if we have it, and use the cloning BPF device only if we're on
NetBSD *and* _PATH_BPF is defined (hopefully this will keep us from
using it on versions of NetBSD that don't have a cloning BPF device; if,
in the future, other OSes with BPF get cloning BPF devices, we can make
this work for them as well).

16 files changed:
bpf_image.c
config.h.in
configure
configure.in
gencode.c
gencode.h
grammar.y
inet.c
nametoaddr.c
optimize.c
pcap-bpf.c
pcap.3
pcap.c
pcap.h
savefile.c
scanner.l

index 06c0b6ea75bc5d1b0aeb98dc5ebe65ef08331b16..b234a1c48e6d3a35072600e4b5620ba080b47c3d 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/bpf_image.c,v 1.26 2003-11-15 23:23:57 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/bpf_image.c,v 1.26.2.1 2007-06-11 09:52:04 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -43,7 +43,7 @@ bpf_image(p, n)
        int n;
 {
        int v;
-       char *fmt, *op;
+       const char *fmt, *op;
        static char image[256];
        char operand[64];
 
index c7b7763c50c537910e1656be9d48365c52ba1b74..a519d9a74d6f98506abb20e7c943ecc78926c69f 100644 (file)
@@ -56,6 +56,9 @@
 /* if there's an os_proto.h */
 #undef HAVE_OS_PROTO_H
 
+/* Define to 1 if you have the <paths.h> header file. */
+#undef HAVE_PATHS_H
+
 /* define if you have a /proc/net/dev */
 #undef HAVE_PROC_NET_DEV
 
index 3857fb6e93e979c258946f8d2fa9ea0baf7a7b0a..fa4fe5d38b7919d48aaaf1c658c944d7217281e0 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.120.2.10 .
+# From configure.in Revision: 1.120.2.11 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -3518,7 +3518,8 @@ done
 
 
 
-for ac_header in sys/ioccom.h sys/sockio.h limits.h
+
+for ac_header in sys/ioccom.h sys/sockio.h limits.h paths.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
index f6d18a089a144f3d12562af62e183f8d3f0bec79..5451be8022b928672394d97ac08ffa36750eb96f 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120.2.10 2007-02-08 06:03:32 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120.2.11 2007-06-11 09:52:04 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
@@ -6,7 +6,7 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.120.2.10 $)
+AC_REVISION($Revision: 1.120.2.11 $)
 AC_PREREQ(2.50)
 AC_INIT(pcap.c)
 
@@ -26,7 +26,7 @@ dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
 dnl
-AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h)
+AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
 #include <sys/socket.h>])
 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
index 6b644a3739cd430f4abf782803aa0dc2a58d0296..f5081e4f5a9d551f8f448f2f5f1ef02cfb7992e6 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.47 2007-05-30 18:06:38 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.48 2007-06-11 09:52:04 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -348,9 +348,10 @@ int no_optimize;
 
 int
 pcap_compile(pcap_t *p, struct bpf_program *program,
-            char *buf, int optimize, bpf_u_int32 mask)
+            const char *buf, int optimize, bpf_u_int32 mask)
 {
        extern int n_errors;
+       const char * volatile xbuf = buf;
        int len;
 
        no_optimize = 0;
@@ -372,7 +373,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
                return -1;
        }
 
-       lex_init(buf ? buf : "");
+       lex_init(xbuf ? xbuf : "");
        init_linktype(p);
        (void)pcap_parse();
 
@@ -403,7 +404,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
 int
 pcap_compile_nopcap(int snaplen_arg, int linktype_arg,
                    struct bpf_program *program,
-            char *buf, int optimize, bpf_u_int32 mask)
+            const char *buf, int optimize, bpf_u_int32 mask)
 {
        pcap_t *p;
        int ret;
@@ -4762,7 +4763,7 @@ gen_scode(name, q)
        bpf_u_int32 **alist;
 #else
        int tproto6;
-       struct sockaddr_in *sin;
+       struct sockaddr_in *sin4;
        struct sockaddr_in6 *sin6;
        struct addrinfo *res, *res0;
        struct in6_addr mask128;
@@ -4902,9 +4903,9 @@ gen_scode(name, q)
                                        if (tproto == Q_IPV6)
                                                continue;
 
-                                       sin = (struct sockaddr_in *)
+                                       sin4 = (struct sockaddr_in *)
                                                res->ai_addr;
-                                       tmp = gen_host(ntohl(sin->sin_addr.s_addr),
+                                       tmp = gen_host(ntohl(sin4->sin_addr.s_addr),
                                                0xffffffff, tproto, dir, q.addr);
                                        break;
                                case AF_INET6:
@@ -4972,12 +4973,9 @@ gen_scode(name, q)
 #ifndef INET6
                return gen_port(port, real_proto, dir);
 #else
-           {
-               struct block *b;
                b = gen_port(port, real_proto, dir);
                gen_or(gen_port6(port, real_proto, dir), b);
                return b;
-           }
 #endif /* INET6 */
 
        case Q_PORTRANGE:
@@ -5016,12 +5014,9 @@ gen_scode(name, q)
 #ifndef INET6
                return gen_portrange(port1, port2, real_proto, dir);
 #else
-           {
-               struct block *b;
                b = gen_portrange(port1, port2, real_proto, dir);
                gen_or(gen_portrange6(port1, port2, real_proto, dir), b);
                return b;
-           }
 #endif /* INET6 */
 
        case Q_GATEWAY:
@@ -5374,16 +5369,16 @@ xfer_to_a(a)
  * for "index".
  */
 struct arth *
-gen_load(proto, index, size)
+gen_load(proto, inst, size)
        int proto;
-       struct arth *index;
+       struct arth *inst;
        int size;
 {
        struct slist *s, *tmp;
        struct block *b;
        int regno = alloc_reg();
 
-       free_reg(index->regno);
+       free_reg(inst->regno);
        switch (size) {
 
        default:
@@ -5420,14 +5415,14 @@ gen_load(proto, index, size)
                 * Load into the X register the offset computed into the
                 * register specifed by "index".
                 */
-               s = xfer_to_x(index);
+               s = xfer_to_x(inst);
 
                /*
                 * Load the item at that offset.
                 */
                tmp = new_stmt(BPF_LD|BPF_IND|size);
                sappend(s, tmp);
-               sappend(index->s, s);
+               sappend(inst->s, s);
                break;
 
        case Q_LINK:
@@ -5454,11 +5449,11 @@ gen_load(proto, index, size)
                 * by "index".
                 */
                if (s != NULL) {
-                       sappend(s, xfer_to_a(index));
+                       sappend(s, xfer_to_a(inst));
                        sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
                        sappend(s, new_stmt(BPF_MISC|BPF_TAX));
                } else
-                       s = xfer_to_x(index);
+                       s = xfer_to_x(inst);
 
                /*
                 * Load the item at the sum of the offset we've put in the
@@ -5470,7 +5465,7 @@ gen_load(proto, index, size)
                tmp = new_stmt(BPF_LD|BPF_IND|size);
                tmp->s.k = off_ll;
                sappend(s, tmp);
-               sappend(index->s, s);
+               sappend(inst->s, s);
                break;
 
        case Q_IP:
@@ -5503,11 +5498,11 @@ gen_load(proto, index, size)
                 * by "index".
                 */
                if (s != NULL) {
-                       sappend(s, xfer_to_a(index));
+                       sappend(s, xfer_to_a(inst));
                        sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
                        sappend(s, new_stmt(BPF_MISC|BPF_TAX));
                } else
-                       s = xfer_to_x(index);
+                       s = xfer_to_x(inst);
 
                /*
                 * Load the item at the sum of the offset we've put in the
@@ -5520,16 +5515,16 @@ gen_load(proto, index, size)
                tmp = new_stmt(BPF_LD|BPF_IND|size);
                tmp->s.k = off_ll + off_nl;
                sappend(s, tmp);
-               sappend(index->s, s);
+               sappend(inst->s, s);
 
                /*
                 * Do the computation only if the packet contains
                 * the protocol in question.
                 */
                b = gen_proto_abbrev(proto);
-               if (index->b)
-                       gen_and(index->b, b);
-               index->b = b;
+               if (inst->b)
+                       gen_and(inst->b, b);
+               inst->b = b;
                break;
 
        case Q_SCTP:
@@ -5570,12 +5565,12 @@ gen_load(proto, index, size)
                 * fixed-length header preceding the link-layer
                 * header.
                 */
-               sappend(s, xfer_to_a(index));
+               sappend(s, xfer_to_a(inst));
                sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
                sappend(s, new_stmt(BPF_MISC|BPF_TAX));
                sappend(s, tmp = new_stmt(BPF_LD|BPF_IND|size));
                tmp->s.k = off_ll + off_nl;
-               sappend(index->s, s);
+               sappend(inst->s, s);
 
                /*
                 * Do the computation only if the packet contains
@@ -5584,12 +5579,12 @@ gen_load(proto, index, size)
                 * only fragment of that datagram.
                 */
                gen_and(gen_proto_abbrev(proto), b = gen_ipfrag());
-               if (index->b)
-                       gen_and(index->b, b);
+               if (inst->b)
+                       gen_and(inst->b, b);
 #ifdef INET6
                gen_and(gen_proto_abbrev(Q_IP), b);
 #endif
-               index->b = b;
+               inst->b = b;
                break;
 #ifdef INET6
        case Q_ICMPV6:
@@ -5597,12 +5592,12 @@ gen_load(proto, index, size)
                /*NOTREACHED*/
 #endif
        }
-       index->regno = regno;
+       inst->regno = regno;
        s = new_stmt(BPF_ST);
        s->s.k = regno;
-       sappend(index->s, s);
+       sappend(inst->s, s);
 
-       return index;
+       return inst;
 }
 
 struct block *
index a71b1cb33530ad748aee7f08c3275c91855bf064..dc43a07bfb1bbbd5677c813b0f4d9f92ae6e48d5 100644 (file)
--- a/gencode.h
+++ b/gencode.h
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.60.2.10 2007-02-08 07:17:25 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.60.2.11 2007-06-11 09:52:04 guy Exp $ (LBL)
  */
 
 /*
@@ -321,7 +321,7 @@ char *sdup(const char *);
 
 struct bpf_insn *icode_to_fcode(struct block *, int *);
 int pcap_parse(void);
-void lex_init(char *);
+void lex_init(const char *);
 void lex_cleanup(void);
 void sappend(struct slist *, struct slist *);
 
index e2403e3074aabdfcb24e7c769e1a9b37ca3f7558..0aa8bf49480dfdbe489796ce86e041c57cdb8a2c 100644 (file)
--- a/grammar.y
+++ b/grammar.y
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.7 2007-02-08 07:17:25 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.86.2.8 2007-06-11 09:52:04 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -68,7 +68,7 @@ int n_errors = 0;
 static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
 
 static void
-yyerror(char *msg)
+yyerror(const char *msg)
 {
        ++n_errors;
        bpf_error("%s", msg);
diff --git a/inet.c b/inet.c
index d46904e91ae954d9b82086469f428e37300e54c9..44efda999ae2a68c5b4f13c2db828c3b2094db15 100644 (file)
--- a/inet.c
+++ b/inet.c
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.66.2.5 2006-12-30 09:54:16 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.66.2.6 2007-06-11 09:52:04 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -593,7 +593,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
        register char *errbuf;
 {
        register int fd;
-       register struct sockaddr_in *sin;
+       register struct sockaddr_in *sin4;
        struct ifreq ifr;
 
        /*
@@ -637,8 +637,8 @@ pcap_lookupnet(device, netp, maskp, errbuf)
                (void)close(fd);
                return (-1);
        }
-       sin = (struct sockaddr_in *)&ifr.ifr_addr;
-       *netp = sin->sin_addr.s_addr;
+       sin4 = (struct sockaddr_in *)&ifr.ifr_addr;
+       *netp = sin4->sin_addr.s_addr;
        if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
                (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));
@@ -646,7 +646,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
                return (-1);
        }
        (void)close(fd);
-       *maskp = sin->sin_addr.s_addr;
+       *maskp = sin4->sin_addr.s_addr;
        if (*maskp == 0) {
                if (IN_CLASSA(*netp))
                        *maskp = IN_CLASSA_NET;
index 4617d5245a1cb1d54dab6c3252533fdc2801ec48..f2caae72d3dfc7a18f5d0c2c11339e730aef9564 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.77.2.3 2005-04-20 11:13:51 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.77.2.4 2007-06-11 09:52:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -276,7 +276,7 @@ pcap_nametoproto(const char *str)
 #include "ethertype.h"
 
 struct eproto {
-       char *s;
+       const char *s;
        u_short p;
 };
 
@@ -388,7 +388,7 @@ __pcap_atodn(const char *s, bpf_u_int32 *addr)
 
        u_int node, area;
 
-       if (sscanf((char *)s, "%d.%d", &area, &node) != 2)
+       if (sscanf(s, "%d.%d", &area, &node) != 2)
                bpf_error("malformed decnet address '%s'", s);
 
        *addr = (area << AREASHIFT) & AREAMASK;
@@ -474,7 +474,7 @@ pcap_ether_hostton(const char *name)
        u_char a[6];
 
        ap = NULL;
-       if (ether_hostton((char *)name, (struct ether_addr *)a) == 0) {
+       if (ether_hostton(name, (struct ether_addr *)a) == 0) {
                ap = (u_char *)malloc(6);
                if (ap != NULL)
                        memcpy((char *)ap, (char *)a, 6);
index 5cdde19df9a8ab924a9be13713661c4e56a5b4c9..fb46ceefa922783cd8bae2ee8a4076553a445c0e 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.85 2005-04-04 08:42:18 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.85.2.1 2007-06-11 09:52:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -624,7 +624,7 @@ fold_op(s, v0, v1)
        struct stmt *s;
        int v0, v1;
 {
-       bpf_int32 a, b;
+       bpf_u_int32 a, b;
 
        a = vmap[v0].const_val;
        b = vmap[v1].const_val;
@@ -1823,9 +1823,9 @@ intern_blocks(root)
 {
        struct block *p;
        int i, j;
-       int done;
+       int done1; /* don't shadow global */
  top:
-       done = 1;
+       done1 = 1;
        for (i = 0; i < n_blocks; ++i)
                blocks[i]->link = 0;
 
@@ -1849,15 +1849,15 @@ intern_blocks(root)
                if (JT(p) == 0)
                        continue;
                if (JT(p)->link) {
-                       done = 0;
+                       done1 = 0;
                        JT(p) = JT(p)->link;
                }
                if (JF(p)->link) {
-                       done = 0;
+                       done1 = 0;
                        JF(p) = JF(p)->link;
                }
        }
-       if (!done)
+       if (!done1)
                goto top;
 }
 
@@ -2124,7 +2124,7 @@ convert_code_r(p)
            {
                int i;
                int jt, jf;
-               char *ljerr = "%s for block-local relative jump: off=%d";
+               const char *ljerr = "%s for block-local relative jump: off=%d";
 
 #if 0
                printf("code=%x off=%d %x %x\n", src->s.code,
index 7dc1e1f1ce5045bd86b8fb3cfcc40fd7968bf6fb..b00100394bee22f144516e6f736d8941de99cd6f 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.86.2.10 2007-03-26 01:38:46 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.86.2.11 2007-06-11 09:52:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -35,6 +35,13 @@ static const char rcsid[] _U_ =
 #include <sys/ioctl.h>
 #include <sys/utsname.h>
 
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#if defined(__NetBSD__) && defined(_PATH_BPF)
+#define HAVE_CLONING_BPF
+#endif /* __NetBSD__ && _PATH_BPF */
+#endif /* HAVE_PATHS_H */
+
 #include <net/if.h>
 
 #ifdef _AIX
@@ -523,8 +530,12 @@ static inline int
 bpf_open(pcap_t *p, char *errbuf)
 {
        int fd;
+#ifdef HAVE_CLONING_BPF
+       static const char device[] = _PATH_BPF;
+#else
        int n = 0;
        char device[sizeof "/dev/bpf0000000000"];
+#endif
 
 #ifdef _AIX
        /*
@@ -536,6 +547,12 @@ bpf_open(pcap_t *p, char *errbuf)
                return (-1);
 #endif
 
+#ifdef HAVE_CLONING_BPF
+       if ((fd = open(device, O_RDWR)) == -1 &&
+           (errno != EACCES || (fd = open(device, O_RDONLY)) == -1))
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                 "(cannot open device) %s: %s", device, pcap_strerror(errno));
+#else
        /*
         * Go through all the minors and find one that isn't in use.
         */
@@ -566,6 +583,7 @@ bpf_open(pcap_t *p, char *errbuf)
        if (fd < 0)
                snprintf(errbuf, PCAP_ERRBUF_SIZE, "(no devices found) %s: %s",
                    device, pcap_strerror(errno));
+#endif
 
        return (fd);
 }
diff --git a/pcap.3 b/pcap.3
index c6a200ba27c3f66cfe7480e9cab147c2ce66c8e7..90330bfdf131024e81208dd831f11740bba0cf19 100644 (file)
--- a/pcap.3
+++ b/pcap.3
@@ -1,4 +1,4 @@
-.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.64.2.10 2006-10-12 08:01:16 guy Exp $
+.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.64.2.11 2007-06-11 09:52:05 guy Exp $
 .\"
 .\" Copyright (c) 1994, 1996, 1997
 .\"    The Regents of the University of California.  All rights reserved.
@@ -77,7 +77,7 @@ u_char *sp)
 .ft B
 int pcap_compile(pcap_t *p, struct bpf_program *fp,
 .ti +8
-char *str, int optimize, bpf_u_int32 netmask)
+const char *str, int optimize, bpf_u_int32 netmask)
 int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
 void pcap_freecode(struct bpf_program *)
 int pcap_setdirection(pcap_t *p, pcap_direction_t d)
@@ -116,7 +116,7 @@ int pcap_fileno(pcap_t *p)
 int pcap_get_selectable_fd(pcap_t *p);
 void pcap_perror(pcap_t *p, char *prefix)
 char *pcap_geterr(pcap_t *p)
-char *pcap_strerror(int error)
+const char *pcap_strerror(int error)
 const char *pcap_lib_version(void)
 .ft
 .LP
diff --git a/pcap.c b/pcap.c
index 791abb3859b47d8945293b3d6fdf4d3cdaa8a71b..6539ea590c284655891797edce0caefcaed51482 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.88.2.15 2006-10-13 08:56:08 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.88.2.16 2007-06-11 09:52:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -466,8 +466,8 @@ int
 pcap_strcasecmp(const char *s1, const char *s2)
 {
        register const u_char   *cm = charmap,
-                               *us1 = (u_char *)s1,
-                               *us2 = (u_char *)s2;
+                               *us1 = (const u_char *)s1,
+                               *us2 = (const u_char *)s2;
 
        while (cm[*us1] == cm[*us2++])
                if (*us1++ == '\0')
@@ -680,7 +680,7 @@ pcap_win32strerror(void)
 /*
  * Not all systems have strerror().
  */
-char *
+const char *
 pcap_strerror(int errnum)
 {
 #ifdef HAVE_STRERROR
diff --git a/pcap.h b/pcap.h
index 7d07ca9b64e990193d16ecb209c673080c3fe495..722c75c28aa3d91fd18e5ca55f9a12e757571027 100644 (file)
--- a/pcap.h
+++ b/pcap.h
@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.52.2.6 2006-02-09 22:26:49 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.52.2.7 2007-06-11 09:52:05 guy Exp $ (LBL)
  */
 
 #ifndef lib_pcap_h
@@ -237,12 +237,12 @@ int       pcap_setnonblock(pcap_t *, int, char *);
 void   pcap_perror(pcap_t *, char *);
 int    pcap_inject(pcap_t *, const void *, size_t);
 int    pcap_sendpacket(pcap_t *, const u_char *, int);
-char   *pcap_strerror(int);
+const char *pcap_strerror(int);
 char   *pcap_geterr(pcap_t *);
-int    pcap_compile(pcap_t *, struct bpf_program *, char *, int,
+int    pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
            bpf_u_int32);
 int    pcap_compile_nopcap(int, int, struct bpf_program *,
-           char *, int, bpf_u_int32);
+           const char *, int, bpf_u_int32);
 void   pcap_freecode(struct bpf_program *);
 int    pcap_datalink(pcap_t *);
 int    pcap_list_datalinks(pcap_t *, int **);
index 3b4e082fcf189bfa5172976b1ce8a2b2b77e9cdb..45f743e7e0d973582c2184e07fc92e58c259cc39 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.126.2.25 2007-06-05 18:07:03 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.126.2.26 2007-06-11 09:52:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1335,7 +1335,7 @@ pcap_dump(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
        sf_hdr.len        = h->len;
        /* XXX we should check the return status */
        (void)fwrite(&sf_hdr, sizeof(sf_hdr), 1, f);
-       (void)fwrite((char *)sp, h->caplen, 1, f);
+       (void)fwrite(sp, h->caplen, 1, f);
 }
 
 static pcap_dumper_t *
index 31e6d2b530b9dc16d7f576bc0625349e8c00c10f..ca6b5a142536562fe1055c7569459a7f396c3a58 100644 (file)
--- a/scanner.l
+++ b/scanner.l
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.99.2.8 2007-02-08 07:17:25 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.99.2.9 2007-06-11 09:52:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -361,7 +361,7 @@ tcp-urg                     { yylval.i = 0x20; return NUM; }
 %%
 void
 lex_init(buf)
-       char *buf;
+       const char *buf;
 {
 #ifdef FLEX_SCANNER
        in_buffer = yy_scan_string(buf);