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>
This commit is contained in:

committed by
David S. Miller

parent
75698b17ac
commit
17ef66afc0
@@ -1227,45 +1227,16 @@ struct proto rawv6_prot = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sp);
|
||||
const struct in6_addr *dest, *src;
|
||||
__u16 destp, srcp;
|
||||
|
||||
dest = &np->daddr;
|
||||
src = &np->rcv_saddr;
|
||||
destp = 0;
|
||||
srcp = inet_sk(sp)->inet_num;
|
||||
seq_printf(seq,
|
||||
"%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
|
||||
"%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %d\n",
|
||||
i,
|
||||
src->s6_addr32[0], src->s6_addr32[1],
|
||||
src->s6_addr32[2], src->s6_addr32[3], srcp,
|
||||
dest->s6_addr32[0], dest->s6_addr32[1],
|
||||
dest->s6_addr32[2], dest->s6_addr32[3], destp,
|
||||
sp->sk_state,
|
||||
sk_wmem_alloc_get(sp),
|
||||
sk_rmem_alloc_get(sp),
|
||||
0, 0L, 0,
|
||||
from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)),
|
||||
0,
|
||||
sock_i_ino(sp),
|
||||
atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops));
|
||||
}
|
||||
|
||||
static int raw6_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
if (v == SEQ_START_TOKEN)
|
||||
seq_printf(seq,
|
||||
" sl "
|
||||
"local_address "
|
||||
"remote_address "
|
||||
"st tx_queue rx_queue tr tm->when retrnsmt"
|
||||
" uid timeout inode ref pointer drops\n");
|
||||
else
|
||||
raw6_sock_seq_show(seq, v, raw_seq_private(seq)->bucket);
|
||||
if (v == SEQ_START_TOKEN) {
|
||||
seq_puts(seq, IPV6_SEQ_DGRAM_HEADER);
|
||||
} else {
|
||||
struct sock *sp = v;
|
||||
__u16 srcp = inet_sk(sp)->inet_num;
|
||||
ip6_dgram_sock_seq_show(seq, v, srcp, 0,
|
||||
raw_seq_private(seq)->bucket);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user