All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Parkin <tparkin@katalix.com>
To: netdev@vger.kernel.org
Cc: jchapman@katalix.com, Tom Parkin <tparkin@katalix.com>
Subject: [PATCH 3/6] l2tp: check socket address type in l2tp_dfs_seq_tunnel_show
Date: Thu, 23 Jul 2020 12:29:52 +0100	[thread overview]
Message-ID: <20200723112955.19808-4-tparkin@katalix.com> (raw)
In-Reply-To: <20200723112955.19808-1-tparkin@katalix.com>

checkpatch warns about indentation and brace balancing around the
conditionally compiled code for AF_INET6 support in
l2tp_dfs_seq_tunnel_show.

By adding another check on the socket address type we can make the code
more readable while removing the checkpatch warning.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
---
 net/l2tp/l2tp_debugfs.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c
index 117a6697da72..72ba83aa0eaf 100644
--- a/net/l2tp/l2tp_debugfs.c
+++ b/net/l2tp/l2tp_debugfs.c
@@ -146,10 +146,12 @@ static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v)
 
 			seq_printf(m, " from %pI6c to %pI6c\n",
 				   &np->saddr, &tunnel->sock->sk_v6_daddr);
-		} else
+		}
 #endif
-		seq_printf(m, " from %pI4 to %pI4\n",
-			   &inet->inet_saddr, &inet->inet_daddr);
+		if (tunnel->sock->sk_family == AF_INET)
+			seq_printf(m, " from %pI4 to %pI4\n",
+				   &inet->inet_saddr, &inet->inet_daddr);
+
 		if (tunnel->encap == L2TP_ENCAPTYPE_UDP)
 			seq_printf(m, " source port %hu, dest port %hu\n",
 				   ntohs(inet->inet_sport), ntohs(inet->inet_dport));
-- 
2.17.1


  parent reply	other threads:[~2020-07-23 11:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 11:29 [PATCH net-next 0/6] l2tp: further checkpatch.pl cleanups Tom Parkin
2020-07-23 11:29 ` [PATCH 1/6] l2tp: cleanup comparisons to NULL Tom Parkin
2020-07-23 11:29 ` [PATCH 2/6] l2tp: cleanup unnecessary braces in if statements Tom Parkin
2020-07-23 11:29 ` Tom Parkin [this message]
2020-07-23 11:29 ` [PATCH 4/6] l2tp: cleanup netlink send of tunnel address information Tom Parkin
2020-07-23 11:29 ` [PATCH 5/6] l2tp: cleanup netlink tunnel create address handling Tom Parkin
2020-07-23 11:29 ` [PATCH 6/6] l2tp: cleanup kzalloc calls Tom Parkin
2020-07-23 18:00 ` [PATCH net-next 0/6] l2tp: further checkpatch.pl cleanups James Chapman
2020-07-23 18:54   ` David Miller

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=20200723112955.19808-4-tparkin@katalix.com \
    --to=tparkin@katalix.com \
    --cc=jchapman@katalix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.