* [PATCH iproute2] ss: print value of IPV6_V6ONLY socket option if set
@ 2015-06-24 11:07 Phil Sutter
0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2015-06-24 11:07 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
If available and set, print 'v6only:1' for AF_INET6 sockets upon request
of extended information. For IPv6 sockets bound to in6addr_any, this is
the only way to determine if they will also accept IPv4 requests or not.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Depends on unapplied patch 'ss: Include -E option for socket destroy
events'
Kernel support patch: 204621551b2a0060a013b92f7add4d5c452fa7cb
---
include/linux/inet_diag.h | 3 ++-
misc/ss.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index e83340b..1db4116 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -112,9 +112,10 @@ enum {
INET_DIAG_SHUTDOWN,
INET_DIAG_DCTCPINFO,
INET_DIAG_PROTOCOL, /* response attribute only */
+ INET_DIAG_SKV6ONLY,
};
-#define INET_DIAG_MAX INET_DIAG_PROTOCOL
+#define INET_DIAG_MAX INET_DIAG_SKV6ONLY
/* INET_DIAG_MEM */
diff --git a/misc/ss.c b/misc/ss.c
index 759795c..62a638b 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2047,6 +2047,11 @@ static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f, int protocol)
if (show_details) {
sock_details_print(&s);
+ if (s.local.family == AF_INET6 && tb[INET_DIAG_SKV6ONLY]) {
+ unsigned char v6only;
+ v6only = *(__u8 *)RTA_DATA(tb[INET_DIAG_SKV6ONLY]);
+ printf(" v6only:%u", v6only);
+ }
if (tb[INET_DIAG_SHUTDOWN]) {
unsigned char mask;
mask = *(__u8 *)RTA_DATA(tb[INET_DIAG_SHUTDOWN]);
--
2.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] ss: print value of IPV6_V6ONLY socket option if set
[not found] <98d177c535aa4910b83df0b9856d80ab@HQ1WP-EXMB11.corp.brocade.com>
@ 2015-06-26 4:18 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2015-06-26 4:18 UTC (permalink / raw)
To: Phil Sutter; +Cc: netdev
On Wed, 24 Jun 2015 11:07:20 +0000
Phil Sutter <phil@nwl.cc> wrote:
> If available and set, print 'v6only:1' for AF_INET6 sockets upon request
> of extended information. For IPv6 sockets bound to in6addr_any, this is
> the only way to determine if they will also accept IPv4 requests or not.
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
> Depends on unapplied patch 'ss: Include -E option for socket destroy
> events'
>
> Kernel support patch: 204621551b2a0060a013b92f7add4d5c452fa7cb
Applied, currently staged on local net-next branch.
Will merge after 4.1 iproute2 release
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-26 4:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 11:07 [PATCH iproute2] ss: print value of IPV6_V6ONLY socket option if set Phil Sutter
[not found] <98d177c535aa4910b83df0b9856d80ab@HQ1WP-EXMB11.corp.brocade.com>
2015-06-26 4:18 ` Stephen Hemminger
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).