diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2013-05-31 11:05:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-04 15:56:14 -0400 |
commit | 17ef66afc0bdbbdc5c526db5e24bdd2dc3df1205 (patch) | |
tree | 065a227c3cb4987c4cdc2442a41892ceb60ad509 /net/ipv6/udp.c | |
parent | 75698b17ac3b681f4345a9be48b147381d17266d (diff) |
net: ipv6: Unify {raw,udp}6_sock_seq_show.
udp6_sock_seq_show and raw6_sock_seq_show are identical, except
the UDP version displays ports and the raw version displays the
protocol. Refactor most of the code in these two functions into
a new common ip6_dgram_sock_seq_show function, in preparation
for using it to display ICMPv6 sockets as well.
Also reduce the indentation in parts of include/net/transp_v6.h
to improve readability.
Compiles and displays reasonable results with CONFIG_IPV6={n,m,y}
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 49 |
1 files changed, 9 insertions, 40 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 42923b14dfa6..b5808539cd5c 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1359,48 +1359,17 @@ static const struct inet6_protocol udpv6_protocol = { | |||
1359 | 1359 | ||
1360 | /* ------------------------------------------------------------------------ */ | 1360 | /* ------------------------------------------------------------------------ */ |
1361 | #ifdef CONFIG_PROC_FS | 1361 | #ifdef CONFIG_PROC_FS |
1362 | |||
1363 | static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket) | ||
1364 | { | ||
1365 | struct inet_sock *inet = inet_sk(sp); | ||
1366 | struct ipv6_pinfo *np = inet6_sk(sp); | ||
1367 | const struct in6_addr *dest, *src; | ||
1368 | __u16 destp, srcp; | ||
1369 | |||
1370 | dest = &np->daddr; | ||
1371 | src = &np->rcv_saddr; | ||
1372 | destp = ntohs(inet->inet_dport); | ||
1373 | srcp = ntohs(inet->inet_sport); | ||
1374 | seq_printf(seq, | ||
1375 | "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | ||
1376 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %d\n", | ||
1377 | bucket, | ||
1378 | src->s6_addr32[0], src->s6_addr32[1], | ||
1379 | src->s6_addr32[2], src->s6_addr32[3], srcp, | ||
1380 | dest->s6_addr32[0], dest->s6_addr32[1], | ||
1381 | dest->s6_addr32[2], dest->s6_addr32[3], destp, | ||
1382 | sp->sk_state, | ||
1383 | sk_wmem_alloc_get(sp), | ||
1384 | sk_rmem_alloc_get(sp), | ||
1385 | 0, 0L, 0, | ||
1386 | from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)), | ||
1387 | 0, | ||
1388 | sock_i_ino(sp), | ||
1389 | atomic_read(&sp->sk_refcnt), sp, | ||
1390 | atomic_read(&sp->sk_drops)); | ||
1391 | } | ||
1392 | |||
1393 | int udp6_seq_show(struct seq_file *seq, void *v) | 1362 | int udp6_seq_show(struct seq_file *seq, void *v) |
1394 | { | 1363 | { |
1395 | if (v == SEQ_START_TOKEN) | 1364 | if (v == SEQ_START_TOKEN) { |
1396 | seq_printf(seq, | 1365 | seq_puts(seq, IPV6_SEQ_DGRAM_HEADER); |
1397 | " sl " | 1366 | } else { |
1398 | "local_address " | 1367 | int bucket = ((struct udp_iter_state *)seq->private)->bucket; |
1399 | "remote_address " | 1368 | struct inet_sock *inet = inet_sk(v); |
1400 | "st tx_queue rx_queue tr tm->when retrnsmt" | 1369 | __u16 srcp = ntohs(inet->inet_sport); |
1401 | " uid timeout inode ref pointer drops\n"); | 1370 | __u16 destp = ntohs(inet->inet_dport); |
1402 | else | 1371 | ip6_dgram_sock_seq_show(seq, v, srcp, destp, bucket); |
1403 | udp6_sock_seq_show(seq, v, ((struct udp_iter_state *)seq->private)->bucket); | 1372 | } |
1404 | return 0; | 1373 | return 0; |
1405 | } | 1374 | } |
1406 | 1375 | ||