DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing
Date: Wed, 10 Apr 2019 10:41:32 -0700	[thread overview]
Message-ID: <20190410174132.8349-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20190410174132.8349-1-stephen@networkplumber.org>

The IP addresses should be formatted using standard routines
rather than outputing in raw hex.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 examples/l3fwd/l3fwd_lpm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3191fc4c2639..172a036b2707 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <stdbool.h>
+#include <arpa/inet.h>
 
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -260,6 +261,7 @@ setup_lpm(const int socketid)
 	unsigned i;
 	int ret;
 	char s[64];
+	char abuf[INET6_ADDRSTRLEN];
 
 	/* create the LPM table */
 	config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES;
@@ -275,6 +277,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct in_addr in;
 
 		/* skip unused ports */
 		if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &
@@ -292,8 +295,9 @@ setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route 0x%08x / %d (%d)\n",
-			(unsigned)ipv4_l3fwd_lpm_route_array[i].ip,
+		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
+		printf("LPM: Adding route %s / %d (%d)\n",
+		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
 			ipv4_l3fwd_lpm_route_array[i].if_out);
 	}
@@ -331,9 +335,10 @@ setup_lpm(const int socketid)
 		}
 
 		printf("LPM: Adding route %s / %d (%d)\n",
-			"IPV6",
-			ipv6_l3fwd_lpm_route_array[i].depth,
-			ipv6_l3fwd_lpm_route_array[i].if_out);
+		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
+				 abuf, sizeof(abuf)),
+		       ipv6_l3fwd_lpm_route_array[i].depth,
+		       ipv6_l3fwd_lpm_route_array[i].if_out);
 	}
 }
 
-- 
2.17.1

  parent reply	other threads:[~2019-04-10 17:41 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 21:35 [dpdk-dev] [PATCH v3 0/3] use RFC addresses for testing Stephen Hemminger
2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 1/3] testpmd: add ability to set tx IP and UDP parameters Stephen Hemminger
2018-06-22  9:12   ` Iremonger, Bernard
2018-10-29  2:25     ` Thomas Monjalon
2018-06-26 11:47   ` Shahaf Shuler
2018-06-26 11:51   ` Shahaf Shuler
2019-04-02 20:39   ` [dpdk-dev] [PATCH v4 0/3] use RFC addresses in test applications Stephen Hemminger
2019-04-02 20:39     ` Stephen Hemminger
2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
2019-04-02 20:39       ` Stephen Hemminger
2019-04-08 12:51       ` Iremonger, Bernard
2019-04-08 12:51         ` Iremonger, Bernard
2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2019-04-02 20:39       ` Stephen Hemminger
2019-04-08 13:07       ` Iremonger, Bernard
2019-04-08 13:07         ` Iremonger, Bernard
2019-04-09 17:14         ` Stephen Hemminger
2019-04-09 17:14           ` Stephen Hemminger
2019-04-02 20:39     ` [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2019-04-02 20:39       ` Stephen Hemminger
2019-04-08 13:14       ` Iremonger, Bernard
2019-04-08 13:14         ` Iremonger, Bernard
2019-04-09 18:20     ` [dpdk-dev] [PATCH v5 0/3] use RFC addresses in test applications Stephen Hemminger
2019-04-09 18:20       ` Stephen Hemminger
2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
2019-04-09 18:20         ` Stephen Hemminger
2019-04-10 10:07         ` Iremonger, Bernard
2019-04-10 10:07           ` Iremonger, Bernard
2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2019-04-09 18:20         ` Stephen Hemminger
2019-04-10  8:56         ` Iremonger, Bernard
2019-04-10  8:56           ` Iremonger, Bernard
2019-04-09 18:20       ` [dpdk-dev] [PATCH v5 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2019-04-09 18:20         ` Stephen Hemminger
2019-04-10 17:41       ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Stephen Hemminger
2019-04-10 17:41         ` Stephen Hemminger
2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 1/3] app/testpmd: add ability to set Tx IP and UDP parameters Stephen Hemminger
2019-04-10 17:41           ` Stephen Hemminger
2019-04-11  9:02           ` Iremonger, Bernard
2019-04-11  9:02             ` Iremonger, Bernard
2019-04-10 17:41         ` [dpdk-dev] [PATCH v6 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2019-04-10 17:41           ` Stephen Hemminger
2019-04-11  9:08           ` Iremonger, Bernard
2019-04-11  9:08             ` Iremonger, Bernard
2019-04-10 17:41         ` Stephen Hemminger [this message]
2019-04-10 17:41           ` [dpdk-dev] [PATCH v6 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2019-04-21 21:55         ` [dpdk-dev] [PATCH v6 0/3] use IPv4 addresses reserved for testing Thomas Monjalon
2019-04-21 21:55           ` Thomas Monjalon
2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 2/3] examples/l3fwd: use reserved IPv4/IPv6 addresses Stephen Hemminger
2018-06-22  9:19   ` Iremonger, Bernard
2018-06-18 21:35 ` [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: format the IP addresses for printing Stephen Hemminger
2018-06-22 10:23   ` Iremonger, Bernard
2018-06-22 13:44     ` Thomas Monjalon

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=20190410174132.8349-4-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@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).