[dts] [PATCH V2 3/4] add nvgre protocol for scapy
huilong,xu
huilongx.xu at intel.com
Tue Jun 16 04:45:00 CEST 2015
From: huilong xu <huilongx.xu at intel.com>
used function:
1. copy ./dep/nvgre.py to fedor layers in python install path
eg: python2.7 default path: /usr/lib/python2.7/site-packages/scapy/layers/
2. update scapy config file
add "nvgre" to vlaue "load_layers" in scapy config file.
eg: python2.7 default config file: /usr/lib/python2.7/site-packages/scapy/config.py
Signed-off-by: huilong xu <huilongx.xu at intel.com>
---
dep/nvgre.py | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
create mode 100644 dep/nvgre.py
diff --git a/dep/nvgre.py b/dep/nvgre.py
new file mode 100644
index 0000000..d844bd1
--- /dev/null
+++ b/dep/nvgre.py
@@ -0,0 +1,33 @@
+## This file is part of Scapy
+##
+## Copyright (C) Min Cao <min.cao at intel.com>
+
+"""
+NVGRE (Network Virtual GRE).
+"""
+
+from scapy.packet import *
+from scapy.fields import *
+from scapy.layers.inet import UDP,IP
+from scapy.layers.l2 import Ether
+
+IPPROTO_NVGRE=47
+
+class NVGRE(Packet):
+ name = "Network Virtual GRE"
+ fields_desc = [BitField("c", 0, 1),
+ BitField("r", 0, 1),
+ BitField("k", 1, 1),
+ BitField("s", 0, 1),
+ BitField("reserved0", 0, 9),
+ BitField("ver", 0, 3),
+ XShortField("protocoltype", 0x6558),
+ X3BytesField("TNI", 1),
+ ByteField("reserved1", 0)]
+ def mysummary(self):
+ return self.sprintf("NVGRE (tni=%NVGRE.tni%)")
+
+
+bind_layers(IP, NVGRE, proto=IPPROTO_NVGRE)
+bind_layers(NVGRE, Ether)
+
--
1.7.4.4
More information about the dts
mailing list