From patchwork Tue Apr 9 18:20:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52494 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8208B5681; Tue, 9 Apr 2019 20:20:26 +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 D16044D3A for ; Tue, 9 Apr 2019 20:20:16 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id ck15so9905801plb.3 for ; Tue, 09 Apr 2019 11:20:16 -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=NUlezdvG7LyaBvxauJAFaFcST55IrTGsF5T0LfTKylk=; b=JXntYTRTOnNEKaaGXH/jlGARMbGk3fJZmIEWvVu4SduHTexzxq9lKJyyKFTI6KX3PZ LzGCGsFKMyx6Lwr++2TOynREuCckQTpf7+3z4iHWUaOq6mQiRSN7vj97uZUpCbjVbtG+ T6PkAwtofPjd1L8ix7DKaStK/ZJ3UNj+3bWBaZvoKd8N+XkDcDLTOw/aKAe/I2ImlL0y NbkbuTeekqCjvuN55fnMIl8c0esBmr5kzCMj3e7VQnZ8uqDkQB4pZwBN0H9FhaiWItn0 DGDyASSc0DuefllWW0ANY5IRGPWaAQAqNszFHDgRv3HS5sU/e042r2ZxZgNROP+LUlVd 0+1w== 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=NUlezdvG7LyaBvxauJAFaFcST55IrTGsF5T0LfTKylk=; b=McS688CDI6+0dl3OiBAjw9j5bmi9ZSQv7/x1gMHiTD87twYMsUFNdtHEKbQBL1P2Iy 1VShvBx+Cgjq69BjFgr+Voqrho3Rk4UnadgV3p6SAZj8KduJ/7gyq9eqbDGhLNqCJGMk sY/E0omApVVqOTdexqjv+GFs2N1BUeLs1qLZ/i06+OASeQUv64JvFtDHTo1NxvnlbYq2 JB9i2uxZezg4CxrSUXKsHGMJFzS98Kux4RVOAtTTprPqrI7G/5fLPnC0zoQXcdzfQmNi qizmHsSRW2i0bz7F0wgAcqwhmrgF84OEJEqPXjmDfOIZsGpEyaB6x69nIcF0PhLeQ0bO FxyQ== X-Gm-Message-State: APjAAAWrtWo2on0XhEuzAEY/wy+cZLR5U0wRPPxOhqDdPHWwl5pCfFZ7 /Yf1FiUPCznodcxpItLbqbr1VrdE3cvIyg== X-Google-Smtp-Source: APXvYqx89JZ59u+q4MzEuDYDRKf7te5iuQlqC/0a3VHWeBRhy4rEXKJTmIyKU3i7ebIx++/7k5UtdQ== X-Received: by 2002:a17:902:5a45:: with SMTP id f5mr739696plm.23.1554834015765; Tue, 09 Apr 2019 11:20:15 -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 128sm18538293pgb.47.2019.04.09.11.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 11:20:14 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 9 Apr 2019 11:20:06 -0700 Message-Id: <20190409182006.12944-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190409182006.12944-1-stephen@networkplumber.org> References: <20190402203907.28679-1-stephen@networkplumber.org> <20190409182006.12944-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v5 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" The IP addresses should be formatted using standard routines rather than outputing in raw hex. Signed-off-by: Stephen Hemminger Acked-by: Bernard Iremonger --- 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); } }