From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 995341B13F for ; Tue, 2 Apr 2019 22:39:15 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id d1so5144667plj.8 for ; Tue, 02 Apr 2019 13:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rsu/zd9+WjV0lAvraEaCr9X8lrfbEF661yFytoN2VXA=; b=nGBvCd/Dteu7/B4sxuQZFSxMZPt74hLkeXzhA3zPS6GTeh8CHeC47jQXxxO7u0VCH8 +2I73ZgPhoV0Uhm63Hh+i4i1fGK0+UPwTzdO9uFiHNZxdwA2XLpiman52YugpFlKnvYF yXcGJoIHhsGp6NNYI563b9KYzMEAyQ3X8Mt/49VbQX14Gi8wLnQmsvAc141ePehtKV30 Ykhs+eHOKLj1LUTdT6DfveXbqySDQsDMpmj+C1q2H0pTmx5zXyXNnzwhzHhGOKGdsZEd c0GzDDLcQfSzwr7HtqnmJyRR1aVVMhOnoN7x3uoql8cxjvXxjAlHiK/2yxgnpxaS59Vc wDjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rsu/zd9+WjV0lAvraEaCr9X8lrfbEF661yFytoN2VXA=; b=tnULVVlIREP1gwruSLCMK7AyfvPbQTrgZAQm0Av3yhXdCfg9rifEWZPK55Onox7Lwl Mr8FytEuJD8C6WDOppXwc5X8nj6q7xO9ZRmp9nR7HlHkvLb0iiJPBhm32Y5zeNUdm3kI fboSiDlR/z5GWbRm08EoXkOJECR9CBPg+9w+FaxUguMscieCFCf7e+0iFxmDHCBJkuWJ +X4Dxz5VUFd0uZfrutyuk9VK5Focl4hVKHpWp3q5/HamiqyG2AtNzSdmA9O+vHzWHyZf Ys9gRdSt1afwX0N04tiznOpwclB4h/Gw18O0FBBDo0qv/N3f7VN4MewGt6I4PU6wc2BO tSEw== X-Gm-Message-State: APjAAAVDQmwGPYxiV4ouAeqiief6iIO0YQFtSFAT4nL6a135Qr5tt6N5 vj5oMXPwimzHa5sq6Hy61NvILKkDzK/6xQ== X-Google-Smtp-Source: APXvYqyJ2g3EyWIfLiSHUsbjAlAMctmP1LLNmcF6Py727K3rUKOTzOwTt2zOfm7xPaTeXldhh997DA== X-Received: by 2002:a17:902:b28b:: with SMTP id u11mr22236049plr.257.1554237554491; Tue, 02 Apr 2019 13:39:14 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t64sm34191748pfa.86.2019.04.02.13.39.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2019 13:39:13 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 2 Apr 2019 13:39:07 -0700 Message-Id: <20190402203907.28679-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190402203907.28679-1-stephen@networkplumber.org> References: <20180618213557.15209-2-stephen@networkplumber.org> <20190402203907.28679-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2019 20:39:16 -0000 The IP addresses should be formatted using standard routines rather than dumpin in raw hex. Signed-off-by: Stephen Hemminger --- v4 - remove fixes, the original output was raw but not a bug 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 #include #include +#include #include #include @@ -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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 850CDA0679 for ; Tue, 2 Apr 2019 22:39:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DA7D1B1F5; Tue, 2 Apr 2019 22:39:23 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 995341B13F for ; Tue, 2 Apr 2019 22:39:15 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id d1so5144667plj.8 for ; Tue, 02 Apr 2019 13:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rsu/zd9+WjV0lAvraEaCr9X8lrfbEF661yFytoN2VXA=; b=nGBvCd/Dteu7/B4sxuQZFSxMZPt74hLkeXzhA3zPS6GTeh8CHeC47jQXxxO7u0VCH8 +2I73ZgPhoV0Uhm63Hh+i4i1fGK0+UPwTzdO9uFiHNZxdwA2XLpiman52YugpFlKnvYF yXcGJoIHhsGp6NNYI563b9KYzMEAyQ3X8Mt/49VbQX14Gi8wLnQmsvAc141ePehtKV30 Ykhs+eHOKLj1LUTdT6DfveXbqySDQsDMpmj+C1q2H0pTmx5zXyXNnzwhzHhGOKGdsZEd c0GzDDLcQfSzwr7HtqnmJyRR1aVVMhOnoN7x3uoql8cxjvXxjAlHiK/2yxgnpxaS59Vc wDjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rsu/zd9+WjV0lAvraEaCr9X8lrfbEF661yFytoN2VXA=; b=tnULVVlIREP1gwruSLCMK7AyfvPbQTrgZAQm0Av3yhXdCfg9rifEWZPK55Onox7Lwl Mr8FytEuJD8C6WDOppXwc5X8nj6q7xO9ZRmp9nR7HlHkvLb0iiJPBhm32Y5zeNUdm3kI fboSiDlR/z5GWbRm08EoXkOJECR9CBPg+9w+FaxUguMscieCFCf7e+0iFxmDHCBJkuWJ +X4Dxz5VUFd0uZfrutyuk9VK5Focl4hVKHpWp3q5/HamiqyG2AtNzSdmA9O+vHzWHyZf Ys9gRdSt1afwX0N04tiznOpwclB4h/Gw18O0FBBDo0qv/N3f7VN4MewGt6I4PU6wc2BO tSEw== X-Gm-Message-State: APjAAAVDQmwGPYxiV4ouAeqiief6iIO0YQFtSFAT4nL6a135Qr5tt6N5 vj5oMXPwimzHa5sq6Hy61NvILKkDzK/6xQ== X-Google-Smtp-Source: APXvYqyJ2g3EyWIfLiSHUsbjAlAMctmP1LLNmcF6Py727K3rUKOTzOwTt2zOfm7xPaTeXldhh997DA== X-Received: by 2002:a17:902:b28b:: with SMTP id u11mr22236049plr.257.1554237554491; Tue, 02 Apr 2019 13:39:14 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t64sm34191748pfa.86.2019.04.02.13.39.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2019 13:39:13 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 2 Apr 2019 13:39:07 -0700 Message-Id: <20190402203907.28679-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190402203907.28679-1-stephen@networkplumber.org> References: <20180618213557.15209-2-stephen@networkplumber.org> <20190402203907.28679-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v4 3/3] examples/l3fwd: format the IP addresses for printing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190402203907.QIObnJkdoOA7KFHT2IK9eWFGE44mar2AmWhr6DfG8vA@z> The IP addresses should be formatted using standard routines rather than dumpin in raw hex. Signed-off-by: Stephen Hemminger --- v4 - remove fixes, the original output was raw but not a bug 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 #include #include +#include #include #include @@ -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