Changeset 1577


Ignore:
Timestamp:
05/04/10 16:08:24 (3 years ago)
Author:
perry
Message:

The spec says that it's the IP header + first 16 bytes of transport, but lets just assume everyones
lazy and just captures the first 'n' bytes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/format_tsh.c

    r1519 r1577  
    153153        if ((numbytes=wandio_read(libtrace->io, 
    154154                                buffer2, 
    155                                 (size_t)sizeof(libtrace_ip_t)))  
    156                         != sizeof(libtrace_ip_t)) { 
     155                                (size_t)sizeof(libtrace_ip_t)+16))  /* 16 bytes of transport header */ 
     156                        != sizeof(libtrace_ip_t)+16) { 
    157157                trace_set_err(libtrace,errno,"read(%s)", 
    158158                                libtrace->uridata); 
     
    160160        } 
    161161 
     162#if 0 
    162163        /* IP Options aren't captured in the trace, so leave room 
    163164         * for them, and put the transport header where it "should" be 
     
    173174                return -1; 
    174175        } 
     176#endif 
    175177         
    176178        if (tsh_prepare_packet(libtrace, packet, packet->buffer, packet->type,  
     
    204206         * IP options, but we'll pretend we have them 
    205207         */ 
     208#if 0 
    206209        return 16+((libtrace_ip_t*)packet->payload)->ip_hl*4; 
     210#else 
     211        return 16+sizeof(libtrace_ip_t); 
     212#endif 
    207213} 
    208214 
    209215static int tsh_get_wire_length(const libtrace_packet_t *packet) { 
    210         return ((libtrace_ip_t*)packet->payload)->ip_len; 
     216        return ntohs(((libtrace_ip_t*)packet->payload)->ip_len); 
    211217} 
    212218 
Note: See TracChangeset for help on using the changeset viewer.