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
ffccec5d
Commit
ffccec5d
authored
Sep 20, 2013
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
parent
ec3b6965
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
13 deletions
+18
-13
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+1
-1
RandomIpV6Extensions.cs
.../src/PcapDotNet.Packets.TestUtils/RandomIpV6Extensions.cs
+2
-3
IpV6Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Datagram.cs
+1
-0
IpV6ExtensionHeader.cs
...DotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeader.cs
+1
-1
IpV6ExtensionHeaderAuthentication.cs
...pDotNet.Packets/IpV6/IpV6ExtensionHeaderAuthentication.cs
+7
-0
IpV6ExtensionHeaderRoutingRpl.cs
.../PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderRoutingRpl.cs
+4
-6
IpV6OptionUnknown.cs
.../src/PcapDotNet.Packets/IpV6/Options/IpV6OptionUnknown.cs
+2
-2
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
ffccec5d
...
...
@@ -69,7 +69,7 @@ namespace PcapDotNet.Packets.Test
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
ethernetLayer
,
ipV6Layer
,
payloadLayer
);
// Assert.IsTrue(packet.IsValid, string.Format("IsValid ({0})", ipV6Layer
.NextHeader));
Assert
.
IsTrue
(
packet
.
IsValid
,
string
.
Format
(
"IsValid ({0}...{1})"
,
ipV6Layer
.
NextHeader
,
ipV6Layer
.
ExtensionHeaders
.
NextHeader
));
// Ethernet
Assert
.
AreEqual
(
packet
.
Length
-
EthernetDatagram
.
HeaderLengthValue
,
packet
.
Ethernet
.
PayloadLength
,
"PayloadLength"
);
...
...
PcapDotNet/src/PcapDotNet.Packets.TestUtils/RandomIpV6Extensions.cs
View file @
ffccec5d
...
...
@@ -33,7 +33,7 @@ namespace PcapDotNet.Packets.TestUtils
HopLimit
=
random
.
NextByte
(),
Source
=
random
.
NextIpV6Address
(),
CurrentDestination
=
random
.
NextIpV6Address
(),
ExtensionHeaders
=
random
.
NextIpV6ExtensionHeaders
(
random
.
NextInt
(
0
,
10
))
,
ExtensionHeaders
=
extensionHeaders
,
};
}
...
...
@@ -73,7 +73,6 @@ namespace PcapDotNet.Packets.TestUtils
return
new
IpV6ExtensionHeaderRoutingRpl
(
nextHeader
,
random
.
NextByte
(),
random
.
NextByte
(
IpV6ExtensionHeaderRoutingRpl
.
MaxCommonPrefixLength
+
1
),
random
.
NextByte
(
IpV6ExtensionHeaderRoutingRpl
.
MaxCommonPrefixLength
+
1
),
random
.
NextByte
(
IpV6ExtensionHeaderRoutingRpl
.
MaxPadSize
+
1
),
random
.
NextIpV6AddressArray
(
random
.
NextInt
(
0
,
10
)));
default
:
...
...
@@ -94,7 +93,7 @@ namespace PcapDotNet.Packets.TestUtils
return
new
IpV6ExtensionHeaderEncapsulatingSecurityPayload
(
random
.
NextUInt
(),
random
.
NextUInt
(),
random
.
NextDataSegment
(
random
.
Next
(
100
)));
case
IpV4Protocol
.
AuthenticationHeader
:
// 51
return
new
IpV6ExtensionHeaderAuthentication
(
nextHeader
,
random
.
NextUInt
(),
random
.
NextUInt
(),
random
.
NextDataSegment
(
random
.
Next
(
100
)
));
return
new
IpV6ExtensionHeaderAuthentication
(
nextHeader
,
random
.
NextUInt
(),
random
.
NextUInt
(),
random
.
NextDataSegment
(
random
.
Next
(
25
)
*
4
));
default
:
throw
new
InvalidOperationException
(
string
.
Format
(
"Invalid extensionHeaderType value {0}"
,
extensionHeaderType
));
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Datagram.cs
View file @
ffccec5d
...
...
@@ -247,6 +247,7 @@ namespace PcapDotNet.Packets.IpV6
protected
override
bool
CalculateIsValid
()
{
_isValid
=
true
;
ParseExtensionHeaders
();
return
_isValid
;
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeader.cs
View file @
ffccec5d
...
...
@@ -110,7 +110,7 @@ namespace PcapDotNet.Packets.IpV6
return
;
}
nextNextHeader
=
(
IpV4Protocol
)
extensionHeader
[
Offset
.
NextHeader
];
extensionHeaderLength
=
extensionHeader
[
Offset
.
HeaderExtensionLength
]
*
8
;
extensionHeaderLength
=
(
extensionHeader
[
Offset
.
HeaderExtensionLength
]
+
1
)
*
8
;
}
internal
static
ReadOnlyCollection
<
IpV4Protocol
>
StandardExtensionHeaders
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderAuthentication.cs
View file @
ffccec5d
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
...
...
@@ -35,6 +36,12 @@ namespace PcapDotNet.Packets.IpV6
public
IpV6ExtensionHeaderAuthentication
(
IpV4Protocol
nextHeader
,
uint
securityParametersIndex
,
uint
sequenceNumber
,
DataSegment
authenticationData
)
:
base
(
nextHeader
)
{
if
(
authenticationData
.
Length
%
4
!=
0
)
{
throw
new
ArgumentException
(
string
.
Format
(
"Authentication Data must be an integral multiple of 4 byte in length, and not {0}."
,
authenticationData
.
Length
),
"authenticationData"
);
}
SecurityParametersIndex
=
securityParametersIndex
;
SequenceNumber
=
sequenceNumber
;
AuthenticationData
=
authenticationData
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderRoutingRpl.cs
View file @
ffccec5d
...
...
@@ -63,7 +63,7 @@ namespace PcapDotNet.Packets.IpV6
public
const
byte
MaxPadSize
=
IpV6Address
.
SizeOf
-
1
;
public
IpV6ExtensionHeaderRoutingRpl
(
IpV4Protocol
nextHeader
,
byte
segmentsLeft
,
byte
commonPrefixLengthForNonLastAddresses
,
byte
commonPrefixLengthForLastAddress
,
byte
padSize
,
params
IpV6Address
[]
addresses
)
byte
commonPrefixLengthForLastAddress
,
params
IpV6Address
[]
addresses
)
:
base
(
nextHeader
,
segmentsLeft
)
{
if
(
commonPrefixLengthForNonLastAddresses
>
MaxCommonPrefixLength
)
...
...
@@ -80,11 +80,9 @@ namespace PcapDotNet.Packets.IpV6
}
CommonPrefixLengthForLastAddress
=
commonPrefixLengthForLastAddress
;
if
(
padSize
>
MaxPadSize
)
throw
new
ArgumentOutOfRangeException
(
"padSize"
,
padSize
,
string
.
Format
(
"Maximum value is {0}"
,
MaxPadSize
));
PadSize
=
padSize
;
Addresses
=
addresses
.
AsReadOnly
();
PadSize
=
(
byte
)((
8
-
RoutingDataLength
%
8
)
%
8
);
}
public
override
IpV6RoutingType
RoutingType
...
...
@@ -168,7 +166,7 @@ namespace PcapDotNet.Packets.IpV6
lastAddressSegment
.
Write
(
addressBytes
,
0
);
addresses
[
numAddresses
-
1
]
=
addressBytes
.
ReadIpV6Address
(
0
,
Endianity
.
Big
);
}
return
new
IpV6ExtensionHeaderRoutingRpl
(
nextHeader
,
segmentsLeft
,
commonPrefixLengthForNonLastAddresses
,
commonPrefixLengthForLastAddress
,
padSize
,
return
new
IpV6ExtensionHeaderRoutingRpl
(
nextHeader
,
segmentsLeft
,
commonPrefixLengthForNonLastAddresses
,
commonPrefixLengthForLastAddress
,
addresses
);
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionUnknown.cs
View file @
ffccec5d
...
...
@@ -2987,7 +2987,7 @@ namespace PcapDotNet.Packets.IpV6
if
(
data
.
Length
!=
OptionDataLength
)
return
null
;
byte
prefixLength
=
(
byte
)((
data
[
Offset
.
PrefixLength
]
&
Mask
.
PrefixLength
)
>>
Offse
t
.
PrefixLength
);
byte
prefixLength
=
(
byte
)((
data
[
Offset
.
PrefixLength
]
&
Mask
.
PrefixLength
)
>>
Shif
t
.
PrefixLength
);
IpV4Address
homeAddress
=
data
.
ReadIpV4Address
(
Offset
.
HomeAddress
,
Endianity
.
Big
);
return
new
IpV6MobilityOptionIpV4HomeAddressRequest
(
prefixLength
,
homeAddress
);
}
...
...
@@ -3119,7 +3119,7 @@ namespace PcapDotNet.Packets.IpV6
return
null
;
IpV6IpV4HomeAddressReplyStatus
status
=
(
IpV6IpV4HomeAddressReplyStatus
)
data
[
Offset
.
Status
];
byte
prefixLength
=
(
byte
)((
data
[
Offset
.
PrefixLength
]
&
Mask
.
PrefixLength
)
>>
Offse
t
.
PrefixLength
);
byte
prefixLength
=
(
byte
)((
data
[
Offset
.
PrefixLength
]
&
Mask
.
PrefixLength
)
>>
Shif
t
.
PrefixLength
);
IpV4Address
homeAddress
=
data
.
ReadIpV4Address
(
Offset
.
HomeAddress
,
Endianity
.
Big
);
return
new
IpV6MobilityOptionIpV4HomeAddressReply
(
status
,
prefixLength
,
homeAddress
);
}
...
...
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