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 42475A0096 for ; Wed, 10 Apr 2019 19:42:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 801C21B3AD; Wed, 10 Apr 2019 19:41:52 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id D009F1B2AF for ; Wed, 10 Apr 2019 19:41:39 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id k3so1979447pga.6 for ; Wed, 10 Apr 2019 10:41:39 -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=fvVS2PTMQybajiNqWI7kV2Jfe++BSoZj8m6EefsOUZQ=; b=REmmL1SYKJXH9ikuQBvXc/7nsGKeuk+mYNdfrtEV4z1IrC8na2/nxOvlRnQaa2JzFC xZlNLG/sirCZXdtLpSECefNolrwYOhrEMKUj9StKEMmw3PS0ndUNMDnXvIGI4zMevxVh 0DaXT+R+UKu8IrWsnKt2z2uNE4Vsn1d8di6ezAjQoGu2MiWDoWF6Zlhb/9p1mzkCMjXg grmkk2PfOTW8aunHheVBgpi7NgYEqpUQS05PUZcZRIgTP2Yo7TmSTuV/+CUmIDn9PpIs Xj2/ZHDZl24/H+NIRfbFdB7MZ1WUM5XQ6Dam8jfFa7swj7tysXGsEca+KXgtjEXkFnJo 0s3A== 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=fvVS2PTMQybajiNqWI7kV2Jfe++BSoZj8m6EefsOUZQ=; b=FgaeEJwkSxgWBeEk24wzej2OgS9VK/AlxVwCxIl9SAjkkFNVurDvS+qhNkAOwVwKMN jTmaz9eDdYuItIo00Wndae2QXZo5/gNAoXziEd0ck/KPr8Wc7+VPp33fU6slMMsx2xuG TtMIVy7/w/dxNsG1Fm9KdgSCDZdkvsb4VgpRga/rsOAg0LeV01p/IBDn47qf6dVK56UX vmd70NIAzUkXE8t0q2t9qzqwI9e14Z6SJljC4WAUuodMo4+QOn0Qbj6dJen+Aom3qZY0 WpJJzNFtinFGmbDEOoN6ijHOvGOL08URak6rEqbWo09BTXKVkXA6SBlCJHapB5OmMZPF DZMA== X-Gm-Message-State: APjAAAUxPuAhF326aNYN82g1AkP0CFAqw8U7sIxYMnYs7oVBnmCfG7Hn Jn6lYy6gky9aOE+3YywFqGAbEuLEKKV7YA== X-Google-Smtp-Source: APXvYqzVtoFOOvSoN2y/TMqaXIxHu4LL6zepSZ/kzcqEDN1rA3RUWFo1RM2P1D/cdoe/6EXhbgjzGw== X-Received: by 2002:a63:3d85:: with SMTP id k127mr42314481pga.152.1554918098557; Wed, 10 Apr 2019 10:41:38 -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 l69sm50229696pga.73.2019.04.10.10.41.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:41:37 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:41:32 -0700 Message-Id: <20190410174132.8349-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410174132.8349-1-stephen@networkplumber.org> References: <20190409182006.12944-1-stephen@networkplumber.org> <20190410174132.8349-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v6 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: <20190410174132.raJwqIYWAQqxEZX9RFGJrJM57jtIRxc9h0DEbXiPFv0@z> 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); } } -- 2.17.1