Fix IPv4/IPv6 PDML import with Tshark 2.x

Fixes #219
This commit is contained in:
Srivats P 2017-07-06 20:05:15 +05:30
parent 97c7d79695
commit a8ec2f1bda
2 changed files with 14 additions and 2 deletions

View File

@ -26,7 +26,6 @@ PdmlIp4Protocol::PdmlIp4Protocol()
{
ostProtoId_ = OstProto::Protocol::kIp4FieldNumber;
fieldMap_.insert("ip.version", OstProto::Ip4::kVerHdrlenFieldNumber);
fieldMap_.insert("ip.dsfield", OstProto::Ip4::kTosFieldNumber);
fieldMap_.insert("ip.len", OstProto::Ip4::kTotlenFieldNumber);
fieldMap_.insert("ip.id", OstProto::Ip4::kIdFieldNumber);
@ -50,7 +49,18 @@ void PdmlIp4Protocol::unknownFieldHandler(QString name, int /*pos*/,
{
bool isOk;
if ((name == "ip.options") ||
if (name == "ip.version")
{
OstProto::Ip4 *ip4 = pbProto->MutableExtension(OstProto::ip4);
if (!attributes.value("unmaskedvalue").isEmpty())
ip4->set_ver_hdrlen(attributes.value("unmaskedvalue")
.toString().toUInt(&isOk, kBaseHex));
else
ip4->set_ver_hdrlen(attributes.value("value")
.toString().toUInt(&isOk, kBaseHex));
}
else if ((name == "ip.options") ||
attributes.value("show").toString().startsWith("Options"))
{
options_ = QByteArray::fromHex(

View File

@ -26,7 +26,9 @@ PdmlIp6Protocol::PdmlIp6Protocol()
ostProtoId_ = OstProto::Protocol::kIp6FieldNumber;
fieldMap_.insert("ipv6.version", OstProto::Ip6::kVersionFieldNumber);
// Tshark 1.x uses .class while 2.x uses .tclass - we'll use either
fieldMap_.insert("ipv6.class", OstProto::Ip6::kTrafficClassFieldNumber);
fieldMap_.insert("ipv6.tclass", OstProto::Ip6::kTrafficClassFieldNumber);
fieldMap_.insert("ipv6.flow", OstProto::Ip6::kFlowLabelFieldNumber);
fieldMap_.insert("ipv6.plen", OstProto::Ip6::kPayloadLengthFieldNumber);
fieldMap_.insert("ipv6.nxt", OstProto::Ip6::kNextHeaderFieldNumber);