Skip to content

Commit 0e40921

Browse files
committed
don't use a random invalid port
1 parent 69ea914 commit 0e40921

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -419,24 +419,19 @@ private static void CreateRandomUdpPayload(Random random, UdpLayer udpLayer, Lis
419419
case 1:
420420
{
421421
DhcpLayer dhcpLayer = random.NextDhcpLayer();
422-
layers.Add(dhcpLayer);
423-
424-
if (random.NextBool())
425-
{
426-
udpLayer.SourcePort = (ushort)(random.NextBool() ? 67 : 68);
427-
}
428-
else
429-
{
430-
udpLayer.DestinationPort = 5355;
431-
}
432-
if (random.NextBool())
433-
{
434-
udpLayer.SourcePort = (ushort)(random.NextBool() ? 67 : 68);
422+
layers.Add(dhcpLayer);
423+
424+
if (random.NextBool())
425+
{
426+
udpLayer.SourcePort = 67 ;
427+
udpLayer.DestinationPort = 68;
435428
}
436-
else
437-
{
438-
udpLayer.SourcePort = 5355;
429+
else
430+
{
431+
udpLayer.SourcePort = 68;
432+
udpLayer.DestinationPort = 67;
439433
}
434+
440435
break;
441436
}
442437

0 commit comments

Comments
 (0)