Ignore:
Timestamp:
08/28/06 16:55:46 (7 years ago)
Author:
perry
Message:

More error handling
Use a bigger ancillary data buffer to deal with x86_64's bigger timestamps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/format_linux.c

    r955 r960  
    135135        } 
    136136 
    137         setsockopt(FORMAT(libtrace->format_data)->fd, 
     137        if (setsockopt(FORMAT(libtrace->format_data)->fd, 
    138138                        SOL_SOCKET, 
    139139                        SO_TIMESTAMP, 
    140140                        &one, 
    141                         sizeof(one)); 
     141                        sizeof(one))==-1) { 
     142                perror("setsockopt(SO_TIMESTAMP)"); 
     143        } 
    142144 
    143145        return 0; 
     
    210212#define LIBTRACE_MIN(a,b) ((a)<(b) ? (a) : (b)) 
    211213 
    212 /* 20 should be enough */ 
    213 #define CMSG_BUF_SIZE 20 
     214/* 20 isn't enough on x86_64 */ 
     215#define CMSG_BUF_SIZE 128 
    214216static int linuxnative_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet)  
    215217{ 
     
    264266                if (cmsg->cmsg_level == SOL_SOCKET 
    265267                        && cmsg->cmsg_type == SO_TIMESTAMP 
    266                         && cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval))) { 
     268                        && cmsg->cmsg_len <= CMSG_LEN(sizeof(struct timeval))) { 
    267269                        memcpy(&hdr->ts, CMSG_DATA(cmsg), 
    268270                                        sizeof(struct timeval)); 
Note: See TracChangeset for help on using the changeset viewer.