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
8cb72b80
Commit
8cb72b80
authored
Aug 29, 2014
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
Code Coverage 95.77%
parent
caa898ce
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
7 deletions
+53
-7
WiresharkDatagramComparerVLanTaggedFrame.cs
...Net.Core.Test/WiresharkDatagramComparerVLanTaggedFrame.cs
+1
-1
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+52
-0
IpV6AccessNetworkIdentifierSubOption.cs
...kets/IpV6/Options/IpV6AccessNetworkIdentifierSubOption.cs
+0
-3
IpV6OptionComplex.cs
.../src/PcapDotNet.Packets/IpV6/Options/IpV6OptionComplex.cs
+0
-3
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerVLanTaggedFrame.cs
View file @
8cb72b80
...
@@ -41,7 +41,7 @@ namespace PcapDotNet.Core.Test
...
@@ -41,7 +41,7 @@ namespace PcapDotNet.Core.Test
case
"vlan.trailer"
:
case
"vlan.trailer"
:
if
(!
new
[]
if
(!
new
[]
{
{
(
EthernetType
)
1
,
(
EthernetType
)
5
,
(
EthernetType
)
17
,
(
EthernetType
)
29
,
(
EthernetType
)
30
,
(
EthernetType
)
43
,
(
EthernetType
)
50
(
EthernetType
)
1
,
(
EthernetType
)
5
,
(
EthernetType
)
17
,
(
EthernetType
)
29
,
(
EthernetType
)
30
,
(
EthernetType
)
43
,
(
EthernetType
)
50
,
EthernetType
.
ReverseArp
,
}.
Contains
(
}.
Contains
(
vLanTaggedFrameDatagram
.
EtherType
))
vLanTaggedFrameDatagram
.
EtherType
))
field
.
AssertValue
(
vLanTaggedFrameDatagram
.
TrailerWithFrameCheckSequence
);
field
.
AssertValue
(
vLanTaggedFrameDatagram
.
TrailerWithFrameCheckSequence
);
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
8cb72b80
...
@@ -181,6 +181,16 @@ namespace PcapDotNet.Packets.Test
...
@@ -181,6 +181,16 @@ namespace PcapDotNet.Packets.Test
IpV6MobilityOptionCareOfTest
optionCareOfTest
=
(
IpV6MobilityOptionCareOfTest
)
option
;
IpV6MobilityOptionCareOfTest
optionCareOfTest
=
(
IpV6MobilityOptionCareOfTest
)
option
;
Assert
.
IsInstanceOfType
(
optionCareOfTest
.
CareOfKeygenToken
,
typeof
(
ulong
));
Assert
.
IsInstanceOfType
(
optionCareOfTest
.
CareOfKeygenToken
,
typeof
(
ulong
));
break
;
break
;
case
IpV6MobilityOptionType
.
IpV4CareOfAddress
:
IpV6MobilityOptionIpV4CareOfAddress
optionIpV4CareOfAddress
=
(
IpV6MobilityOptionIpV4CareOfAddress
)
option
;
Assert
.
IsNotNull
(
optionIpV4CareOfAddress
.
CareOfAddress
);
break
;
case
IpV6MobilityOptionType
.
ReplayProtection
:
IpV6MobilityOptionReplayProtection
optionReplayProtection
=
(
IpV6MobilityOptionReplayProtection
)
option
;
Assert
.
IsNotNull
(
optionReplayProtection
.
Timestamp
);
break
;
}
}
}
}
}
}
...
@@ -1205,5 +1215,47 @@ namespace PcapDotNet.Packets.Test
...
@@ -1205,5 +1215,47 @@ namespace PcapDotNet.Packets.Test
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
}
[
TestMethod
]
public
void
IpV6MobilityOptionIpV4CareOfAddressDataTooShort
()
{
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
IpV6MobilityOptionIpV4CareOfAddress
(
IpV4Address
.
Zero
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
24
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
[
TestMethod
]
public
void
IpV6MobilityOptionReplayProtectionDataTooShort
()
{
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
IpV6MobilityOptionReplayProtection
(
0
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
24
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
}
}
}
}
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOption.cs
View file @
8cb72b80
...
@@ -43,9 +43,6 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -43,9 +43,6 @@ namespace PcapDotNet.Packets.IpV6
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
[
offset
++]
=
(
byte
)
OptionType
;
buffer
[
offset
++]
=
(
byte
)
OptionType
;
// TODO: Remove this check.
if
(
DataLength
>
byte
.
MaxValue
)
throw
new
InvalidOperationException
(
"Option length is too long."
);
buffer
[
offset
++]
=
(
byte
)
DataLength
;
buffer
[
offset
++]
=
(
byte
)
DataLength
;
WriteData
(
buffer
,
ref
offset
);
WriteData
(
buffer
,
ref
offset
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionComplex.cs
View file @
8cb72b80
...
@@ -32,9 +32,6 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -32,9 +32,6 @@ namespace PcapDotNet.Packets.IpV6
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
// TODO: Get rid of this.
if
(
DataLength
>
byte
.
MaxValue
)
throw
new
InvalidOperationException
(
"DataLength is "
+
DataLength
);
buffer
[
offset
++]
=
(
byte
)
DataLength
;
buffer
[
offset
++]
=
(
byte
)
DataLength
;
WriteData
(
buffer
,
ref
offset
);
WriteData
(
buffer
,
ref
offset
);
}
}
...
...
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