Changeset 05e83dc for lib/trace.c
- Timestamp:
- 03/24/05 16:56:06 (17 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:
- 1b67314
- Parents:
- 23c13e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/trace.c
r23c13e8 r05e83dc 464 464 4096, 465 465 1, 466 0,466 1, 467 467 errbuf); 468 468 break; … … 632 632 char buf[RP_BUFSIZE]; 633 633 #if HAVE_PCAP 634 struct pcap_pkthdr pcaphdr;634 struct pcap_pkthdr *pcaphdr = malloc(sizeof(struct pcap_pkthdr)); 635 635 const u_char *pcappkt; 636 int pcapbytes = 0; 636 637 #endif 637 638 dag_record_t *erfptr; … … 653 654 /* PCAP gives us it's own per-packet interface. Let's use it */ 654 655 if (libtrace->format == PCAP || libtrace->format == PCAPINT) { 655 if ((pcappkt = pcap_next(libtrace->input.pcap, &pcaphdr)) == NULL) { 656 return 0; 656 /* pcap_next doesn't return enough information for us 657 * newer libpcap has pcap_next_ex, which does, but we'd 658 * really rather have it all the time. Also, pcap_next 659 * works differently under freebsd! */ 660 //if ((pcappkt = pcap_next(libtrace->input.pcap, &pcaphdr)) == NULL) { 661 if ((pcapbytes = pcap_next_ex(libtrace->input.pcap, 662 &pcaphdr, 663 &pcappkt)) < 0 ) { 664 return -1; 657 665 } 666 if (pcapbytes == 0) { 667 return 0; 668 } 658 669 memcpy(buffer,&pcaphdr,sizeof(struct pcap_pkthdr)); 659 memcpy(buffer + sizeof(struct pcap_pkthdr),pcappkt,pcaphdr.len);660 numbytes = pcaphdr.len;670 numbytes = pcaphdr->len; 671 memcpy(buffer + sizeof(struct pcap_pkthdr),pcappkt,numbytes); 661 672 662 673 packet->size = numbytes + sizeof(struct pcap_pkthdr); … … 1635 1646 default: 1636 1647 /* pass */ 1648 break; 1637 1649 } 1638 1650 default: 1639 1651 /* pass */ 1652 break; 1640 1653 } 1641 1654
Note: See TracChangeset
for help on using the changeset viewer.