From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by dpdk.org (Postfix) with ESMTP id 430D22C6D for ; Mon, 18 Jun 2018 23:36:04 +0200 (CEST) Received: by mail-pf0-f182.google.com with SMTP id h12-v6so8814237pfk.11 for ; Mon, 18 Jun 2018 14:36:04 -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=hXVLGhNXkLh9gKlTFB/wMPtEhRAlYxP4FIdty6zp6Qk=; b=UFOncGlil+Z2YW5L4yH7bZdzLVksYWYZN5sEqCRUvuhIxAl00U2izVeEcqvlIba3AV 7jmysZ/YRFH8KZ6mdCD2DtFTzx8c7D0gAM0h9l2eOoN1hAHF5BG9jtgdc2hQ5jjoVOzZ l6N4TjuQZGPhCYNq7b5UnlYzeXEndGsI6/JL7ugKJAqzBL0njiV4jBjXnEqvwYmAa1i+ nhVqvLAEI6UlvKrbNFbCY6YMMlTz9iu92GszskJzfmpK/9BUI1AJ7rnFirBo9YeZmQ/+ RRlU7TyR0FNnsuEaLFDnSbEHPHpI6Dt/pYMjYXf0cG7mykn268tdtJvVOoj1T47Sb/u2 Zbog== 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=hXVLGhNXkLh9gKlTFB/wMPtEhRAlYxP4FIdty6zp6Qk=; b=mSY6gPQv82wpL5mGpF8MzHSGOX4iIoX8ac46K8FlXaBNdI7Sr1cSSKE80q5bEIXnw+ pGra/HPyYSe26T/MOwfe9IBwmCqNUSmiAPzLOOXDIHRFf76Wzc2axwYqZX6ZyWRHTDiJ eZf03U4B12+MR6qhUPs3KFzNDWJO5KawGifFmN/eQPypAoJ7EcxSNYTvkZh4pnbGrDQB SD52kH3yMHj3/mBP+STejBk4D8UnUh8Uc4ONi3q+jz8CwZi+JCxeqfkf1f0qV1k1dsO/ wzBBHxHTu6FR8jMbFD8Cu5GYioM+3ur9l8Wj4qqVAGfZOuMoP+VZHeOuJpZm7kmr1XS8 P5nA== X-Gm-Message-State: APt69E3a52hukM85Jrk57heOhH7EJ28IRonTBVlq+KlWFTHLWdWxcV5c 2ud90uSPXrN5PtNROU4z/Q4amHapjGA= X-Google-Smtp-Source: ADUXVKLNbkyGoXMJ8xaoJH4z7xSHI/ZsruQBrNnIF9alDtP2c/qiKJDor8T54qRFtfkhc5pjv7GWRA== X-Received: by 2002:a62:dc1c:: with SMTP id t28-v6mr15167041pfg.137.1529357763174; Mon, 18 Jun 2018 14:36:03 -0700 (PDT) Received: from xeon-e3.lan (204-195-35-107.wavecable.com. [204.195.35.107]) by smtp.gmail.com with ESMTPSA id n70-v6sm34246969pfh.140.2018.06.18.14.36.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 14:36:02 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 18 Jun 2018 14:35:57 -0700 Message-Id: <20180618213557.15209-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618213557.15209-1-stephen@networkplumber.org> References: <20180618213557.15209-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v3 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: Mon, 18 Jun 2018 21:36:04 -0000 It is better user experience to print standard format for addresses rather than raw hex. Signed-off-by: Stephen Hemminger --- 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 3724f79c1924..3edc82aa2c62 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -261,6 +262,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; @@ -276,6 +278,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 & @@ -293,8 +296,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); } @@ -332,9 +336,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