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
953fe462
Commit
953fe462
authored
Aug 30, 2014
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
Code Coverage 96.15%
parent
2fb06640
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
0 deletions
+141
-0
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+136
-0
IpV6MobilityOptionFlowIdentification.cs
...kets/IpV6/Options/IpV6MobilityOptionFlowIdentification.cs
+5
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
953fe462
...
@@ -2381,5 +2381,141 @@ namespace PcapDotNet.Packets.Test
...
@@ -2381,5 +2381,141 @@ namespace PcapDotNet.Packets.Test
Assert
.
IsNull
(
new
IpV6ExtensionHeaderMobilityExperimental
(
IpV4Protocol
.
Pin
,
0
,
new
DataSegment
(
new
byte
[
5
])));
Assert
.
IsNull
(
new
IpV6ExtensionHeaderMobilityExperimental
(
IpV4Protocol
.
Pin
,
0
,
new
DataSegment
(
new
byte
[
5
])));
Assert
.
Fail
();
Assert
.
Fail
();
}
}
[
TestMethod
]
public
void
IpV6DatagramParseExtensionHeaderWithShorterThanHeaderLength
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
NextHeader
=
IpV4Protocol
.
Il
});
Assert
.
IsTrue
(
packet
.
IsValid
);
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
.
Take
(
packet
.
Length
-
1
).
ToArray
(),
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
AreEqual
(
IpV6ExtensionHeaders
.
Empty
,
invalidPacket
.
Ethernet
.
IpV6
.
ExtensionHeaders
);
Assert
.
AreEqual
(
0
,
invalidPacket
.
Ethernet
.
IpV6
.
RealPayloadLength
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6FlowIdentificationSubOptionTrafficSelectorDataTooShort
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderMobilityBindingError
(
IpV4Protocol
.
Skip
,
0
,
IpV6BindingErrorStatus
.
UnrecognizedMhTypeValue
,
IpV6Address
.
Zero
,
new
IpV6MobilityOptions
(
new
IpV6MobilityOptionFlowIdentification
(
0
,
0
,
IpV6FlowIdentificationStatus
.
FlowBindingSuccessful
,
new
IpV6FlowIdentificationSubOptions
(
new
IpV6FlowIdentificationSubOptionTrafficSelector
(
IpV6FlowIdentificationTrafficSelectorFormat
.
IpV4Binary
,
DataSegment
.
Empty
))))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
24
+
8
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6AccessNetworkIdentifierSubOptionGeoLocationDataTooShort
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderMobilityBindingError
(
IpV4Protocol
.
Skip
,
0
,
IpV6BindingErrorStatus
.
UnrecognizedMhTypeValue
,
IpV6Address
.
Zero
,
new
IpV6MobilityOptions
(
new
IpV6MobilityOptionAccessNetworkIdentifier
(
new
IpV6AccessNetworkIdentifierSubOptions
(
new
IpV6AccessNetworkIdentifierSubOptionGeoLocation
(
0
,
0
))))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
24
+
2
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifierDataTooShort
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderMobilityBindingError
(
IpV4Protocol
.
Skip
,
0
,
IpV6BindingErrorStatus
.
UnrecognizedMhTypeValue
,
IpV6Address
.
Zero
,
new
IpV6MobilityOptions
(
new
IpV6MobilityOptionAccessNetworkIdentifier
(
new
IpV6AccessNetworkIdentifierSubOptions
(
new
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier
(
IpV6AccessNetworkIdentifierOperatorIdentifierType
.
PrivateEnterpriseNumber
,
DataSegment
.
Empty
))))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
24
+
2
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6AccessNetworkIdentifierDataTooShortForReadingSubOption
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderMobilityBindingError
(
IpV4Protocol
.
Skip
,
0
,
IpV6BindingErrorStatus
.
UnrecognizedMhTypeValue
,
IpV6Address
.
Zero
,
new
IpV6MobilityOptions
(
new
IpV6MobilityOptionAccessNetworkIdentifier
(
new
IpV6AccessNetworkIdentifierSubOptions
(
new
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier
(
IpV6AccessNetworkIdentifierOperatorIdentifierType
.
PrivateEnterpriseNumber
,
DataSegment
.
Empty
))))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
packet
.
Buffer
[
14
+
40
+
24
+
1
]
-=
2
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6AccessNetworkIdentifierDataTooShortFullSubOption
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderMobilityBindingError
(
IpV4Protocol
.
Skip
,
0
,
IpV6BindingErrorStatus
.
UnrecognizedMhTypeValue
,
IpV6Address
.
Zero
,
new
IpV6MobilityOptions
(
new
IpV6MobilityOptionAccessNetworkIdentifier
(
new
IpV6AccessNetworkIdentifierSubOptions
(
new
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier
(
IpV6AccessNetworkIdentifierOperatorIdentifierType
.
PrivateEnterpriseNumber
,
new
DataSegment
(
new
byte
[
10
])))))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
packet
.
Buffer
[
14
+
40
+
24
+
1
]
-=
5
;
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
}
}
}
}
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionFlowIdentification.cs
View file @
953fe462
...
@@ -81,6 +81,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -81,6 +81,11 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
/// </summary>
public
IpV6FlowIdentificationSubOptions
SubOptions
{
get
;
private
set
;
}
public
IpV6FlowIdentificationSubOptions
SubOptions
{
get
;
private
set
;
}
public
override
bool
IsValid
{
get
{
return
SubOptions
.
IsValid
;
}
}
internal
override
IpV6MobilityOption
CreateInstance
(
DataSegment
data
)
internal
override
IpV6MobilityOption
CreateInstance
(
DataSegment
data
)
{
{
if
(
data
.
Length
<
OptionDataMinimumLength
)
if
(
data
.
Length
<
OptionDataMinimumLength
)
...
...
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