patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl
@ 2018-12-19  8:41 Saleh Alsouqi
  2018-12-19  9:01 ` Saleh Alsouqi
  0 siblings, 1 reply; 3+ messages in thread
From: Saleh Alsouqi @ 2018-12-19  8:41 UTC (permalink / raw)
  To: Ali Alnubani, Saleh Alsouqi; +Cc: stable

According to ietf rfc791 (see [1])

    "The Version field indicates the format of the
    internet header."

    "Internet Header Length (ihl) is the length of the
    internet header in 32 bit words, and thus points
    to the beginning of the data. Note that
    the minimum value for a correct header is 5."

Having version and ihl set to 0 would result in a
corrupted/incorrect encapsulating packet for MPLS,
this commit sets these fields to 4 and 5 respectively
as the default value.

[1] https://tools.ietf.org/html/rfc791

Fixes: 3e77031be855 ("app/testpmd: add MPLSoGRE encapsulation")
Fixes: a1191d39cb57 ("app/testpmd: add MPLSoUDP encapsulation")
Cc: stable@dpdk.org

Signed-off-by: Saleh Alsouqi <salehals@mellanox.com>
---
 app/test-pmd/cmdline_flow.c | 2 ++
 app/test-pmd/testpmd.h      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5c0108f..c1c5fe3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -3735,6 +3735,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
 			.src_addr = mplsogre_encap_conf.ipv4_src,
 			.dst_addr = mplsogre_encap_conf.ipv4_dst,
 			.next_proto_id = IPPROTO_GRE,
+			.version_ihl = IPV4_VHL_DEF,
 		},
 	};
 	struct rte_flow_item_ipv6 ipv6 = {
@@ -3923,6 +3924,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
 			.src_addr = mplsoudp_encap_conf.ipv4_src,
 			.dst_addr = mplsoudp_encap_conf.ipv4_dst,
 			.next_proto_id = IPPROTO_UDP,
+			.version_ihl = IPV4_VHL_DEF,
 		},
 	};
 	struct rte_flow_item_ipv6 ipv6 = {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 3ff11e6..8b0654f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -22,6 +22,8 @@
 #define RTE_PORT_CLOSED         (uint16_t)2
 #define RTE_PORT_HANDLING       (uint16_t)3
 
+#define IPV4_VHL_DEF (0x40 | 0x5)
+
 /*
  * It is used to allocate the memory for hash key.
  * The hash key size is NIC dependent.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl
  2018-12-19  8:41 [dpdk-stable] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl Saleh Alsouqi
@ 2018-12-19  9:01 ` Saleh Alsouqi
  0 siblings, 0 replies; 3+ messages in thread
From: Saleh Alsouqi @ 2018-12-19  9:01 UTC (permalink / raw)
  Cc: stable

Please ignore this email, it was cc’d by mistake.



Regards,
Saleh



________________________________
From: Saleh Alsouqi
Sent: Wednesday, December 19, 2018 10:41:17 AM
To: Ali Alnubani; Saleh Alsouqi
Cc: stable@dpdk.org
Subject: [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl

According to ietf rfc791 (see [1])

    "The Version field indicates the format of the
    internet header."

    "Internet Header Length (ihl) is the length of the
    internet header in 32 bit words, and thus points
    to the beginning of the data. Note that
    the minimum value for a correct header is 5."

Having version and ihl set to 0 would result in a
corrupted/incorrect encapsulating packet for MPLS,
this commit sets these fields to 4 and 5 respectively
as the default value.

[1] https://tools.ietf.org/html/rfc791

Fixes: 3e77031be855 ("app/testpmd: add MPLSoGRE encapsulation")
Fixes: a1191d39cb57 ("app/testpmd: add MPLSoUDP encapsulation")
Cc: stable@dpdk.org

Signed-off-by: Saleh Alsouqi <salehals@mellanox.com>
---
 app/test-pmd/cmdline_flow.c | 2 ++
 app/test-pmd/testpmd.h      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5c0108f..c1c5fe3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -3735,6 +3735,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
                         .src_addr = mplsogre_encap_conf.ipv4_src,
                         .dst_addr = mplsogre_encap_conf.ipv4_dst,
                         .next_proto_id = IPPROTO_GRE,
+                       .version_ihl = IPV4_VHL_DEF,
                 },
         };
         struct rte_flow_item_ipv6 ipv6 = {
@@ -3923,6 +3924,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
                         .src_addr = mplsoudp_encap_conf.ipv4_src,
                         .dst_addr = mplsoudp_encap_conf.ipv4_dst,
                         .next_proto_id = IPPROTO_UDP,
+                       .version_ihl = IPV4_VHL_DEF,
                 },
         };
         struct rte_flow_item_ipv6 ipv6 = {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 3ff11e6..8b0654f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -22,6 +22,8 @@
 #define RTE_PORT_CLOSED         (uint16_t)2
 #define RTE_PORT_HANDLING       (uint16_t)3

+#define IPV4_VHL_DEF (0x40 | 0x5)
+
 /*
  * It is used to allocate the memory for hash key.
  * The hash key size is NIC dependent.
--
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl
@ 2018-12-18 12:36 Saleh Alsouqi
  0 siblings, 0 replies; 3+ messages in thread
From: Saleh Alsouqi @ 2018-12-18 12:36 UTC (permalink / raw)
  To: wenzhuo.lu, jingjing.wu, bernard.iremonger; +Cc: dev, Ori Kam, stable

According to ietf rfc791 (see [1])

    "The Version field indicates the format of the
    internet header."

    "Internet Header Length (ihl) is the length of the
    internet header in 32 bit words, and thus points
    to the beginning of the data. Note that
    the minimum value for a correct header is 5."

Having version and ihl set to 0 would result in a
corrupted/incorrect encapsulating packet for MPLS,
this commit sets these fields to 4 and 5 respectively
as a default value.

[1] https://tools.ietf.org/html/rfc791

Fixes: 3e77031be855 ("app/testpmd: add MPLSoGRE encapsulation")
Fixes: a1191d39cb57 ("app/testpmd: add MPLSoUDP encapsulation")
Cc: stable@dpdk.org

Signed-off-by: Saleh Alsouqi <salehals@mellanox.com>
---
 app/test-pmd/cmdline_flow.c | 2 ++
 app/test-pmd/testpmd.h      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5c0108f..c1c5fe3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -3735,6 +3735,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
 			.src_addr = mplsogre_encap_conf.ipv4_src,
 			.dst_addr = mplsogre_encap_conf.ipv4_dst,
 			.next_proto_id = IPPROTO_GRE,
+			.version_ihl = IPV4_VHL_DEF,
 		},
 	};
 	struct rte_flow_item_ipv6 ipv6 = {
@@ -3923,6 +3924,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *,
 			.src_addr = mplsoudp_encap_conf.ipv4_src,
 			.dst_addr = mplsoudp_encap_conf.ipv4_dst,
 			.next_proto_id = IPPROTO_UDP,
+			.version_ihl = IPV4_VHL_DEF,
 		},
 	};
 	struct rte_flow_item_ipv6 ipv6 = {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 3ff11e6..8b0654f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -22,6 +22,8 @@
 #define RTE_PORT_CLOSED         (uint16_t)2
 #define RTE_PORT_HANDLING       (uint16_t)3
 
+#define IPV4_VHL_DEF (0x40 | 0x5)
+
 /*
  * It is used to allocate the memory for hash key.
  * The hash key size is NIC dependent.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-19  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19  8:41 [dpdk-stable] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl Saleh Alsouqi
2018-12-19  9:01 ` Saleh Alsouqi
  -- strict thread matches above, loose matches on Subject: below --
2018-12-18 12:36 Saleh Alsouqi

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).