Changeset 3b10b9f


Ignore:
Timestamp:
08/28/06 16:55:46 (14 years ago)
Author:
Perry Lorier <perry@…>
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:
64cfd4d
Parents:
4a4cc39
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
  • lib/format_linux.c

    rd0fd73c r3b10b9f  
    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.