[v4,2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses

Message ID 20190402203907.28679-3-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series use RFC addresses in test applications |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger April 2, 2019, 8:39 p.m. UTC
  The l3fwd example should use the IPv4 addresses defined in RFC5735 and
the IPv6 addresses defined in RFC5180 for the L3 forwarding example
Longest Prefix Match table.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v4 - fix IPv6 /48 entries

 examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)
  

Comments

Iremonger, Bernard April 8, 2019, 1:07 p.m. UTC | #1
Hi Stephen,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Tuesday, April 2, 2019 9:39 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6
> addresses
> 
> The l3fwd example should use the IPv4 addresses defined in RFC5735 and the
> IPv6 addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> Match table.

There should probably be a fixes line.
Also the commit line should have the "fix" keyword. 
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v4 - fix IPv6 /48 entries
> 
>  examples/l3fwd/l3fwd_lpm.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index
> b1dc195ad8cb..3191fc4c2639 100644
> --- a/examples/l3fwd/l3fwd_lpm.c
> +++ b/examples/l3fwd/l3fwd_lpm.c
> @@ -39,26 +39,28 @@ struct ipv6_l3fwd_lpm_route {
>  	uint8_t  if_out;
>  };
> 
> +/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
>  static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
> -	{IPv4(1, 1, 1, 0), 24, 0},
> -	{IPv4(2, 1, 1, 0), 24, 1},
> -	{IPv4(3, 1, 1, 0), 24, 2},
> -	{IPv4(4, 1, 1, 0), 24, 3},
> -	{IPv4(5, 1, 1, 0), 24, 4},
> -	{IPv4(6, 1, 1, 0), 24, 5},
> -	{IPv4(7, 1, 1, 0), 24, 6},
> -	{IPv4(8, 1, 1, 0), 24, 7},
> +	{IPv4(192, 18, 0, 0), 24, 0},
> +	{IPv4(192, 18, 1, 0), 24, 1},
> +	{IPv4(192, 18, 2, 0), 24, 2},
> +	{IPv4(192, 18, 3, 0), 24, 3},
> +	{IPv4(192, 18, 4, 0), 24, 4},
> +	{IPv4(192, 18, 5, 0), 24, 5},
> +	{IPv4(192, 18, 6, 0), 24, 6},
> +	{IPv4(192, 18, 7, 0), 24, 7},
>  };
> 
> +/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking
> +(RFC5180) */
>  static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
> -	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
> -	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
> -	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
> -	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 3},
> -	{{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 4},
> -	{{6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 5},
> -	{{7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 6},
> -	{{8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 7},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
> +	{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
>  };
> 
>  #define IPV4_L3FWD_LPM_NUM_ROUTES \
> --
> 2.17.1

Regards,

Bernard.
  
Stephen Hemminger April 9, 2019, 5:14 p.m. UTC | #2
On Mon, 8 Apr 2019 13:07:33 +0000
"Iremonger, Bernard" <bernard.iremonger@intel.com> wrote:

> Hi Stephen,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> > Sent: Tuesday, April 2, 2019 9:39 PM
> > To: dev@dpdk.org
> > Cc: Stephen Hemminger <stephen@networkplumber.org>
> > Subject: [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6
> > addresses
> > 
> > The l3fwd example should use the IPv4 addresses defined in RFC5735 and the
> > IPv6 addresses defined in RFC5180 for the L3 forwarding example Longest Prefix
> > Match table.  
> 
> There should probably be a fixes line.
> Also the commit line should have the "fix" keyword. 

The original behavior was not a bug. It was just a poor design choice.
Therefore the lack of fixes tag is intentional.
Also didn't want this patch to make it into stable release and risk breaking
some existing test bed.
  

Patch

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index b1dc195ad8cb..3191fc4c2639 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -39,26 +39,28 @@  struct ipv6_l3fwd_lpm_route {
 	uint8_t  if_out;
 };
 
+/* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */
 static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
-	{IPv4(1, 1, 1, 0), 24, 0},
-	{IPv4(2, 1, 1, 0), 24, 1},
-	{IPv4(3, 1, 1, 0), 24, 2},
-	{IPv4(4, 1, 1, 0), 24, 3},
-	{IPv4(5, 1, 1, 0), 24, 4},
-	{IPv4(6, 1, 1, 0), 24, 5},
-	{IPv4(7, 1, 1, 0), 24, 6},
-	{IPv4(8, 1, 1, 0), 24, 7},
+	{IPv4(192, 18, 0, 0), 24, 0},
+	{IPv4(192, 18, 1, 0), 24, 1},
+	{IPv4(192, 18, 2, 0), 24, 2},
+	{IPv4(192, 18, 3, 0), 24, 3},
+	{IPv4(192, 18, 4, 0), 24, 4},
+	{IPv4(192, 18, 5, 0), 24, 5},
+	{IPv4(192, 18, 6, 0), 24, 6},
+	{IPv4(192, 18, 7, 0), 24, 7},
 };
 
+/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
 static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
-	{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 0},
-	{{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 1},
-	{{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 48, 2},
-	{{4, 1, 1, 1, 1, 1, 1, 1, 1, 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