- Timestamp:
- 01/15/15 13:57:47 (6 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
- d97778c
- Parents:
- 4cc6e74 (diff), 21f3226 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_dag25.c
rc66a465 r97d170d 161 161 * structures. Most of the stuff above doesn't get used in parallel mode. */ 162 162 struct dag_per_thread_t *per_thread; 163 164 uint8_t seeninterface[4]; 163 165 }; 164 166 … … 241 243 FORMAT_DATA->bottom = NULL; 242 244 FORMAT_DATA->top = NULL; 245 memset(FORMAT_DATA->seeninterface, 0, sizeof(FORMAT_DATA->seeninterface)); 243 246 } 244 247 … … 290 293 dag_close(dev->fd); 291 294 if (dev->dev_name) 292 free(dev->dev_name);295 free(dev->dev_name); 293 296 free(dev); 294 297 } … … 575 578 576 579 if (dag_attach_stream(FORMAT_DATA_OUT->device->fd, 577 FORMAT_DATA_OUT->dagstream, 0, 1048576) < 0) {580 FORMAT_DATA_OUT->dagstream, 0, 4 * 1024 * 1024) < 0) { 578 581 trace_set_err_out(libtrace, errno, "Cannot attach DAG stream"); 579 582 return -1; … … 599 602 static int dag_start_input(libtrace_t *libtrace) { 600 603 struct timeval zero, nopoll; 601 uint8_t *top, *bottom ;602 uint 8_t diff = 0;604 uint8_t *top, *bottom, *starttop; 605 uint64_t diff = 0; 603 606 top = bottom = NULL; 604 607 … … 626 629 &nopoll); 627 630 631 starttop = dag_advance_stream(FORMAT_DATA->device->fd, 632 FORMAT_DATA->dagstream, 633 &bottom); 634 628 635 /* Should probably flush the memory hole now */ 629 do { 636 while (starttop - bottom > 0) { 637 bottom += (starttop - bottom); 630 638 top = dag_advance_stream(FORMAT_DATA->device->fd, 631 639 FORMAT_DATA->dagstream, 632 640 &bottom); 633 assert(top && bottom); 634 diff = top - bottom; 635 bottom -= diff; 636 } while (diff != 0); 637 FORMAT_DATA->top = NULL; 638 FORMAT_DATA->bottom = NULL; 641 } 642 FORMAT_DATA->top = top; 643 FORMAT_DATA->bottom = bottom; 639 644 FORMAT_DATA->processed = 0; 640 645 FORMAT_DATA->drops = 0; … … 867 872 PERPKT_DATA(t)->drops += ntohs(erfptr->lctr); 868 873 } else { 869 printf("DROP!\n"); 870 DATA(libtrace)->drops += ntohs(erfptr->lctr); 874 if (FORMAT_DATA->seeninterface[erfptr->flags.iface] == 0) { 875 FORMAT_DATA->seeninterface[erfptr->flags.iface] = 1; 876 } else { 877 FORMAT_DATA->drops += ntohs(erfptr->lctr); 878 } 871 879 } 872 880 } -
lib/format_erf.c
r9e429e8 r97d170d 480 480 packet->buffer, 481 481 (size_t)dag_record_size)) == -1) { 482 trace_set_err(libtrace,errno,"read(%s)", 483 libtrace->uridata); 482 trace_set_err(libtrace,errno,"reading ERF file"); 484 483 return -1; 485 484 } … … 488 487 return 0; 489 488 } 489 490 if (numbytes < (int)dag_record_size) { 491 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, "Incomplete ERF header"); 492 return -1; 493 } 490 494 491 495 rlen = ntohs(((dag_record_t *)packet->buffer)->rlen); … … 522 526 return -1; 523 527 } 528 529 if (numbytes < (int)size) { 530 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, "Incomplete ERF record"); 531 return -1; 532 } 524 533 525 534 if (erf_prepare_packet(libtrace, packet, packet->buffer, -
lib/format_pcapfile.c
r9e429e8 r97d170d 210 210 211 211 if (err<1) { 212 if (err == 0) { 213 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, 214 "Reading pcap file header\n"); 215 } 212 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, 213 "Error while reading pcap file header\n"); 216 214 return -1; 217 215 } 218 216 217 if (err != (int)sizeof(DATA(libtrace)->header)) { 218 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, 219 "Incomplete pcap file header"); 220 return -1; 221 } 222 219 223 if (!header_is_magic(&(DATA(libtrace)->header))) { 220 224 trace_set_err(libtrace,TRACE_ERR_INIT_FAILED, … … 359 363 packet->buffer, 360 364 sizeof(libtrace_pcapfile_pkt_hdr_t)); 361 362 365 if (err<0) { 363 366 trace_set_err(libtrace,errno,"reading packet"); … … 368 371 return 0; 369 372 } 373 374 if (err < (int)sizeof(libtrace_pcapfile_pkt_hdr_t)) { 375 trace_set_err(libtrace, errno, "Incomplete pcap packet header"); 376 return -1; 377 } 370 378 371 379 bytes_to_read = swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen); … … 391 399 ); 392 400 393 394 401 if (err<0) { 395 402 trace_set_err(libtrace,errno,"reading packet"); … … 399 406 return 0; 400 407 } 408 409 if (err < (int)bytes_to_read) { 410 trace_set_err(libtrace, errno, "Incomplete pcap packet body"); 411 return -1; 412 } 401 413 402 414 if (pcapfile_prepare_packet(libtrace, packet, packet->buffer, -
lib/format_tsh.c
rb13b939 r97d170d 147 147 return 0; 148 148 } 149 150 if (numbytes < (int)sizeof(tsh_pkt_header_t)) { 151 trace_set_err(libtrace, errno, "Incomplete TSH header"); 152 return -1; 153 } 149 154 150 155 buffer2 = (char*)buffer2 + numbytes; -
lib/libtrace.h.in
rd994324 r97d170d 109 109 ((@LIBTRACE_MAJOR@<<16)|(@LIBTRACE_MID@<<8)|(@LIBTRACE_MINOR@)) 110 110 111 /** Replaced with the current SVN revision number when 'make dist' is invoked 112 * to create a distributable tarball */ 113 #define LIBTRACE_SVN_REVISION 0 111 /** This used to be replaced with the current SVN revision number when 112 * 'make dist' was invoked to create a distributable tarball. We don't use 113 * SVN anymore and there probably isn't any need to know the exact revision 114 * number either these days. */ 115 #define LIBTRACE_SVN_REVISION LIBTRACE_API_VERSION 114 116 115 117 /** DAG driver version installed on the current system */
Note: See TracChangeset
for help on using the changeset viewer.