From e6b2274c9c96e0a4e5628074acd90a7074883328 Mon Sep 17 00:00:00 2001 From: "Srivats P." Date: Sun, 10 Apr 2011 14:41:05 +0530 Subject: [PATCH] Implemented detection of MLD PDML support --- common/pdmlreader.cpp | 27 +++++++++++++++++++++++++++ common/pdmlreader.h | 1 + 2 files changed, 28 insertions(+) diff --git a/common/pdmlreader.cpp b/common/pdmlreader.cpp index 0e8af62..f2ac300 100644 --- a/common/pdmlreader.cpp +++ b/common/pdmlreader.cpp @@ -103,6 +103,13 @@ PdmlProtocol* PdmlReader::allocPdmlProtocol(QString protoName) if (!factory_.contains(protoName)) protoName = "hexdump"; + // If MLD is not supported by the creator of the PDML, we interpret + // ICMPv6 as ICMP since our implementation of the ICMPv6 PDML protocol + // exists just to distinguish between MLD and ICMP. Non MLD ICMPv6 is + // also handled by ICMP only + if (!isMldSupport_ && (protoName == "icmpv6")) + protoName = "icmp"; + return (*(factory_.value(protoName)))(); } @@ -143,8 +150,28 @@ void PdmlReader::skipElement() void PdmlReader::readPdml() { + QStringList creator; + Q_ASSERT(isStartElement() && name() == "pdml"); + isMldSupport_ = true; + creator = attributes().value("creator").toString().split('/'); + if ((creator.size() >= 2) && (creator.at(0) == "wireshark")) + { + QList minMldVer; + minMldVer << 1 << 5 << 0; + QStringList version = creator.at(1).split('.'); + + for (int i = 0; i < qMin(version.size(), minMldVer.size()); i++) + { + if (version.at(i).toUInt() < minMldVer.at(i)) + { + isMldSupport_ = false; + break; + } + } + } + packetCount_ = 1; while (!atEnd()) diff --git a/common/pdmlreader.h b/common/pdmlreader.h index a4b6299..29aa1ac 100644 --- a/common/pdmlreader.h +++ b/common/pdmlreader.h @@ -65,6 +65,7 @@ private: PcapFileFormat *pcap_; QByteArray pktBuf_; + bool isMldSupport_; int packetCount_; int expPos_; bool skipUntilEnd_;