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
97ea93e2
Commit
97ea93e2
authored
Apr 13, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test GRE with inner layers.
parent
accb8c69
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
34 deletions
+33
-34
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+3
-1
WiresharkDatagramComparer.cs
...Net/src/PcapDotNet.Core.Test/WiresharkDatagramComparer.cs
+4
-2
WiresharkDatagramComparerGre.cs
.../src/PcapDotNet.Core.Test/WiresharkDatagramComparerGre.cs
+20
-29
GreLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Gre/GreLayer.cs
+6
-2
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
97ea93e2
...
@@ -244,7 +244,9 @@ namespace PcapDotNet.Core.Test
...
@@ -244,7 +244,9 @@ namespace PcapDotNet.Core.Test
return
;
return
;
case
4
:
// Gre.
case
4
:
// Gre.
layers
.
Add
(
random
.
NextGreLayer
());
GreLayer
greLayer
=
random
.
NextGreLayer
();
layers
.
Add
(
greLayer
);
CreateRandomEthernetPayload
(
random
,
greLayer
,
layers
);
return
;
return
;
case
5
:
// Udp.
case
5
:
// Udp.
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparer.cs
View file @
97ea93e2
...
@@ -14,8 +14,10 @@ namespace PcapDotNet.Core.Test
...
@@ -14,8 +14,10 @@ namespace PcapDotNet.Core.Test
return
null
;
return
null
;
Datagram
datagram
=
(
Datagram
)
property
.
GetValue
(
datagramParent
);
Datagram
datagram
=
(
Datagram
)
property
.
GetValue
(
datagramParent
);
if
(!
Ignore
(
datagram
))
if
(
Ignore
(
datagram
))
CompareDatagram
(
layer
,
datagramParent
as
Datagram
,
datagram
);
return
null
;
CompareDatagram
(
layer
,
datagramParent
as
Datagram
,
datagram
);
return
datagram
;
return
datagram
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerGre.cs
View file @
97ea93e2
...
@@ -91,40 +91,31 @@ namespace PcapDotNet.Core.Test
...
@@ -91,40 +91,31 @@ namespace PcapDotNet.Core.Test
break
;
break
;
case
"gre.routing.address_family"
:
case
"gre.routing.address_family"
:
if
(
SupportedGre
(
greDatagram
))
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
{
field
.
AssertShowDecimal
(
0
);
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
else
field
.
AssertShowDecimal
(
0
);
field
.
AssertShowDecimal
((
ushort
)
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
);
else
field
.
AssertShowDecimal
((
ushort
)
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
);
}
field
.
AssertNoFields
();
field
.
AssertNoFields
();
break
;
break
;
case
"gre.routing.sre_offset"
:
case
"gre.routing.sre_offset"
:
if
(
SupportedGre
(
greDatagram
))
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
{
field
.
AssertShowDecimal
(
0
);
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
else
field
.
AssertShowDecimal
(
0
);
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadOffset
);
else
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadOffset
);
}
field
.
AssertNoFields
();
field
.
AssertNoFields
();
break
;
break
;
case
"gre.routing.src_length"
:
case
"gre.routing.src_length"
:
if
(
SupportedGre
(
greDatagram
))
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
{
field
.
AssertShowDecimal
(
0
);
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
else
field
.
AssertShowDecimal
(
0
);
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadLength
);
else
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadLength
);
}
field
.
AssertNoFields
();
field
.
AssertNoFields
();
break
;
break
;
case
"gre.routing.information"
:
case
"gre.routing.information"
:
if
(
SupportedGre
(
greDatagram
)
&&
_routingEntryIndex
!=
greDatagram
.
Routing
.
Count
)
if
(
_routingEntryIndex
!=
greDatagram
.
Routing
.
Count
)
{
{
switch
(
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
)
switch
(
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
)
{
{
...
@@ -158,8 +149,7 @@ namespace PcapDotNet.Core.Test
...
@@ -158,8 +149,7 @@ namespace PcapDotNet.Core.Test
case
"data"
:
case
"data"
:
case
"data.data"
:
case
"data.data"
:
if
(
SupportedGre
(
greDatagram
))
field
.
AssertDataField
(
greDatagram
.
Payload
);
field
.
AssertDataField
(
greDatagram
.
Payload
);
break
;
break
;
default
:
default
:
...
@@ -170,12 +160,13 @@ namespace PcapDotNet.Core.Test
...
@@ -170,12 +160,13 @@ namespace PcapDotNet.Core.Test
return
true
;
return
true
;
}
}
pr
ivate
static
bool
SupportedGre
(
GreDatagram
greD
atagram
)
pr
otected
override
bool
Ignore
(
Datagram
d
atagram
)
{
{
return
greDatagram
.
IsValid
&&
GreDatagram
greDatagram
=
(
GreDatagram
)
datagram
;
(
greDatagram
.
ProtocolType
==
EthernetType
.
PointToPointProtocol
||
return
!
greDatagram
.
IsValid
||
greDatagram
.
Version
==
GreVersion
.
EnhancedGre
||
(
greDatagram
.
ProtocolType
!=
EthernetType
.
PointToPointProtocol
||
!
greDatagram
.
AcknowledgmentSequenceNumberPresent
);
greDatagram
.
Version
!=
GreVersion
.
EnhancedGre
)
&&
greDatagram
.
AcknowledgmentSequenceNumberPresent
;
}
}
private
int
_routingEntryIndex
=
0
;
private
int
_routingEntryIndex
=
0
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Gre/GreLayer.cs
View file @
97ea93e2
...
@@ -11,7 +11,7 @@ namespace PcapDotNet.Packets.Gre
...
@@ -11,7 +11,7 @@ namespace PcapDotNet.Packets.Gre
/// Represents a GRE layer.
/// Represents a GRE layer.
/// <seealso cref="GreDatagram"/>
/// <seealso cref="GreDatagram"/>
/// </summary>
/// </summary>
public
sealed
class
GreLayer
:
Layer
,
IIpV4NextLayer
,
IEquatable
<
GreLayer
>
public
sealed
class
GreLayer
:
EthernetBase
Layer
,
IIpV4NextLayer
,
IEquatable
<
GreLayer
>
{
{
/// <summary>
/// <summary>
/// The GRE Version Number.
/// The GRE Version Number.
...
@@ -23,7 +23,11 @@ namespace PcapDotNet.Packets.Gre
...
@@ -23,7 +23,11 @@ namespace PcapDotNet.Packets.Gre
/// These Protocol Types are defined in [RFC1700] as "ETHER TYPES" and in [ETYPES].
/// These Protocol Types are defined in [RFC1700] as "ETHER TYPES" and in [ETYPES].
/// An implementation receiving a packet containing a Protocol Type which is not listed in [RFC1700] or [ETYPES] SHOULD discard the packet.
/// An implementation receiving a packet containing a Protocol Type which is not listed in [RFC1700] or [ETYPES] SHOULD discard the packet.
/// </summary>
/// </summary>
public
EthernetType
ProtocolType
{
get
;
set
;
}
public
EthernetType
ProtocolType
{
get
{
return
EtherType
;
}
set
{
EtherType
=
value
;
}
}
/// <summary>
/// <summary>
/// Recursion control contains a three bit unsigned integer which contains the number of additional encapsulations which are permissible.
/// Recursion control contains a three bit unsigned integer which contains the number of additional encapsulations which are permissible.
...
...
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