diff --git a/inet.c b/inet.c index 77dfb68..a0bc5a8 100644 --- a/inet.c +++ b/inet.c @@ -33,7 +33,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.31 2000-04-27 11:18:02 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.32 2000-04-27 14:24:11 itojun Exp $ (LBL)"; #endif #include @@ -153,7 +153,7 @@ pcap_lookupdev(errbuf) fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { - (void)snprintf(errbuf, PCAP_ERRBUFF_SIZE, + (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); return (NULL); } @@ -164,7 +164,7 @@ pcap_lookupdev(errbuf) buf = malloc (buf_size); if (buf == NULL) { close (fd); - (void)snprintf(errbuf, PCAP_ERRBUFF_SIZE, + (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory"); return (NULL); } @@ -175,7 +175,7 @@ pcap_lookupdev(errbuf) if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 && errno != EINVAL) { free (buf); - (void)snprintf(errbuf, PCAP_ERRBUFF_SIZE, + (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "SIOCGIFCONF: %s", pcap_strerror(errno)); (void)close(fd); return (NULL); diff --git a/pcap-dlpi.c b/pcap-dlpi.c index 84ea338..64b8e5d 100644 --- a/pcap-dlpi.c +++ b/pcap-dlpi.c @@ -38,7 +38,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.55 2000-04-27 11:16:19 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.56 2000-04-27 14:24:12 itojun Exp $ (LBL)"; #endif #include @@ -242,7 +242,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { - strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUFF_SIZE); + strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUF_SIZE); return (NULL); } memset(p, 0, sizeof(*p)); @@ -252,13 +252,13 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) */ cp = strpbrk(device, "0123456789"); if (cp == NULL) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s missing unit number", device); goto bad; } ppa = strtol(cp, &eos, 10); if (*eos != '\0') { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s bad unit number", device); goto bad; } @@ -273,7 +273,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) /* Map network device to /dev/dlpi unit */ cp = "/dev/dlpi"; if ((p->fd = open(cp, O_RDWR)) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s", cp, pcap_strerror(errno)); goto bad; } @@ -288,14 +288,14 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) *cp = '\0'; if ((p->fd = open(dname, O_RDWR)) < 0) { if (errno != ENOENT) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "%s: %s", dname, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s", dname, pcap_strerror(errno)); goto bad; } /* Try again with unit number */ if ((p->fd = open(dname2, O_RDWR)) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "%s: %s", dname2, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s", dname2, pcap_strerror(errno)); goto bad; } @@ -406,7 +406,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) break; default: - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "unknown mac type 0x%lu", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "unknown mac type 0x%lu", infop->dl_mac_type); goto bad; } @@ -416,7 +416,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) ** This is a non standard SunOS hack to get the ethernet header. */ if (strioctl(p->fd, DLIOCRAW, 0, NULL) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "DLIOCRAW: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "DLIOCRAW: %s", pcap_strerror(errno)); goto bad; } @@ -427,7 +427,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) ** Another non standard call to get the data nicely buffered */ if (ioctl(p->fd, I_PUSH, "bufmod") != 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "I_PUSH bufmod: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "I_PUSH bufmod: %s", pcap_strerror(errno)); goto bad; } @@ -455,7 +455,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) #endif if (ss > 0 && strioctl(p->fd, SBIOCSSNAP, sizeof(ss), (char *)&ss) != 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SBIOCSSNAP: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCSSNAP: %s", pcap_strerror(errno)); goto bad; } @@ -464,13 +464,13 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) ** Set up the bufmod flags */ if (strioctl(p->fd, SBIOCGFLAGS, sizeof(flag), (char *)&flag) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SBIOCGFLAGS: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCGFLAGS: %s", pcap_strerror(errno)); goto bad; } flag |= SB_NO_DROPS; if (strioctl(p->fd, SBIOCSFLAGS, sizeof(flag), (char *)&flag) != 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SBIOCSFLAGS: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCSFLAGS: %s", pcap_strerror(errno)); goto bad; } @@ -483,7 +483,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) to.tv_sec = to_ms / 1000; to.tv_usec = (to_ms * 1000) % 1000000; if (strioctl(p->fd, SBIOCSTIME, sizeof(to), (char *)&to) != 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SBIOCSTIME: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCSTIME: %s", pcap_strerror(errno)); goto bad; } @@ -494,7 +494,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) ** As the last operation flush the read side. */ if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "FLUSHR: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s", pcap_strerror(errno)); goto bad; } @@ -528,7 +528,7 @@ send_request(int fd, char *ptr, int len, char *what, char *ebuf) flags = 0; if (putmsg(fd, &ctl, (struct strbuf *) NULL, flags) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "send_request: putmsg \"%s\": %s", what, pcap_strerror(errno)); return (-1); @@ -549,7 +549,7 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf) flags = 0; if (getmsg(fd, &ctl, (struct strbuf*)NULL, &flags) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "recv_ack: %s getmsg: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s getmsg: %s", what, pcap_strerror(errno)); return (-1); } @@ -571,24 +571,24 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf) switch (dlp->error_ack.dl_errno) { case DL_BADPPA: - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s bad ppa (device unit)", what); break; case DL_SYSERR: - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "recv_ack: %s: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s: %s", what, pcap_strerror(dlp->error_ack.dl_unix_errno)); break; case DL_UNSUPPORTED: - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s: Service not supplied by provider", what); break; default: - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s error 0x%x", what, (bpf_u_int32)dlp->error_ack.dl_errno); break; @@ -596,14 +596,14 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf) return (-1); default: - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s unexpected primitive ack 0x%x ", what, (bpf_u_int32)dlp->dl_primitive); return (-1); } if (ctl.len < size) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "recv_ack: %s ack too small (%d < %d)", what, ctl.len, size); return (-1); @@ -754,7 +754,7 @@ get_dlpi_ppa(register int fd, register const char *device, register int unit, bpf_u_int32 buf[MAXDLBUF]; if (stat(device, &statbuf) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "stat: %s: %s", device, pcap_strerror(errno)); return (-1); } @@ -778,12 +778,12 @@ get_dlpi_ppa(register int fd, register const char *device, register int unit, ip = (dl_hp_ppa_info_t *)((u_char *)ip + ip->dl_next_offset); } if (i == ap->dl_count) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "can't find PPA for %s", device); return (-1); } if (ip->dl_hdw_state == HDW_DEAD) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: hardware state: DOWN\n", device); return (-1); } @@ -819,19 +819,19 @@ get_dlpi_ppa(register int fd, register const char *ifname, register int unit, if (cp != NULL) ifname = cp + 1; if (nlist(path_vmunix, &nl) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "nlist %s failed", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "nlist %s failed", path_vmunix); return (-1); } if (nl[NL_IFNET].n_value == 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "could't find %s kernel symbol", nl[NL_IFNET].n_name); return (-1); } kd = open("/dev/kmem", O_RDONLY); if (kd < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "kmem open: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "kmem open: %s", pcap_strerror(errno)); return (-1); } @@ -854,7 +854,7 @@ get_dlpi_ppa(register int fd, register const char *ifname, register int unit, return (ifnet.if_index); } - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "Can't find %s", ifname); + snprintf(ebuf, PCAP_ERRBUF_SIZE, "Can't find %s", ifname); return (-1); } @@ -865,17 +865,17 @@ dlpi_kread(register int fd, register off_t addr, register int cc; if (lseek(fd, addr, SEEK_SET) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "lseek: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "lseek: %s", pcap_strerror(errno)); return (-1); } cc = read(fd, buf, len); if (cc < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "read: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "read: %s", pcap_strerror(errno)); return (-1); } else if (cc != len) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "short read (%d != %d)", cc, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "short read (%d != %d)", cc, len); return (-1); } diff --git a/pcap-linux.c b/pcap-linux.c index 3e07801..b346819 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.17 2000-04-27 11:16:19 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.18 2000-04-27 14:24:12 itojun Exp $ (LBL)"; #endif #include @@ -148,7 +148,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, PCAP_ERRBUFF_SIZE, + snprint(ebuf, PCAP_ERRBUF_SIZE, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); return (NULL); } @@ -157,7 +157,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL)); if (fd < 0) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "socket: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); goto bad; } @@ -168,7 +168,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) sa.sa_family = AF_INET; (void)strncpy(sa.sa_data, device, sizeof(sa.sa_data)); if (bind(p->fd, &sa, sizeof(sa))) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "bind: %s: %s", device, + snprint(ebuf, PCAP_ERRBUF_SIZE, "bind: %s: %s", device, pcap_strerror(errno)); goto bad; } @@ -176,7 +176,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); if (ioctl(p->fd, SIOCGIFHWADDR, &ifr) < 0 ) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "SIOCGIFHWADDR: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "SIOCGIFHWADDR: %s", pcap_strerror(errno)); goto bad; } @@ -256,7 +256,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) #endif default: - snprint(ebuf, PCAP_ERRBUFF_SIZE, + snprint(ebuf, PCAP_ERRBUF_SIZE, "unknown physical layer type 0x%x", ifr.ifr_hwaddr.sa_family); goto bad; @@ -266,7 +266,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); if (ioctl(p->fd, SIOCGIFMTU, &ifr) < 0 ) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "SIOCGIFMTU: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "SIOCGIFMTU: %s", pcap_strerror(errno)); goto bad; } @@ -276,7 +276,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p->buffer = (u_char *)malloc(p->bufsize + p->offset); if (p->buffer == NULL) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "malloc: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); goto bad; } @@ -286,14 +286,14 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); if (ioctl(p->fd, SIOCGIFFLAGS, &ifr) < 0 ) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "SIOCGIFFLAGS: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "SIOCGIFFLAGS: %s", pcap_strerror(errno)); goto bad; } saved_ifr = ifr; ifr.ifr_flags |= IFF_PROMISC; if (ioctl(p->fd, SIOCSIFFLAGS, &ifr) < 0 ) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "SIOCSIFFLAGS: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "SIOCSIFFLAGS: %s", pcap_strerror(errno)); goto bad; } @@ -303,7 +303,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p->md.device = strdup(device); if (p->md.device == NULL) { - snprint(ebuf, PCAP_ERRBUFF_SIZE, "malloc: %s", + snprint(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); goto bad; } diff --git a/pcap-nit.c b/pcap-nit.c index fb4d673..2e3074a 100644 --- a/pcap-nit.c +++ b/pcap-nit.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.33 2000-04-27 11:16:20 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.34 2000-04-27 14:24:12 itojun Exp $ (LBL)"; #endif #include @@ -175,7 +175,7 @@ nit_setflags(int fd, int promisc, int to_ms, char *ebuf) nioc.nioc_flags |= NF_PROMISC; if (ioctl(fd, SIOCSNIT, &nioc) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SIOCSNIT: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SIOCSNIT: %s", pcap_strerror(errno)); return (-1); } @@ -191,7 +191,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { - strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUFF_SIZE); + strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUF_SIZE); return (NULL); } @@ -204,7 +204,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) bzero(p, sizeof(*p)); p->fd = fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW); if (fd < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); goto bad; } @@ -212,7 +212,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) (void)strncpy(snit.snit_ifname, device, NITIFSIZ); if (bind(fd, (struct sockaddr *)&snit, sizeof(snit))) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "bind: %s: %s", snit.snit_ifname, pcap_strerror(errno)); goto bad; } @@ -227,7 +227,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p->bufsize = BUFSPACE; p->buffer = (u_char *)malloc(p->bufsize); if (p->buffer == NULL) { - strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUFF_SIZE); + strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUF_SIZE); goto bad; } return (p); diff --git a/pcap-null.c b/pcap-null.c index 765c7ef..8ec5550 100644 --- a/pcap-null.c +++ b/pcap-null.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-null.c,v 1.9 2000-04-27 11:16:20 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-null.c,v 1.10 2000-04-27 14:24:12 itojun Exp $ (LBL)"; #endif #include /* optionally get BSD define */ @@ -56,7 +56,7 @@ pcap_t * pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) { - (void)strlcpy(ebuf, nosup, PCAP_ERRBUFF_SIZE); + (void)strlcpy(ebuf, nosup, PCAP_ERRBUF_SIZE); return (NULL); } diff --git a/pcap-pf.c b/pcap-pf.c index 7aba3ab..fe4504f 100644 --- a/pcap-pf.c +++ b/pcap-pf.c @@ -24,7 +24,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-pf.c,v 1.55 2000-04-27 09:11:13 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-pf.c,v 1.56 2000-04-27 14:24:13 itojun Exp $ (LBL)"; #endif #include @@ -212,14 +212,14 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "pcap_open_live: %s", pcap_strerror(errno)); return (0); } bzero((char *)p, sizeof(*p)); p->fd = pfopen(device, O_RDONLY); if (p->fd < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "pf open: %s: %s\n\ + snprintf(ebuf, PCAP_ERRBUF_SIZE, "pf open: %s: %s\n\ your system may not be properly configured; see \"man packetfilter(4)\"\n", device, pcap_strerror(errno)); goto bad; @@ -229,7 +229,7 @@ your system may not be properly configured; see \"man packetfilter(4)\"\n", if (promisc) enmode |= ENPROMISC; if (ioctl(p->fd, EIOCMBIS, (caddr_t)&enmode) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "EIOCMBIS: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "EIOCMBIS: %s", pcap_strerror(errno)); goto bad; } @@ -240,13 +240,13 @@ your system may not be properly configured; see \"man packetfilter(4)\"\n", #endif /* set the backlog */ if (ioctl(p->fd, EIOCSETW, (caddr_t)&backlog) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "EIOCSETW: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "EIOCSETW: %s", pcap_strerror(errno)); goto bad; } /* discover interface type */ if (ioctl(p->fd, EIOCDEVP, (caddr_t)&devparams) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "EIOCDEVP: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "EIOCDEVP: %s", pcap_strerror(errno)); goto bad; } @@ -288,7 +288,7 @@ your system may not be properly configured; see \"man packetfilter(4)\"\n", snaplen += pcap_fddipad; #endif if (ioctl(p->fd, EIOCTRUNCATE, (caddr_t)&snaplen) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "EIOCTRUNCATE: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "EIOCTRUNCATE: %s", pcap_strerror(errno)); goto bad; } @@ -298,7 +298,7 @@ your system may not be properly configured; see \"man packetfilter(4)\"\n", Filter.enf_Priority = 37; /* anything > 2 */ Filter.enf_FilterLen = 0; /* means "always true" */ if (ioctl(p->fd, EIOCSETF, (caddr_t)&Filter) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "EIOCSETF: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "EIOCSETF: %s", pcap_strerror(errno)); goto bad; } @@ -308,7 +308,7 @@ your system may not be properly configured; see \"man packetfilter(4)\"\n", timeout.tv_sec = to_ms / 1000; timeout.tv_usec = (to_ms * 1000) % 1000000; if (ioctl(p->fd, EIOCSRTIMEOUT, (caddr_t)&timeout) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "EIOCSRTIMEOUT: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "EIOCSRTIMEOUT: %s", pcap_strerror(errno)); goto bad; } diff --git a/pcap-snit.c b/pcap-snit.c index 3b90df1..c568e08 100644 --- a/pcap-snit.c +++ b/pcap-snit.c @@ -25,7 +25,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.47 2000-04-27 11:16:20 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.48 2000-04-27 14:24:13 itojun Exp $ (LBL)"; #endif #include @@ -182,7 +182,7 @@ nit_setflags(int fd, int promisc, int to_ms, char *ebuf) si.ic_len = sizeof(timeout); si.ic_dp = (char *)&timeout; if (ioctl(fd, I_STR, (char *)&si) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "NIOCSTIME: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "NIOCSTIME: %s", pcap_strerror(errno)); return (-1); } @@ -194,7 +194,7 @@ nit_setflags(int fd, int promisc, int to_ms, char *ebuf) si.ic_len = sizeof(flags); si.ic_dp = (char *)&flags; if (ioctl(fd, I_STR, (char *)&si) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "NIOCSFLAGS: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "NIOCSFLAGS: %s", pcap_strerror(errno)); return (-1); } @@ -213,7 +213,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { - strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUFF_SIZE); + strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUF_SIZE); return (NULL); } @@ -226,19 +226,19 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) bzero(p, sizeof(*p)); p->fd = fd = open(dev, O_RDONLY); if (fd < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "%s: %s", dev, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s", dev, pcap_strerror(errno)); goto bad; } /* arrange to get discrete messages from the STREAM and use NIT_BUF */ if (ioctl(fd, I_SRDOPT, (char *)RMSGD) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "I_SRDOPT: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "I_SRDOPT: %s", pcap_strerror(errno)); goto bad; } if (ioctl(fd, I_PUSH, "nbuf") < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "push nbuf: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "push nbuf: %s", pcap_strerror(errno)); goto bad; } @@ -248,7 +248,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) si.ic_len = sizeof(chunksize); si.ic_dp = (char *)&chunksize; if (ioctl(fd, I_STR, (char *)&si) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "NIOCSCHUNK: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "NIOCSCHUNK: %s", pcap_strerror(errno)); goto bad; } @@ -260,7 +260,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) si.ic_len = sizeof(ifr); si.ic_dp = (char *)𝔦 if (ioctl(fd, I_STR, (char *)&si) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "NIOCBIND: %s: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "NIOCBIND: %s: %s", ifr.ifr_name, pcap_strerror(errno)); goto bad; } @@ -270,7 +270,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) si.ic_len = sizeof(snaplen); si.ic_dp = (char *)&snaplen; if (ioctl(fd, I_STR, (char *)&si) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "NIOCSSNAP: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "NIOCSSNAP: %s", pcap_strerror(errno)); goto bad; } @@ -287,7 +287,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p->bufsize = BUFSPACE; p->buffer = (u_char *)malloc(p->bufsize); if (p->buffer == NULL) { - strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUFF_SIZE); + strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUF_SIZE); goto bad; } return (p); diff --git a/pcap-snoop.c b/pcap-snoop.c index 6557d72..d756864 100644 --- a/pcap-snoop.c +++ b/pcap-snoop.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.22 2000-04-27 09:11:14 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.23 2000-04-27 14:24:13 itojun Exp $ (LBL)"; #endif #include @@ -132,14 +132,14 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "malloc: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); return (NULL); } bzero((char *)p, sizeof(*p)); fd = socket(PF_RAW, SOCK_RAW, RAWPROTO_SNOOP); if (fd < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "snoop socket: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "snoop socket: %s", pcap_strerror(errno)); goto bad; } @@ -148,27 +148,27 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) sr.sr_family = AF_RAW; (void)strncpy(sr.sr_ifname, device, sizeof(sr.sr_ifname)); if (bind(fd, (struct sockaddr *)&sr, sizeof(sr))) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "snoop bind: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "snoop bind: %s", pcap_strerror(errno)); goto bad; } bzero((char *)&sf, sizeof(sf)); if (ioctl(fd, SIOCADDSNOOP, &sf) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SIOCADDSNOOP: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SIOCADDSNOOP: %s", pcap_strerror(errno)); goto bad; } v = 64 * 1024; (void)setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&v, sizeof(v)); if (ioctl(fd, SIOCSNOOPLEN, &snaplen) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SIOCSNOOPLEN: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SIOCSNOOPLEN: %s", pcap_strerror(errno)); goto bad; } p->snapshot = snaplen; v = 1; if (ioctl(fd, SIOCSNOOPING, &v) < 0) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "SIOCSNOOPING: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "SIOCSNOOPING: %s", pcap_strerror(errno)); goto bad; } @@ -198,7 +198,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) } else if (strncmp("lo", device, 2) == 0) { p->linktype = DLT_NULL; } else { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, + snprintf(ebuf, PCAP_ERRBUF_SIZE, "snoop: unknown physical layer type"); goto bad; } @@ -206,7 +206,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) p->bufsize = 4096; /* XXX */ p->buffer = (u_char *)malloc(p->bufsize); if (p->buffer == NULL) { - snprintf(ebuf, PCAP_ERRBUFF_SIZE, "malloc: %s", + snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s", pcap_strerror(errno)); goto bad; } diff --git a/pcap.3 b/pcap.3 index e60a86e..ddb0c85 100644 --- a/pcap.3 +++ b/pcap.3 @@ -100,7 +100,7 @@ in and .B pcap_lookupnet() is assumed to be able to hold at least -.B PCAP_ERRBUFF_SIZE +.B PCAP_ERRBUF_SIZE chars. .PP .B pcap_open_live()