Commit 78cafa9a authored by Brickner_cp's avatar Brickner_cp

Wireshark 1.12.1

parent 74149b5a
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
namespace PcapDotNet.Core.Test
{
internal static class IpV4OptionExtensions
{
public static bool IsBadForWireshark(this IpV4Options options)
{
// TODO: This shouldn't be a factor once https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7043 is fixed.
return options.OptionsCollection.Any(option => option.OptionType == IpV4OptionType.InternetTimestamp && option.Length < 5 ||
option.OptionType == IpV4OptionType.BasicSecurity && option.Length != 11);
}
}
}
\ No newline at end of file
......@@ -138,7 +138,6 @@
<Compile Include="LivePacketDeviceExtensionsTests.cs" />
<Compile Include="LivePacketDeviceTests.cs" />
<Compile Include="MarshalingServicesTests.cs" />
<Compile Include="IpV4OptionExtensions.cs" />
<Compile Include="NetworkInterfaceExtensionsTests.cs" />
<Compile Include="PacketTimestampTests.cs" />
<Compile Include="TcpOptionExtensions.cs" />
......
......@@ -140,28 +140,14 @@ namespace PcapDotNet.Core.Test
case "ip.dst":
case "ip.dst_host":
if (field.Show() != ipV4Datagram.Destination.ToString())
{
// TODO: Remove this fallback once https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7043 is fixed.
field.AssertShow(ipV4Datagram.CurrentDestination.ToString());
Assert.IsTrue(ipV4Datagram.Options.IsBadForWireshark(),
string.Format("Expected destination: {0}. Destination: {1}. Current destination: {2}.", field.Show(),
ipV4Datagram.Destination, ipV4Datagram.CurrentDestination));
}
field.AssertShow(ipV4Datagram.Destination.ToString());
field.AssertNoFields();
break;
case "ip.addr":
case "ip.host":
Assert.IsTrue(field.Show() == ipV4Datagram.Source.ToString() ||
field.Show() == ipV4Datagram.Destination.ToString() ||
// TODO: Remove this fallback once https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7043 is fixed.
field.Show() == ipV4Datagram.CurrentDestination.ToString() && ipV4Datagram.Options.IsBadForWireshark(),
string.Format("Expected ip: {0}. ", field.Show()) +
(ipV4Datagram.IsValid
? string.Format("Source: {0}. Destination: {1}. Current destination: {2}.", ipV4Datagram.Source,
ipV4Datagram.Destination, ipV4Datagram.CurrentDestination)
: ""));
field.Show() == ipV4Datagram.Destination.ToString());
field.AssertNoFields();
break;
......
......@@ -188,7 +188,7 @@ namespace PcapDotNet.Core.Test
case "tcp.checksum":
field.AssertShowDecimal(tcpDatagram.Checksum);
IpV4Datagram ipV4Datagram = ipDatagram as IpV4Datagram;
if (ipV4Datagram != null && !ipV4Datagram.Options.IsBadForWireshark())
if (ipV4Datagram != null)
{
foreach (var checksumField in field.Fields())
{
......
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