Changeset be54c88 for lib/trace.c


Ignore:
Timestamp:
07/21/04 10:01:21 (17 years ago)
Author:
Daniel Lawson <dlawson@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
c837874
Parents:
781cf2c
Message:

removed some bad debugging stuff i left in. assert(0) doesn't play nice in random places

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r277442c rbe54c88  
    429429        assert(buffer);
    430430        assert(status);
    431         assert(len > 104); // we know we see packets this big anyway. Don't be silly.
     431        assert(len > 200);
    432432
    433433        bzero(buffer,len);
    434434       
     435        /* PCAP gives us it's own per-packet interface. Let's use it */
    435436        if (libtrace->format == PCAP || libtrace->format == PCAPINT) {
    436437                if ((pcappkt = pcap_next(libtrace->input.pcap, &pcaphdr)) == NULL) {
     
    444445        }
    445446
     447        /* If we're reading from an ERF input, it's an offline trace. We can make some assumptions */
     448        if (libtrace->format == ERF) {
     449                void *buffer2 = buffer;
     450                // read in the trace header
     451                if ((numbytes=gzread(libtrace->input.file,
     452                                                buffer,
     453                                                sizeof(dag_record_t))) == -1) {
     454                        perror("gzread");
     455                        return -1;
     456                }
     457                if (numbytes == 0) {
     458                        return 0;
     459                }
     460                size = ntohs(((dag_record_t *)buffer)->rlen) - sizeof(dag_record_t);
     461                assert(len > size);
     462                buffer2 += sizeof(dag_record_t);
     463
     464                // read in the rest of the packet
     465                if ((numbytes=gzread(libtrace->input.file,
     466                                                buffer2,
     467                                                size)) == -1) {
     468                        perror("gzread");
     469                        return -1;
     470                }
     471                return sizeof(dag_record_t) + numbytes;
     472        }
    446473        do {
    447474                if (fifo_out_available(libtrace->fifo) == 0 || read_required) {
     
    11131140
    11141141        assert(filter->filter);
    1115         printf("%d %d\n",clen,ntohs(clen));
    11161142        return bpf_filter(filter->filter, linkptr, clen, clen);
    11171143       
Note: See TracChangeset for help on using the changeset viewer.