Commit 50a7d58e authored by Boaz Brickner's avatar Boaz Brickner

Improve comparison to Wireshark.

parent 66296bc9
......@@ -7,6 +7,7 @@ using PcapDotNet.Packets;
using PcapDotNet.Packets.Icmp;
using PcapDotNet.Packets.IpV4;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PcapDotNet.Core.Test
{
......@@ -73,7 +74,10 @@ namespace PcapDotNet.Core.Test
break;
default:
field.AssertDataField(ipV4.Payload);
if (icmpIpV4PayloadDatagram is IcmpIpV4HeaderPlus64BitsPayloadDatagram && field.Value().Length > 2 * 8)
Assert.AreEqual(ipV4.Payload.BytesSequenceToHexadecimalString(), field.Value().Substring(0, 2 * 8));
else
field.AssertDataField(ipV4.Payload);
break;
}
}
......
......@@ -35,6 +35,11 @@ namespace PcapDotNet.Core.Test
break;
case "igmp.maddr":
if (igmpDatagram.MessageType == IgmpMessageType.MulticastTraceRoute)
{
// TODO: Support IGMP Traceroute request.
break;
}
field.AssertShow(igmpDatagram.GroupAddress.ToString());
break;
......
......@@ -208,7 +208,43 @@ namespace PcapDotNet.Core.Test
case "ipv6.routing_hdr.rpl.full_address":
headerField.AssertNoFields();
// TODO: Implement when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10673 is fixed.
// TODO: Uncomment the following code when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10673 is fixed.
// // TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11803 is fixed.
// if (routingProtocolLowPowerAndLossyNetworks.Addresses.Count > 0)
// {
// IpV6Address actualFullAddress = new IpV6Address(headerField.Show());
//
// IpV6Address destinationAddress = ipV6Datagram.CurrentDestination;
// for (int i = 0; i < _currentExtensionHeaderIndex; ++i)
// {
// IpV6ExtensionHeaderRoutingHomeAddress ipV6ExtensionHeaderRoutingHomeAddress =
// ipV6Datagram.ExtensionHeaders[i] as IpV6ExtensionHeaderRoutingHomeAddress;
// if (ipV6ExtensionHeaderRoutingHomeAddress != null)
// destinationAddress = ipV6ExtensionHeaderRoutingHomeAddress.HomeAddress;
//
// IpV6ExtensionHeaderRoutingSourceRoute ipV6ExtensionHeaderRoutingSourceRoute =
// ipV6Datagram.ExtensionHeaders[i] as IpV6ExtensionHeaderRoutingSourceRoute;
// if (ipV6ExtensionHeaderRoutingSourceRoute != null && ipV6ExtensionHeaderRoutingSourceRoute.Addresses.Any())
// destinationAddress = ipV6ExtensionHeaderRoutingSourceRoute.Addresses.Last();
// }
//
// int commonPrefixLength =
// routingProtocolLowPowerAndLossyNetworksAddressIndex == routingProtocolLowPowerAndLossyNetworks.Addresses.Count - 1
// ? routingProtocolLowPowerAndLossyNetworks.CommonPrefixLengthForLastAddress
// : routingProtocolLowPowerAndLossyNetworks.CommonPrefixLengthForNonLastAddresses;
//
// byte[] destinationAddressBytes = new byte[IpV6Address.SizeOf];
// destinationAddressBytes.Write(0, destinationAddress, Endianity.Big);
//
// byte[] routingAddressBytes = new byte[IpV6Address.SizeOf];
// routingAddressBytes.Write(0, routingProtocolLowPowerAndLossyNetworks.Addresses[routingProtocolLowPowerAndLossyNetworksAddressIndex], Endianity.Big);
//
// byte[] fullAddressBytes = destinationAddressBytes.Subsegment(0, commonPrefixLength).Concat(routingAddressBytes.Subsegment(commonPrefixLength, IpV6Address.SizeOf - commonPrefixLength)).ToArray();
// IpV6Address expectedFullAddress = fullAddressBytes.ReadIpV6Address(0, Endianity.Big);
//
// Assert.AreEqual(expectedFullAddress, actualFullAddress);
// }
++routingProtocolLowPowerAndLossyNetworksAddressIndex;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment