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:
#ifndef lint
static const char rcsid[] _U_ =
#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.27 2007-06-11 10:04:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
static char image[256];
char operand[64];
static char image[256];
char operand[64];
/* if there's an os_proto.h */
#undef HAVE_OS_PROTO_H
/* 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
/* define if you have a /proc/net/dev */
#undef HAVE_PROC_NET_DEV
-# From configure.in Revision: 1.134 .
+# From configure.in Revision: 1.135 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
-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
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
-dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.134 2007-02-08 06:02:42 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.135 2007-06-11 10:04:24 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_REVISION($Revision: 1.134 $)
+AC_REVISION($Revision: 1.135 $)
AC_PREREQ(2.50)
AC_INIT(pcap.c)
AC_PREREQ(2.50)
AC_INIT(pcap.c)
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
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
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
*/
#ifndef lint
static const char rcsid[] _U_ =
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.279 2007-05-30 18:05:21 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.280 2007-06-11 10:04:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
int
pcap_compile(pcap_t *p, struct bpf_program *program,
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)
+ const char * volatile xbuf = buf;
int len;
no_optimize = 0;
int len;
no_optimize = 0;
- lex_init(buf ? buf : "");
+ lex_init(xbuf ? xbuf : "");
init_linktype(p);
(void)pcap_parse();
init_linktype(p);
(void)pcap_parse();
int
pcap_compile_nopcap(int snaplen_arg, int linktype_arg,
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)
bpf_u_int32 **alist;
#else
int tproto6;
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;
struct sockaddr_in6 *sin6;
struct addrinfo *res, *res0;
struct in6_addr mask128;
if (tproto == Q_IPV6)
continue;
if (tproto == Q_IPV6)
continue;
- sin = (struct sockaddr_in *)
+ sin4 = (struct sockaddr_in *)
- 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:
0xffffffff, tproto, dir, q.addr);
break;
case AF_INET6:
#ifndef INET6
return gen_port(port, real_proto, dir);
#else
#ifndef INET6
return gen_port(port, real_proto, dir);
#else
b = gen_port(port, real_proto, dir);
gen_or(gen_port6(port, real_proto, dir), b);
return b;
b = gen_port(port, real_proto, dir);
gen_or(gen_port6(port, real_proto, dir), b);
return b;
#endif /* INET6 */
case Q_PORTRANGE:
#endif /* INET6 */
case Q_PORTRANGE:
#ifndef INET6
return gen_portrange(port1, port2, real_proto, dir);
#else
#ifndef INET6
return gen_portrange(port1, port2, real_proto, dir);
#else
b = gen_portrange(port1, port2, real_proto, dir);
gen_or(gen_portrange6(port1, port2, real_proto, dir), b);
return 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:
#endif /* INET6 */
case Q_GATEWAY:
* for "index".
*/
struct arth *
* for "index".
*/
struct arth *
-gen_load(proto, index, size)
+gen_load(proto, inst, size)
int size;
{
struct slist *s, *tmp;
struct block *b;
int regno = alloc_reg();
int size;
{
struct slist *s, *tmp;
struct block *b;
int regno = alloc_reg();
- free_reg(index->regno);
* Load into the X register the offset computed into the
* register specifed by "index".
*/
* Load into the X register the offset computed into the
* register specifed by "index".
*/
/*
* Load the item at that offset.
*/
tmp = new_stmt(BPF_LD|BPF_IND|size);
sappend(s, tmp);
/*
* Load the item at that offset.
*/
tmp = new_stmt(BPF_LD|BPF_IND|size);
sappend(s, tmp);
* by "index".
*/
if (s != NULL) {
* 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
sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
sappend(s, new_stmt(BPF_MISC|BPF_TAX));
} else
/*
* Load the item at the sum of the offset we've put in the
/*
* Load the item at the sum of the offset we've put in the
tmp = new_stmt(BPF_LD|BPF_IND|size);
tmp->s.k = off_ll;
sappend(s, tmp);
tmp = new_stmt(BPF_LD|BPF_IND|size);
tmp->s.k = off_ll;
sappend(s, tmp);
* by "index".
*/
if (s != NULL) {
* 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
sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
sappend(s, new_stmt(BPF_MISC|BPF_TAX));
} else
/*
* Load the item at the sum of the offset we've put in the
/*
* Load the item at the sum of the offset we've put in the
tmp = new_stmt(BPF_LD|BPF_IND|size);
tmp->s.k = off_ll + off_nl;
sappend(s, tmp);
tmp = new_stmt(BPF_LD|BPF_IND|size);
tmp->s.k = off_ll + off_nl;
sappend(s, tmp);
/*
* Do the computation only if the packet contains
* the protocol in question.
*/
b = gen_proto_abbrev(proto);
/*
* 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;
* fixed-length header preceding the link-layer
* header.
*/
* 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(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;
/*
* Do the computation only if the packet contains
/*
* Do the computation only if the packet contains
* only fragment of that datagram.
*/
gen_and(gen_proto_abbrev(proto), b = gen_ipfrag());
* 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
#ifdef INET6
gen_and(gen_proto_abbrev(Q_IP), b);
#endif
break;
#ifdef INET6
case Q_ICMPV6:
break;
#ifdef INET6
case Q_ICMPV6:
s = new_stmt(BPF_ST);
s->s.k = regno;
s = new_stmt(BPF_ST);
s->s.k = regno;
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.69 2007-03-11 04:35:24 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.70 2007-06-11 10:04:25 guy Exp $ (LBL)
struct bpf_insn *icode_to_fcode(struct block *, int *);
int pcap_parse(void);
struct bpf_insn *icode_to_fcode(struct block *, int *);
int pcap_parse(void);
+void lex_init(const char *);
void lex_cleanup(void);
void sappend(struct slist *, struct slist *);
void lex_cleanup(void);
void sappend(struct slist *, struct slist *);
*/
#ifndef lint
static const char rcsid[] _U_ =
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.96 2007-03-11 04:35:24 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.97 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
static void
static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
static void
+yyerror(const char *msg)
{
++n_errors;
bpf_error("%s", msg);
{
++n_errors;
bpf_error("%s", msg);
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.74 2006-12-30 09:54:57 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.75 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
register char *errbuf;
{
register int fd;
register char *errbuf;
{
register int fd;
- register struct sockaddr_in *sin;
+ register struct sockaddr_in *sin4;
(void)close(fd);
return (-1);
}
(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));
if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));
return (-1);
}
(void)close(fd);
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;
if (*maskp == 0) {
if (IN_CLASSA(*netp))
*maskp = IN_CLASSA_NET;
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.81 2006-10-04 18:09:22 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.82 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
#include "ethertype.h"
struct eproto {
#include "ethertype.h"
struct eproto {
- 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;
bpf_error("malformed decnet address '%s'", s);
*addr = (area << AREASHIFT) & AREAMASK;
- 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);
ap = (u_char *)malloc(6);
if (ap != NULL)
memcpy((char *)ap, (char *)a, 6);
*/
#ifndef lint
static const char rcsid[] _U_ =
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.86 2005-07-31 17:58:24 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.87 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
struct stmt *s;
int v0, v1;
{
struct stmt *s;
int v0, v1;
{
a = vmap[v0].const_val;
b = vmap[v1].const_val;
a = vmap[v0].const_val;
b = vmap[v1].const_val;
{
struct block *p;
int i, j;
{
struct block *p;
int i, j;
+ int done1; /* don't shadow global */
for (i = 0; i < n_blocks; ++i)
blocks[i]->link = 0;
for (i = 0; i < n_blocks; ++i)
blocks[i]->link = 0;
if (JT(p) == 0)
continue;
if (JT(p)->link) {
if (JT(p) == 0)
continue;
if (JT(p)->link) {
JT(p) = JT(p)->link;
}
if (JF(p)->link) {
JT(p) = JT(p)->link;
}
if (JF(p)->link) {
- 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,
#if 0
printf("code=%x off=%d %x %x\n", src->s.code,
*/
#ifndef lint
static const char rcsid[] _U_ =
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.97 2007-03-26 01:38:25 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.98 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
#include <sys/ioctl.h>
#include <sys/utsname.h>
#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
#include <net/if.h>
#ifdef _AIX
bpf_open(pcap_t *p, char *errbuf)
{
int fd;
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"];
int n = 0;
char device[sizeof "/dev/bpf0000000000"];
+#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.
*/
/*
* Go through all the minors and find one that isn't in use.
*/
if (fd < 0)
snprintf(errbuf, PCAP_ERRBUF_SIZE, "(no devices found) %s: %s",
device, pcap_strerror(errno));
if (fd < 0)
snprintf(errbuf, PCAP_ERRBUF_SIZE, "(no devices found) %s: %s",
device, pcap_strerror(errno));
-.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.74 2006-10-12 07:59:54 guy Exp $
+.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.75 2007-06-11 10:04:25 guy Exp $
.\"
.\" Copyright (c) 1994, 1996, 1997
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Copyright (c) 1994, 1996, 1997
.\" The Regents of the University of California. All rights reserved.
.ft B
int pcap_compile(pcap_t *p, struct bpf_program *fp,
.ti +8
.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)
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)
int pcap_get_selectable_fd(pcap_t *p);
void pcap_perror(pcap_t *p, char *prefix)
char *pcap_geterr(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
const char *pcap_lib_version(void)
.ft
.LP
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.104 2006-12-20 03:30:32 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.105 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
pcap_strcasecmp(const char *s1, const char *s2)
{
register const u_char *cm = charmap,
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')
while (cm[*us1] == cm[*us2++])
if (*us1++ == '\0')
/*
* Not all systems have strerror().
*/
/*
* Not all systems have strerror().
*/
pcap_strerror(int errnum)
{
#ifdef HAVE_STRERROR
pcap_strerror(int errnum)
{
#ifdef HAVE_STRERROR
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.1 2006-10-04 18:09:22 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.2 2007-06-11 10:04:25 guy Exp $ (LBL)
*/
#ifndef lib_pcap_pcap_h
*/
#ifndef lib_pcap_pcap_h
void pcap_perror(pcap_t *, char *);
int pcap_inject(pcap_t *, const void *, size_t);
int pcap_sendpacket(pcap_t *, const u_char *, int);
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 *);
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 *,
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 **);
void pcap_freecode(struct bpf_program *);
int pcap_datalink(pcap_t *);
int pcap_list_datalinks(pcap_t *, int **);
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.157 2007-06-05 18:02:29 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.158 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
sf_hdr.len = h->len;
/* XXX we should check the return status */
(void)fwrite(&sf_hdr, sizeof(sf_hdr), 1, f);
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);
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.109 2007-03-11 04:35:24 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.110 2007-06-11 10:04:25 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
{
#ifdef FLEX_SCANNER
in_buffer = yy_scan_string(buf);
{
#ifdef FLEX_SCANNER
in_buffer = yy_scan_string(buf);