Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
37c317f3
Commit
37c317f3
authored
Nov 07, 2015
by
Boaz Brickner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code coverage.
parent
938e99c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
IgmpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IgmpTests.cs
+15
-0
IgmpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpDatagram.cs
+1
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IgmpTests.cs
View file @
37c317f3
...
...
@@ -495,5 +495,20 @@ namespace PcapDotNet.Packets.Test
Assert
.
IsNotNull
(
new
IgmpGroupRecord
(
IgmpRecordType
.
FilterModeChangeToExclude
,
IpV4Address
.
Zero
,
new
IpV4Address
[
0
],
null
));
Assert
.
Fail
();
}
[
TestMethod
]
public
void
IgmpTooLong
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV4Layer
(),
new
IgmpQueryVersion1Layer
());
Assert
.
IsTrue
(
packet
.
IsValid
);
byte
[]
invalidPacketBuffer
=
packet
.
Buffer
.
ToArray
();
invalidPacketBuffer
[
EthernetDatagram
.
HeaderLengthValue
+
IpV4Datagram
.
HeaderMinimumLength
]
=
(
byte
)
IgmpMessageType
.
MulticastTraceRoute
;
const
ushort
newCheckSum
=
57599
;
invalidPacketBuffer
[
EthernetDatagram
.
HeaderLengthValue
+
IpV4Datagram
.
HeaderMinimumLength
+
sizeof
(
ushort
)]
=
newCheckSum
>>
8
;
invalidPacketBuffer
[
EthernetDatagram
.
HeaderLengthValue
+
IpV4Datagram
.
HeaderMinimumLength
+
sizeof
(
ushort
)
+
sizeof
(
byte
)]
=
newCheckSum
&
0xFF
;
Packet
invalidPacket
=
new
Packet
(
invalidPacketBuffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpDatagram.cs
View file @
37c317f3
...
...
@@ -858,6 +858,7 @@ namespace PcapDotNet.Packets.Igmp
return
Length
==
GetQueryVersion3Length
(
NumberOfSources
);
default
:
// This never happens, since Version != 0 with MessageType = MembershipQuery requires QueryVersion to be 1, 2 or 3.
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment