netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serhey Popovych <serhe.popovych@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH iproute2 v5 5/7] ip6/tunnel: Unify encap_limit printing
Date: Wed, 10 Jan 2018 17:53:13 +0200	[thread overview]
Message-ID: <1515599595-27958-6-git-send-email-serhe.popovych@gmail.com> (raw)
In-Reply-To: <1515599595-27958-1-git-send-email-serhe.popovych@gmail.com>

Use %u format specifier to print it in link_gre6.c and
make code more readable.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 ip/link_gre6.c   |   11 ++++-------
 ip/link_ip6tnl.c |   12 ++++++------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/ip/link_gre6.c b/ip/link_gre6.c
index 1205946..8014207 100644
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -433,18 +433,15 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 			print_int(PRINT_JSON, "ttl", NULL, ttl);
 	}
 
-	if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT)
+	if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT) {
 		print_bool(PRINT_ANY,
 			   "ip6_tnl_f_ign_encap_limit",
 			   "encaplimit none ",
 			   true);
-	else if (tb[IFLA_GRE_ENCAP_LIMIT]) {
-		int encap_limit = rta_getattr_u8(tb[IFLA_GRE_ENCAP_LIMIT]);
+	} else if (tb[IFLA_GRE_ENCAP_LIMIT]) {
+		__u8 val = rta_getattr_u8(tb[IFLA_GRE_ENCAP_LIMIT]);
 
-		print_int(PRINT_ANY,
-			  "encap_limit",
-			  "encaplimit %d ",
-			  encap_limit);
+		print_uint(PRINT_ANY, "encap_limit", "encaplimit %u ", val);
 	}
 
 	if (flags & IP6_TNL_F_USE_ORIG_FLOWLABEL) {
diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c
index 7000056..379eb33 100644
--- a/ip/link_ip6tnl.c
+++ b/ip/link_ip6tnl.c
@@ -387,16 +387,16 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
 			print_uint(PRINT_ANY, "link_index", "dev %u ", link);
 	}
 
-	if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT)
+	if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT) {
 		print_bool(PRINT_ANY,
 			   "ip6_tnl_f_ign_encap_limit",
 			   "encaplimit none ",
 			   true);
-	else if (tb[IFLA_IPTUN_ENCAP_LIMIT])
-		print_uint(PRINT_ANY,
-			   "encap_limit",
-			   "encaplimit %u ",
-			   rta_getattr_u8(tb[IFLA_IPTUN_ENCAP_LIMIT]));
+	} else if (tb[IFLA_IPTUN_ENCAP_LIMIT]) {
+		__u8 val = rta_getattr_u8(tb[IFLA_IPTUN_ENCAP_LIMIT]);
+
+		print_uint(PRINT_ANY, "encap_limit", "encaplimit %u ", val);
+	}
 
 	if (tb[IFLA_IPTUN_TTL])
 		print_uint(PRINT_ANY,
-- 
1.7.10.4

  parent reply	other threads:[~2018-01-10 15:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 15:53 [PATCH iproute2 v5 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output Serhey Popovych
2018-01-10 15:53 ` [PATCH iproute2 v5 1/7] ip6/tunnel: Fix tclass output Serhey Popovych
2018-01-10 15:53 ` [PATCH iproute2 v5 2/7] ip6tnl/tunnel: Do not print obscure flowinfo Serhey Popovych
2018-01-10 15:53 ` [PATCH iproute2 v5 3/7] ip6/tunnel: Unify tclass printing Serhey Popovych
2018-01-10 15:53 ` [PATCH iproute2 v5 4/7] ip6/tunnel: Unify flowlabel printing Serhey Popovych
2018-01-10 15:53 ` Serhey Popovych [this message]
2018-01-10 15:53 ` [PATCH iproute2 v5 6/7] gre6/tunnel: Output flowlabel after tclass Serhey Popovych
2018-01-10 15:53 ` [PATCH iproute2 v5 7/7] ip6tnl/tunnel: Output hoplimit before encapsulation limit Serhey Popovych
2018-01-10 16:08 ` [PATCH iproute2 v5 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output Stephen Hemminger

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=1515599595-27958-6-git-send-email-serhe.popovych@gmail.com \
    --to=serhe.popovych@gmail.com \
    --cc=netdev@vger.kernel.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).