From: "huilong,xu" <huilongx.xu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH V1 3/4] add nvgre protocol for scapy
Date: Thu, 4 Jun 2015 14:04:00 +0800 [thread overview]
Message-ID: <1433397841-1704-3-git-send-email-huilongx.xu@intel.com> (raw)
In-Reply-To: <1433397841-1704-1-git-send-email-huilongx.xu@intel.com>
From: huilong xu <huilongx.xu@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@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@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
next prev parent reply other threads:[~2015-06-04 6:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 6:03 [dts] [PATCH V1 1/4] add nvgre test for fortville NIC huilong,xu
2015-06-04 6:03 ` [dts] [PATCH V1 2/4] add nvgre test plan huilong,xu
2015-06-09 6:42 ` Liu, Yong
2015-06-04 6:04 ` huilong,xu [this message]
2015-06-04 6:04 ` [dts] [PATCH V1 4/4] add nvgre test code huilong,xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1433397841-1704-3-git-send-email-huilongx.xu@intel.com \
--to=huilongx.xu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).