Changeset 432 for trunk/pdns/pdns/dnsscope.cc
- Timestamp:
- 07/05/05 17:38:50 (8 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/dnsscope.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnsscope.cc
r424 r432 1 #define __FAVOR_BSD 1 2 #include <pcap.h> 2 3 … … 9 10 #include <set> 10 11 #include <fstream> 12 #include <algorithm> 11 13 #include "anadns.hh" 12 14 … … 42 44 pw=new PcapPacketWriter(argv[2], pr); 43 45 44 int dnserrors=0 ;46 int dnserrors=0, bogus=0; 45 47 typedef map<uint32_t,uint32_t> cumul_t; 46 48 cumul_t cumul; … … 54 56 55 57 while(pr.getUDPPacket()) { 56 if((ntohs(pr.d_udp-> dest)==5300 || ntohs(pr.d_udp->source)==5300 ||57 ntohs(pr.d_udp-> dest)==53 || ntohs(pr.d_udp->source)==53) &&58 if((ntohs(pr.d_udp->uh_dport)==5300 || ntohs(pr.d_udp->uh_sport)==5300 || 59 ntohs(pr.d_udp->uh_dport)==53 || ntohs(pr.d_udp->uh_sport)==53) && 58 60 pr.d_len > sizeof(HEADER)) { 59 61 try { … … 112 114 } 113 115 catch(exception& e) { 114 cerr<<"Bogus packet"<<endl;115 116 if(pw) 116 117 pw->write(); 118 bogus++; 117 119 continue; 118 120 } … … 122 124 123 125 cerr<<"Saw "<<pr.d_correctpackets<<" correct packets, "<<pr.d_runts<<" runts, "<< pr.d_oversized<<" oversize, "<< 124 pr.d_nonetheripudp<<" unknown encaps, "<<dnserrors<<" dns decoding errors "<<endl;126 pr.d_nonetheripudp<<" unknown encaps, "<<dnserrors<<" dns decoding errors, "<<bogus<<" bogus packets"<<endl; 125 127 126 128 unsigned int unanswered=0;