- Timestamp:
- 04/09/08 11:07:00 (14 years ago)
- 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:
- 0bfd4a0
- Parents:
- de3d203
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_linux.c
rf0fb38f rcdcaef6 87 87 FORMAT(libtrace->format_data)->fd = -1; 88 88 FORMAT(libtrace->format_data)->promisc = -1; 89 FORMAT(libtrace->format_data)->snaplen = 65536;89 FORMAT(libtrace->format_data)->snaplen = LIBTRACE_PACKET_BUFSIZE; 90 90 FORMAT(libtrace->format_data)->filter = NULL; 91 91 FORMAT(libtrace->format_data)->stats_valid = 0; … … 155 155 mreq.mr_ifindex = addr.sll_ifindex; 156 156 mreq.mr_type = PACKET_MR_PROMISC; 157 setsockopt(FORMAT(libtrace->format_data)->fd,157 if (setsockopt(FORMAT(libtrace->format_data)->fd, 158 158 SOL_PACKET, 159 159 PACKET_ADD_MEMBERSHIP, 160 160 &mreq, 161 socklen); 161 socklen)==-1) { 162 perror("setsockopt(PROMISC)"); 163 } 162 164 } 163 165 … … 377 379 if (!packet->buffer || packet->buf_control == TRACE_CTRL_EXTERNAL) { 378 380 packet->buffer = malloc((size_t)LIBTRACE_PACKET_BUFSIZE); 381 if (!packet->buffer) { 382 perror("Cannot allocate buffer"); 383 } 379 384 } 380 385 … … 399 404 msghdr.msg_flags = 0; 400 405 401 iovec.iov_base = (void*)packet-> payload;406 iovec.iov_base = (void*)packet->buffer; 402 407 iovec.iov_len = snaplen; 403 408 -
lib/trace.c
rde3d203 rcdcaef6 547 547 if (trace_is_err(libtrace)) { 548 548 err = trace_get_err(libtrace); 549 } 550 if (*(int*)value<0 551 || *(int*)value>LIBTRACE_PACKET_BUFSIZE) { 552 trace_set_err(libtrace,TRACE_ERR_BAD_STATE, 553 "Invalid snap length"); 549 554 } 550 555 libtrace->snaplen=*(int*)value;
Note: See TracChangeset
for help on using the changeset viewer.