Changeset b56ea4d


Ignore:
Timestamp:
12/10/04 11:24:22 (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:
b597b64
Parents:
b49264a
Message:

improved testing for fragmentation offset - need to mask out top 3 bits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r3fe7937 rb56ea4d  
    686686                        return -1;
    687687                }
    688                 if ((numbytes + dag_record_size) != rlen) {
    689                         printf("read %d wanted %d\n",numbytes +dag_record_size, rlen);
    690                 }
     688                //if ((numbytes + dag_record_size) != rlen) {
     689                //      printf("read %d wanted %d\n",numbytes +dag_record_size, rlen);
     690                //}
    691691                packet->size = rlen;
    692692                       
     
    917917 * @returns a pointer to the TCP header, or NULL if there is not a TCP packet
    918918 */
     919
     920#define SW_IP_OFFMASK 0xff1f
    919921struct libtrace_tcp *trace_get_tcp(struct libtrace_packet_t *packet) {
    920922        struct libtrace_tcp *tcpptr = 0;
     
    923925        if(!(ipptr = trace_get_ip(packet))) {
    924926                return 0;
    925         }
    926         if ((ipptr->ip_p == 6) && (ipptr->ip_off == 0 )) {
     927        }
     928        if ((ipptr->ip_p == 6) && ((ipptr->ip_off & SW_IP_OFFMASK) == 0)) {
    927929                tcpptr = (struct libtrace_tcp *)((ptrdiff_t)ipptr + (ipptr->ip_hl * 4));
    928930        }
     
    944946                return 0;
    945947        }
    946         if (ipptr->ip_p == 17) {
     948        if ((ipptr->ip_p == 17) && ((ipptr->ip_off & SW_IP_OFFMASK) == 0)) {
    947949                udpptr = (struct libtrace_udp *)((ptrdiff_t)ipptr + (ipptr->ip_hl * 4));
    948950        }
     
    964966                return 0;
    965967        }
    966         if (ipptr->ip_p == 1) {
     968        if ((ipptr->ip_p == 1)&& ((ipptr->ip_off & SW_IP_OFFMASK) == 0 )){
    967969                icmpptr = (struct libtrace_icmp *)((ptrdiff_t)ipptr + (ipptr->ip_hl * 4));
    968970        }
Note: See TracChangeset for help on using the changeset viewer.