*** /tmp/,RCSt1a08672 Tue Jun 2 19:07:00 1992 --- interface.h Tue Jun 2 17:57:28 1992 *************** *** 18,24 **** * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ! * @(#) $Header: interface.h,v 1.45 91/11/03 16:35:21 mccanne Exp $ (LBL) */ #ifdef __GNUC__ --- 18,24 ---- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ! * @(#) $Header: interface.h,v 1.46 92/06/02 17:57:22 mccanne Exp $ (LBL) */ #ifdef __GNUC__ *************** *** 35,41 **** extern char *calloc(); #endif - extern int cflag; /* only print 'cnt' packets */ extern int dflag; /* print filter code */ extern int eflag; /* print ethernet header */ extern int nflag; /* leave addresses as numbers */ --- 35,40 ---- *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:01 1992 --- pcap-bpf.c Tue Jun 2 17:57:32 1992 *************** *** 20,26 **** */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-bpf.c,v 1.28 92/05/25 15:40:37 mccanne Exp $ (LBL)"; #endif #include --- 20,26 ---- */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-bpf.c,v 1.29 92/06/02 17:57:29 mccanne Exp $ (LBL)"; #endif #include *************** *** 107,117 **** ep = bp + cc; while (bp < ep) { register int caplen, hdrlen; (*printit)(bp + (hdrlen = bhp->bh_hdrlen), &bhp->bh_tstamp, bhp->bh_datalen, caplen = bhp->bh_caplen); - if (cflag && --cnt == 0) - goto out; bp += BPF_WORDALIGN(caplen + hdrlen); } #undef bhp --- 107,117 ---- ep = bp + cc; while (bp < ep) { register int caplen, hdrlen; + if (cnt >= 0 && --cnt < 0) + goto out; (*printit)(bp + (hdrlen = bhp->bh_hdrlen), &bhp->bh_tstamp, bhp->bh_datalen, caplen = bhp->bh_caplen); bp += BPF_WORDALIGN(caplen + hdrlen); } #undef bhp *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:02 1992 --- pcap-enet.c Tue Jun 2 17:57:34 1992 *************** *** 75,85 **** .th_wirelen ; if (bpf_filter(fcode, (char *)ph->packet, ph->tap.th_wirelen, caplen)) { (*printit)((char *)ph->packet, (struct timeval *)ph->tap.th_timestamp, ph->tap.th_wirelen, caplen); - if (cflag && --cnt == 0) - goto out; } inc = ph->length.PacketOffset; cc -= inc; --- 75,85 ---- .th_wirelen ; if (bpf_filter(fcode, (char *)ph->packet, ph->tap.th_wirelen, caplen)) { + if (cnt >= 0 && --cnt < 0) + goto out; (*printit)((char *)ph->packet, (struct timeval *)ph->tap.th_timestamp, ph->tap.th_wirelen, caplen); } inc = ph->length.PacketOffset; cc -= inc; *************** *** 88,96 **** #else /* !IBMRTPC */ caplen = cc > snaplen ? snaplen : cc ; if (bpf_filter(fcode, buf.hdr.packet, cc, caplen)) { ! (*printit)(buf.hdr.packet, &tv, cc, caplen); ! if (cflag && --cnt == 0) goto out; } #endif /* IBMRTPC */ } --- 88,96 ---- #else /* !IBMRTPC */ caplen = cc > snaplen ? snaplen : cc ; if (bpf_filter(fcode, buf.hdr.packet, cc, caplen)) { ! if (cnt >= 0 && --cnt < 0) goto out; + (*printit)(buf.hdr.packet, &tv, cc, caplen); } #endif /* IBMRTPC */ } *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:04 1992 --- pcap-nit.c Tue Jun 2 17:57:36 1992 *************** *** 20,26 **** */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-nit.c,v 1.13 91/11/02 14:35:27 leres Exp $ (LBL)"; #endif #include --- 20,26 ---- */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-nit.c,v 1.14 92/06/02 17:57:34 mccanne Exp $ (LBL)"; #endif #include *************** *** 70,79 **** { u_char buf[CHUNKSIZE]; struct bpf_insn *fcode; ! int cc, i; fcode = fp->bf_insns; - i = 0; while ((cc = read(if_fd, (char *)buf, sizeof(buf))) > 0) { register u_char *bp, *bstop; --- 70,78 ---- { u_char buf[CHUNKSIZE]; struct bpf_insn *fcode; ! int cc; fcode = fp->bf_insns; while ((cc = read(if_fd, (char *)buf, sizeof(buf))) > 0) { register u_char *bp, *bstop; *************** *** 115,126 **** if (caplen > snaplen) caplen = snaplen; if (bpf_filter(fcode, sp, nh->nh_wirelen, caplen)) { ! (*printit)(sp, &nh->nh_timestamp, ! nh->nh_wirelen, caplen); ! if (cflag && ++i >= cnt) { wrapup(if_fd); return; } } } } --- 114,125 ---- if (caplen > snaplen) caplen = snaplen; if (bpf_filter(fcode, sp, nh->nh_wirelen, caplen)) { ! if (cnt >= 0 && --cnt < 0) { wrapup(if_fd); return; } + (*printit)(sp, &nh->nh_timestamp, + nh->nh_wirelen, caplen); } } } *** /tmp/,RCSt1a08625 Tue Jun 2 19:05:41 1992 --- pcap-pf.c Tue Jun 2 18:57:02 1992 *************** *** 20,26 **** */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-pf.c,v 1.17 91/11/02 14:35:29 leres Exp $ (LBL)"; #endif /* --- 20,26 ---- */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-pf.c,v 1.19 92/06/02 18:56:55 mccanne Exp $ (LBL)"; #endif /* *************** *** 90,96 **** bytes large. */ struct enstamp buf[BUFSPACE / sizeof(struct enstamp)]; - fcode = fp->bf_insns; while (1) { register u_char *bp; --- 90,95 ---- *************** *** 113,124 **** break; } - TotPkts++; - TotDrops += stamp.ens_dropped; - TotMissed = stamp.ens_ifoverflows; - if (OrigMissed < 0) - OrigMissed = TotMissed; - p = bp + stamp.ens_stamplen; buflen = stamp.ens_count; --- 112,117 ---- *************** *** 126,136 **** buflen = snaplen; if (bpf_filter(fcode, p, stamp.ens_count, buflen)) { (*printit)(p, &stamp.ens_tstamp, stamp.ens_count, buflen); - if (cflag && --cnt == 0) - goto out; } inc = ENALIGN(buflen + stamp.ens_stamplen); cc -= inc; bp += inc; --- 119,135 ---- buflen = snaplen; if (bpf_filter(fcode, p, stamp.ens_count, buflen)) { + if (cnt >= 0 && --cnt < 0) + goto out; (*printit)(p, &stamp.ens_tstamp, stamp.ens_count, buflen); } + TotPkts++; + TotDrops += stamp.ens_dropped; + TotMissed = stamp.ens_ifoverflows; + if (OrigMissed < 0) + OrigMissed = TotMissed; + inc = ENALIGN(buflen + stamp.ens_stamplen); cc -= inc; bp += inc; *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:06 1992 --- pcap-snit.c Tue Jun 2 17:57:41 1992 *************** *** 20,26 **** */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-snit.c,v 1.14 91/11/02 14:35:25 leres Exp $ (LBL)"; #endif /* --- 20,26 ---- */ #ifndef lint static char rcsid[] = ! "@(#)$Header: pcap-snit.c,v 1.15 92/06/02 17:57:39 mccanne Exp $ (LBL)"; #endif /* *************** *** 99,111 **** void (*printit)(); { u_char buf[CHUNKSIZE]; ! int cc, i; int drops; struct nit_stat *nsp = &nstat; register struct bpf_insn *fcode = fp->bf_insns; - i = 0; - while ((cc = read(if_fd, (char*)buf, sizeof buf)) >= 0) { register u_char *bp, *cp, *bufstop; struct nit_bufhdr *hdrp; --- 99,109 ---- void (*printit)(); { u_char buf[CHUNKSIZE]; ! int cc; int drops; struct nit_stat *nsp = &nstat; register struct bpf_insn *fcode = fp->bf_insns; while ((cc = read(if_fd, (char*)buf, sizeof buf)) >= 0) { register u_char *bp, *cp, *bufstop; struct nit_bufhdr *hdrp; *************** *** 146,157 **** caplen = snaplen; if (bpf_filter(fcode, cp, nlp->nh_pktlen, caplen)) { ! (*printit)(cp, &ntp->nh_timestamp, ! nlp->nh_pktlen, caplen); ! if (cflag && ++i >= cnt) { wrapup(if_fd); return; } } } } --- 144,155 ---- caplen = snaplen; if (bpf_filter(fcode, cp, nlp->nh_pktlen, caplen)) { ! if (cnt >= 0 && --cnt < 0) { wrapup(if_fd); return; } + (*printit)(cp, &ntp->nh_timestamp, + nlp->nh_pktlen, caplen); } } } *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:08 1992 --- tcpdump.c Tue Jun 2 17:57:44 1992 *************** *** 22,28 **** char copyright[] = "@(#) Copyright (c) 1987-1990 The Regents of the University of California.\nAll rights reserved.\n"; static char rcsid[] = ! "@(#)$Header: tcpdump.c,v 1.67 92/02/17 15:20:35 mccanne Exp $ (LBL)"; #endif /* --- 22,28 ---- char copyright[] = "@(#) Copyright (c) 1987-1990 The Regents of the University of California.\nAll rights reserved.\n"; static char rcsid[] = ! "@(#)$Header: tcpdump.c,v 1.68 92/06/02 17:57:41 mccanne Exp $ (LBL)"; #endif /* *************** *** 51,57 **** int Nflag; /* remove domains from printed host names */ int pflag; /* don't go promiscuous */ int qflag; /* quick (shorter) output */ - int cflag; /* XXX mystery global flag pcap routines want */ int tflag = 1; /* print packet arrival time */ int eflag; /* print ethernet header */ int vflag; /* verbose */ --- 51,56 ---- *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:10 1992 --- tcpslice.c Tue Jun 2 17:57:48 1992 *************** *** 22,28 **** char copyright[] = "@(#) Copyright (c) 1987-1990 The Regents of the University of California.\nAll rights reserved.\n"; static char rcsid[] = ! "@(#)$Header: tcpslice.c,v 1.9 92/02/17 12:08:15 vern Exp $ (LBL)"; #endif /* --- 22,28 ---- char copyright[] = "@(#) Copyright (c) 1987-1990 The Regents of the University of California.\nAll rights reserved.\n"; static char rcsid[] = ! "@(#)$Header: tcpslice.c,v 1.10 92/06/02 17:57:44 mccanne Exp $ (LBL)"; #endif /* *************** *** 42,48 **** #include "version.h" - int cflag = 0; /* global that savefile routines are sensitive to */ int tflag = 0; /* global that util routines are sensitive to */ char *program_name; --- 42,47 ---- *** /tmp/,RCSt1a08672 Tue Jun 2 19:07:12 1992 --- VERSION Tue Jun 2 18:06:19 1992 *************** *** 1 **** ! 2.2 --- 1 ---- ! 2.2.1