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
19c96296
Commit
19c96296
authored
Aug 22, 2014
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
Code Coverage 95.64%
parent
9c02de2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
1 deletion
+126
-1
WiresharkDatagramComparerIpV6MobilityHeader.cs
....Core.Test/WiresharkDatagramComparerIpV6MobilityHeader.cs
+2
-0
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+123
-0
IpV6OptionSmfDpdSequenceBased.cs
...Net.Packets/IpV6/Options/IpV6OptionSmfDpdSequenceBased.cs
+1
-1
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerIpV6MobilityHeader.cs
View file @
19c96296
...
...
@@ -109,6 +109,8 @@ namespace PcapDotNet.Core.Test
protocol
==
IpV4Protocol
.
Bna
||
protocol
==
IpV4Protocol
.
InterDomainRoutingProtocol
||
protocol
==
IpV4Protocol
.
ActiveNetworks
||
protocol
==
IpV4Protocol
.
SpectraLinkRadioProtocol
||
protocol
==
IpV4Protocol
.
MobileAdHocNetwork
||
protocol
==
IpV4Protocol
.
RemoteVirtualDiskProtocol
))
return
false
;
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
19c96296
...
...
@@ -812,6 +812,40 @@ namespace PcapDotNet.Packets.Test
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6ExtensionHeaderRoutingParseDataNimrod
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderRoutingHomeAddress
(
IpV4Protocol
.
Skip
,
0
,
IpV6Address
.
Zero
))
});
packet
.
Buffer
[
14
+
40
+
2
]
=
(
byte
)
IpV6RoutingType
.
Nimrod
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6ExtensionHeaderRoutingParseDataUnknownRoutingType
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderRoutingHomeAddress
(
IpV4Protocol
.
Skip
,
0
,
IpV6Address
.
Zero
))
});
packet
.
Buffer
[
14
+
40
+
2
]
=
0x55
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
),
AllowDerivedTypes
=
false
)]
public
void
IpV6ExtensionHeaderFragmentDataFragmentOffsetTooBig
()
...
...
@@ -1036,5 +1070,94 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
new
IpV6OptionPad1
(),
options
[
0
]);
Assert
.
AreEqual
(
new
IpV6OptionPad1
(),
options
[
1
]);
}
[
TestMethod
]
public
void
IpV6OptionSmfDpdSequenceBasedDataTooShort
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderDestinationOptions
(
IpV4Protocol
.
Skip
,
new
IpV6Options
(
new
IpV6OptionSmfDpdIpV4
(
IpV4Address
.
Zero
,
DataSegment
.
Empty
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
2
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6OptionSmfDpdSequenceBasedIpV4TaggerIdWrongLength
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderDestinationOptions
(
IpV4Protocol
.
Skip
,
new
IpV6Options
(
new
IpV6OptionSmfDpdIpV4
(
IpV4Address
.
Zero
,
DataSegment
.
Empty
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
packet
.
Buffer
[
14
+
40
+
2
+
2
]
&=
0xF0
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6OptionSmfDpdSequenceBasedIpV6TaggerIdWrongLength
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderDestinationOptions
(
IpV4Protocol
.
Skip
,
new
IpV6Options
(
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
packet
.
Buffer
[
14
+
40
+
2
+
2
]
&=
0xF0
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6OptionSmfDpdSequenceBasedUnknownTaggerIdType
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderDestinationOptions
(
IpV4Protocol
.
Skip
,
new
IpV6Options
(
new
IpV6OptionSmfDpdIpV4
(
IpV4Address
.
Zero
,
DataSegment
.
Empty
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
packet
.
Buffer
[
14
+
40
+
2
+
2
]
|=
0x70
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6OptionSmfDpdSequenceBasedEqualsData
()
{
Assert
.
AreEqual
(
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
),
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
));
Assert
.
AreNotEqual
(
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
),
new
IpV6OptionSmfDpdIpV4
(
IpV4Address
.
Zero
,
new
DataSegment
(
new
byte
[
12
])));
Assert
.
AreNotEqual
(
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
),
new
IpV6OptionSmfDpdSequenceHashAssistValue
(
new
DataSegment
(
new
byte
[
17
])));
Assert
.
AreNotEqual
(
new
IpV6OptionSmfDpdDefault
(
new
DataSegment
(
new
byte
[
16
]),
DataSegment
.
Empty
),
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
));
}
}
}
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdSequenceBased.cs
View file @
19c96296
...
...
@@ -142,4 +142,4 @@ namespace PcapDotNet.Packets.IpV6
Identifier
.
Equals
(
other
.
Identifier
)
&&
TaggerIdType
==
other
.
TaggerIdType
&&
EqualsTaggerId
(
other
);
}
}
}
\ No newline at end of file
}
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