Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
37531147
Commit
37531147
authored
8 years ago
by
Gabriel Ganne
Browse files
Options
Downloads
Patches
Plain Diff
add bindings for NSH over GRE
Signed-off-by:
Gabriel Ganne
<
gabriel.ganne@enea.com
>
parent
e936a205
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scapy/contrib/nsh.py
+2
-0
2 additions, 0 deletions
scapy/contrib/nsh.py
scapy/contrib/nsh.uts
+3
-0
3 additions, 0 deletions
scapy/contrib/nsh.uts
with
5 additions
and
0 deletions
scapy/contrib/nsh.py
+
2
−
0
View file @
37531147
...
...
@@ -9,6 +9,7 @@ from scapy.layers.inet import Ether, IP
from
scapy.layers.inet6
import
IPv6
from
scapy.layers.vxlan
import
VXLAN
from
scapy.packet
import
Packet
from
scapy.layers.l2
import
GRE
from
scapy.contrib.mpls
import
MPLS
...
...
@@ -71,6 +72,7 @@ class NSH(Packet):
bind_layers
(
Ether
,
NSH
,
{
'
type
'
:
0x894F
},
type
=
0x894F
)
bind_layers
(
VXLAN
,
NSH
,
{
'
flags
'
:
0xC
,
'
NextProtocol
'
:
4
},
NextProtocol
=
4
)
bind_layers
(
GRE
,
NSH
,
{
'
proto
'
:
0x894F
},
proto
=
0x894F
)
bind_layers
(
NSH
,
IP
,
{
'
NextProto
'
:
1
},
NextProto
=
1
)
bind_layers
(
NSH
,
IPv6
,
{
'
NextProto
'
:
2
},
NextProto
=
2
)
...
...
This diff is collapsed.
Click to expand it.
scapy/contrib/nsh.uts
+
3
−
0
View file @
37531147
...
...
@@ -12,3 +12,6 @@ str(NSH(Len=2, NSP=42, NSI=1)/NSH()) == b'\x00\x02\x01\x04\x00\x00*\x01\x00\x00\
= Build a Ethernet over NSH over Ethernet packet (NSH over Ethernet encapsulating the original packet) and verify Ethernet Bindings
str(Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/NSH()/Ether(src="00:00:00:00:00:03", dst="00:00:00:00:00:04")/ARP(psrc="10.0.0.1", hwsrc="00:00:00:00:00:01")) == b'\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x01\x89O\x00\x00\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x03\x08\x06\x00\x01\x08\x00\x06\x04\x00\x01\x00\x00\x00\x00\x00\x01\n\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
= Build a NSH over GRE packet, and verify GRE Bindings
str(Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/IP(src="1.1.1.1", dst="2.2.2.2")/GRE()/NSH()/Ether(src="00:00:00:00:00:03", dst="00:00:00:00:00:04")/ARP(psrc="10.0.0.1", hwsrc="00:00:00:00:00:01")) == '\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x01\x08\x00\x45\x00\x00\x5a\x00\x01\x00\x00\x40\x2f\x74\x6f\x01\x01\x01\x01\x02\x02\x02\x02\x00\x00\x89\x4f\x00\x00\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x03\x08\x06\x00\x01\x08\x00\x06\x04\x00\x01\x00\x00\x00\x00\x00\x01\x0a\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment