Commit 339bb612 authored by Brickner_cp's avatar Brickner_cp

Wireshark 1.12.3.

parent 44f22cf6
......@@ -156,6 +156,16 @@ namespace PcapDotNet.Core.Test
ComparePacketsToWireshark(packet);
}
[TestMethod]
public void CompareWiresharkSupportedDNSLocPacketTest()
{
Packet packet = Packet.FromHexadecimalString(
"0b1b92a8f700de93ce5ea8b68100c0cd08004ac50459df790000ea110b47541a980dd85201b0013408413c1ec33482820896810101010001000014eb45a8043100000b969551000400050002000506656f6c686c710000270000017604646a6c630377766d0970617969667874796e026278067771796d686d0000fb00fe046479696907636777686566780468636b6f027470066965746e6c6208706970677170766a09706176676974746a7902716a08777177697475746e00003b000100001f000102756c076d79667769686f046b6f676b04736c79690376627003767275086175666a726a657203786c79096c666964656271796f0000270004497b4aff002b09796b6364646d626e680765617776667369056d696a6a750266710665756c687174076b7470667578770004656468660000200003210deee900064ada961b83bb0476777275046e67646c046464726e0478666a63036b736f02686f0466756574026963000066000060c2b81d0023fa537aa79bafc900ba72baf5109e3cd3900a2fa97980d88cac526248b486c7e708d1220171076c65616371716c00002200ff06e1d59b00160095c474277a7aeefa494c804b33abd3ed3e7b567e43066a637663676402686b0175000063000445c8d093002a00056b67512e7b06fb4d96e0cb6f01440736025e9cf57be200000005d39c2779b00894d4ea17f164ea86087964636d70767961057274786277046c66666a08696b6f766966696e0974616561766a79647702776800800100fe404b8ca8002c8b8b07005909d78ce4c9b7582b0eb691904fe0f562a7356e188112e9d3d2420efb08f8aa9ec31a0ce73dfc5201740769767974786c71066566766d646400002300030ea3fe8700576cf8a57f094445474c50525355581749009cb5291318a58b11c13f1b67014114f984e9cb7cbb1647b4cded67aedb210dacedc13b42c4a6f9e11e4a61d60164046b687667076970736368626c02747902697103706a740008797965636b7763730171076d726b6865776c09686c6873737879766d066b766c766a70056177646a6c06686f757877680000000001716661fe002a7e21461c5c9fcc412e968302e8bd7966b1a9e4d69d5ac4d753a6a1bfa8b9c949edf944b0e75277dc307008636172746375706f0976666e6b617568616b03757467036a686e000005000062036c830003016e0003786470027364066b62716e747500001d00ff3adb54a5001000376774db335718878e747dc84fa05f0476736d79076e62646a706872077466627471656606736f6571696600001000fe2becff97002e014a08292c1e697201885d025b9101ed07758dffc47e5d5c020c6801230352df0b07d5296bab440b19041f23240a0474777579066e667478697509687269646176636e790001000001725d2830006963c39426563937c3dfa290cf45fd9bc7d2d13d2c502555bd94b8eda68e760974d18a23c25df1a4b207973f14cb7f2238e2b4e4eaca55780b2c294da64c903469991bfdbad9d869e02c8a25b8e540f21495b4c3da911eaa7c1118960da4fd667663d57aaf82675f0a4b",
DateTime.Now, DataLinkKind.Ethernet);
ComparePacketsToWireshark(packet);
}
[TestMethod]
public void CompareIpV4DataLinkToWiresharkTest()
{
......@@ -462,9 +472,6 @@ namespace PcapDotNet.Core.Test
process.WaitForExit();
Console.WriteLine(errorOutput);
File.WriteAllText(documentFilename, output);
// TODO: Remove this when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10651 is fixed.
if (process.ExitCode == 3)
return;
Assert.AreEqual(0, process.ExitCode);
}
......
......@@ -373,8 +373,7 @@ namespace PcapDotNet.Core.Test
break;
case "dns.wks.protocol":
// TODO: Uncomment this when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10675 is fixed.
// dataField.AssertShowDecimal((byte)wksData.Protocol);
dataField.AssertShowDecimal((byte)wksData.Protocol);
break;
case "dns.wks.bits":
......@@ -567,8 +566,7 @@ namespace PcapDotNet.Core.Test
break;
case "dns.idsn.sa.address":
// TODO: Uncomment when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10650 is fixed.
// dataField.AssertValue(isdnData.Subaddress);
dataField.AssertValue(isdnData.Subaddress);
break;
default:
......@@ -820,9 +818,37 @@ namespace PcapDotNet.Core.Test
dataField.AssertShowDecimal(locData.Version);
break;
// TODO: Remove this case when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10960 is fixed.
case "dns.loc.unknown_data":
break;
case "dns.loc.size":
string sizeValue = dataField.Showname().Split(new[] {'(', ')'})[1];
Assert.AreEqual((locData.Size / 100) + " m", sizeValue);
break;
case "dns.loc.horizontal_precision":
string horizontalPrecisionValue = dataField.Showname().Split(new[] {'(', ')'})[1];
Assert.AreEqual((locData.HorizontalPrecision / 100).ToString(), horizontalPrecisionValue);
break;
case "dns.loc.vertial_precision":
string verticalPrecisionValue = dataField.Showname().Split(new[] {'(', ')'})[1];
Assert.AreEqual((locData.VerticalPrecision / 100).ToString(), verticalPrecisionValue);
break;
case "dns.loc.latitude":
dataField.AssertShowDecimal(locData.Latitude);
break;
case "dns.loc.longitude":
dataField.AssertShowDecimal(locData.Longitude);
break;
case "dns.loc.altitude":
dataField.AssertShowDecimal(locData.Altitude);
break;
default:
throw new InvalidOperationException("Invalid DNS data field " + dataFieldName);
}
......@@ -915,8 +941,7 @@ namespace PcapDotNet.Core.Test
break;
case "dns.naptr.replacement_length":
// TODO: Uncomment when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10700 is fixed.
// dataField.AssertShowDecimal(naPtrData.Replacement.NonCompressedLength);
dataField.AssertShowDecimal(naPtrData.Replacement.NonCompressedLength);
break;
case "dns.naptr.replacement":
......@@ -981,8 +1006,7 @@ namespace PcapDotNet.Core.Test
break;
case "dns.a6.address_suffix":
// TODO: Uncomment when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10652 is fixed.
// Assert.AreEqual(new IpV6Address(dataFieldShow), a6Data.AddressSuffix);
Assert.AreEqual(new IpV6Address(dataFieldShow), a6Data.AddressSuffix);
break;
case "dns.a6.prefix_name":
......@@ -1123,7 +1147,10 @@ namespace PcapDotNet.Core.Test
case "dns.apl.afdpart.ipv4":
case "dns.apl.afdpart.ipv6":
if (dataFieldName != "dns.apl.afdpart.data")
Assert.AreEqual(AddressFamily.IpV4, aplData.Items[_aplItemIndex - 1].AddressFamily);
{
Assert.AreEqual(dataFieldName == "dns.apl.afdpart.ipv4" ? AddressFamily.IpV4 : AddressFamily.IpV6,
aplData.Items[_aplItemIndex - 1].AddressFamily);
}
dataField.AssertValue(aplData.Items[_aplItemIndex - 1].AddressFamilyDependentPart);
break;
......
......@@ -31,7 +31,9 @@ namespace PcapDotNet.Core.Test
break;
case "eth.trailer":
field.AssertValue(ethernetDatagram.Trailer);
// TODO: Support RARP.
if (ethernetDatagram.EtherType != EthernetType.ReverseArp)
field.AssertValue(ethernetDatagram.Trailer);
break;
case "eth.fcs":
......
......@@ -156,6 +156,10 @@ namespace PcapDotNet.Core.Test
case "icmp.resptime":
break;
// TODO: Remove this case when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10939 is fixed.
case "icmp.length":
break;
default:
if (!field.Name().StartsWith("lt2p.") &&
field.Name() != "pweth" &&
......
......@@ -24,16 +24,7 @@ namespace PcapDotNet.Core.Test
if (field.Show() == "0")
return false; // TODO: support IGMP version 0.
if (field.Show() == "3" && igmpDatagram.Version == 1)
{
// TODO: Fix following https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10526
Assert.AreEqual(IgmpMessageType.MembershipQuery, igmpDatagram.MessageType);
Assert.AreEqual(8, igmpDatagram.Length);
}
else
{
field.AssertShowDecimal(igmpDatagram.Version);
}
field.AssertShowDecimal(igmpDatagram.Version);
break;
case "igmp.type":
......
......@@ -23,9 +23,6 @@ namespace PcapDotNet.Core.Test
switch (field.Name())
{
case "ip.version":
// TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10706 is fixed.
if (field.Show() != ipV4Datagram.Version.ToString())
return false;
field.AssertShowDecimal(ipV4Datagram.Version);
field.AssertNoFields();
break;
......@@ -140,14 +137,20 @@ namespace PcapDotNet.Core.Test
case "ip.dst":
case "ip.dst_host":
field.AssertShow(ipV4Datagram.Destination.ToString());
// TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10959 is fixed or (worst case) when MTU Reply option is supported.
if (ipV4Datagram.Options == null || !ipV4Datagram.Options.Any(option => option.OptionType == IpV4OptionType.MaximumTransmissionUnitReply))
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 condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10959 is fixed or (worst case) when MTU Reply option is supported.
if (ipV4Datagram.Options == null || !ipV4Datagram.Options.Any(option => option.OptionType == IpV4OptionType.MaximumTransmissionUnitReply))
{
Assert.IsTrue(field.Show() == ipV4Datagram.Source.ToString() ||
field.Show() == ipV4Datagram.Destination.ToString());
}
field.AssertNoFields();
break;
......
......@@ -102,11 +102,18 @@ namespace PcapDotNet.Core.Test
if (_currentExtensionHeaderIndex >= ipV6Datagram.ExtensionHeaders.Headers.Count)
{
Assert.IsFalse(ipV6Datagram.ExtensionHeaders.IsValid);
int length = int.Parse(
field.Fields().Where(subfield => subfield.Name() == "" && subfield.Show().StartsWith("Length:")).Select(
subfield => subfield.Show().Split(new[] {':', '(', ' '}, StringSplitOptions.RemoveEmptyEntries)[2]).First());
int maxLength = ipV6Datagram.Length - IpV6Datagram.HeaderLength - ipV6Datagram.ExtensionHeaders.BytesLength;
MoreAssert.IsBigger(maxLength, length);
if (field.Fields().Any(subfield => subfield.Name() == ""))
{
int length = int.Parse(
field.Fields().Where(subfield => subfield.Name() == "" && subfield.Show().StartsWith("Length:")).Select(
subfield => subfield.Show().Split(new[] {':', '(', ' '}, StringSplitOptions.RemoveEmptyEntries)[2]).First());
MoreAssert.IsBigger(maxLength, length);
} else
{
Assert.AreEqual(6, maxLength);
}
}
else
{
......@@ -396,9 +403,9 @@ namespace PcapDotNet.Core.Test
case "ipv6.opt.calipso.cmpt_bitmap":
headerSubfield.AssertNoFields();
// TODO: Uncomment and avoid returning when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10561 is fixed.
// headerSubfield.AssertValue(optionCalipso.CompartmentBitmap);
return;
headerSubfield.AssertValue(optionCalipso.CompartmentBitmap);
++optionsIndex;
break;
case "ipv6.opt.router_alert":
headerSubfield.AssertNoFields();
......@@ -441,8 +448,14 @@ namespace PcapDotNet.Core.Test
case "ipv6.opt.qs_nonce":
headerSubfield.AssertNoFields();
// TODO: Stop returning and uncomment the code when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10575 is fixed.
return;
headerSubfield.AssertShowDecimal(optionQuickStart.Nonce);
break;
case "ipv6.opt.qs_reserved":
headerSubfield.AssertNoFields();
headerSubfield.AssertShowDecimal(0);
++optionsIndex;
break;
case "ipv6.opt.pad1":
headerSubfield.AssertNoFields();
......
......@@ -508,7 +508,7 @@ namespace PcapDotNet.Core.Test
case (TcpOptionType)30:
// TODO: Support 30.
Assert.IsTrue(field.Show().StartsWith("Multipath TCP: "));
Assert.IsTrue(field.Show().StartsWith("Multipath TCP"));
break;
case (TcpOptionType)78:
......
......@@ -75,8 +75,12 @@ namespace PcapDotNet.Packets.TestUtils
if (maximumOptionLength >= IpV4OptionUnknown.OptionMinimumLength && random.Next(100) > 90)
return random.NextIpV4OptionUnknown(maximumOptionLength);
// TODO: Support MtuProbe.
List<IpV4OptionType> impossibleOptionTypes = new List<IpV4OptionType> {IpV4OptionType.MaximumTransmissionUnitProbe};
// TODO: Support MTU Probe and MTU Reply.
List<IpV4OptionType> impossibleOptionTypes = new List<IpV4OptionType>
{
IpV4OptionType.MaximumTransmissionUnitProbe,
IpV4OptionType.MaximumTransmissionUnitReply
};
if (maximumOptionLength < IpV4OptionBasicSecurity.OptionMinimumLength)
impossibleOptionTypes.Add(IpV4OptionType.BasicSecurity);
if (maximumOptionLength < IpV4OptionRoute.OptionMinimumLength)
......
......@@ -69,6 +69,13 @@ namespace PcapDotNet.Packets.IpV4
/// </summary>
MaximumTransmissionUnitProbe = 11,
/// <summary>
/// MTU Reply.
/// RFCs 1063, 1191.
/// Obsoleted.
/// </summary>
MaximumTransmissionUnitReply = 12,
/// <summary>
/// Quick Start (QS). RFC 4782.
/// </summary>
......
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