* [iproute2] regression in ss output
@ 2017-10-13 9:57 Humberto Alves
2017-10-16 10:33 ` Phil Sutter
2017-10-16 16:20 ` [iproute2] regression in ss output Stephen Hemminger
0 siblings, 2 replies; 12+ messages in thread
From: Humberto Alves @ 2017-10-13 9:57 UTC (permalink / raw)
To: netdev@vger.kernel.org
Hi! With the last iproute2 release, ss command output does not
differentiate between any-address IPv4 sockets from the IPv6 ones.
I don't know if this is an expected behaviour, but the old output looks
more useful. Below I pasted the difference between the old behaviour and
the new one.
I am happy to send a patch if you want. Thanks
iproute2-4.12
-------------
$ ss --version
ss utility, iproute2-ss170705
$ ss -ntl
State Recv-Q Send-Q Local Address:Port Peer
Address:Port
LISTEN 0 100 *:587 *:*
LISTEN 0 100 *:110 *:*
LISTEN 0 100 *:143 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:2225 *:*
LISTEN 0 10 127.0.0.1:5010 *:*
LISTEN 0 128 *:20 *:*
LISTEN 0 128 127.0.0.1:20150 *:*
LISTEN 0 128 *:61719 *:*
LISTEN 0 100 *:25 *:*
LISTEN 0 3 *:1723 *:*
LISTEN 0 128 *:17500 *:*
LISTEN 0 128 127.0.0.1:17600 *:*
LISTEN 0 128 *:8000 *:*
LISTEN 0 100 *:993 *:*
LISTEN 0 128 127.0.0.1:17603 *:*
LISTEN 0 100 *:995 *:*
LISTEN 0 100 :::587 :::*
LISTEN 0 100 :::110 :::*
LISTEN 0 100 :::143 :::*
LISTEN 0 128 :::22000 :::*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::2225 :::*
LISTEN 0 128 :::20 :::*
LISTEN 0 128 ::1:20150 :::*
LISTEN 0 100 :::25 :::*
LISTEN 0 128 :::17500 :::*
LISTEN 0 128 :::8384 :::*
LISTEN 0 100 :::993 :::*
LISTEN 0 100 :::995 :::*
iproute2-4.13
-------------
$ ss --version
ss utility, iproute2-ss170905
$ ss -ntl
State Recv-Q Send-Q Local Address:Port Peer
Address:Port
LISTEN 0 100 *:587 *:*
LISTEN 0 100 *:110 *:*
LISTEN 0 100 *:143 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:2225 *:*
LISTEN 0 10 127.0.0.1:5010 *:*
LISTEN 0 128 *:20 *:*
LISTEN 0 128 127.0.0.1:20150 *:*
LISTEN 0 128 *:61719 *:*
LISTEN 0 100 *:25 *:*
LISTEN 0 3 *:1723 *:*
LISTEN 0 128 *:17500 *:*
LISTEN 0 128 127.0.0.1:17600 *:*
LISTEN 0 128 *:8000 *:*
LISTEN 0 100 *:993 *:*
LISTEN 0 128 127.0.0.1:17603 *:*
LISTEN 0 100 *:995 *:*
LISTEN 0 100 *:587 *:*
LISTEN 0 100 *:110 *:*
LISTEN 0 100 *:143 *:*
LISTEN 0 128 *:22000 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:2225 *:*
LISTEN 0 128 *:20 *:*
LISTEN 0 128 [::1]:20150 *:*
LISTEN 0 100 *:25 *:*
LISTEN 0 128 *:17500 *:*
LISTEN 0 128 *:8384 *:*
LISTEN 0 100 *:993 *:*
LISTEN 0 100 *:995 *:*
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-13 9:57 [iproute2] regression in ss output Humberto Alves
@ 2017-10-16 10:33 ` Phil Sutter
2017-10-16 20:44 ` Humberto Alves
2017-10-16 16:20 ` [iproute2] regression in ss output Stephen Hemminger
1 sibling, 1 reply; 12+ messages in thread
From: Phil Sutter @ 2017-10-16 10:33 UTC (permalink / raw)
To: Humberto Alves; +Cc: netdev@vger.kernel.org, Stephen Hemminger
Hi,
On Fri, Oct 13, 2017 at 09:57:37AM +0000, Humberto Alves wrote:
> Hi! With the last iproute2 release, ss command output does not
> differentiate between any-address IPv4 sockets from the IPv6 ones.
> I don't know if this is an expected behaviour, but the old output looks
> more useful. Below I pasted the difference between the old behaviour and
> the new one.
Although the change is certainly intentional (it was introduced by
Stephen Hemminger as a side effect of aba9c23a6e1cb ("ss: enclose IPv6
address in brackets"), I second reverting to the old display of
in6addr_any as '::'.
> I am happy to send a patch if you want. Thanks
It should be enough to just getting rid of the
| if (!memcmp(a->data, &in6addr_any, sizeof(in6addr_any))) {
case in inet_addr_print(). The else-case which calls format_host()
should deal with in6addr_any just fine. This way the address also gets
enclosed in brackets which helps separating it from the ':port' part.
Cheers, Phil
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-13 9:57 [iproute2] regression in ss output Humberto Alves
2017-10-16 10:33 ` Phil Sutter
@ 2017-10-16 16:20 ` Stephen Hemminger
2017-10-16 20:34 ` Humberto Alves
1 sibling, 1 reply; 12+ messages in thread
From: Stephen Hemminger @ 2017-10-16 16:20 UTC (permalink / raw)
To: Humberto Alves; +Cc: netdev@vger.kernel.org
On Fri, 13 Oct 2017 09:57:37 +0000
Humberto Alves <hjalves@live.com> wrote:
> Hi! With the last iproute2 release, ss command output does not
> differentiate between any-address IPv4 sockets from the IPv6 ones.
> I don't know if this is an expected behaviour, but the old output looks
> more useful. Below I pasted the difference between the old behaviour and
> the new one.
> I am happy to send a patch if you want. Thanks
>
>
> iproute2-4.12
> -------------
>
> $ ss --version
> ss utility, iproute2-ss170705
>
> $ ss -ntl
> State Recv-Q Send-Q Local Address:Port Peer
> Address:Port
> LISTEN 0 100 *:587 *:*
>
> LISTEN 0 100 *:110 *:*
>
> LISTEN 0 100 *:143 *:*
>
> LISTEN 0 128 *:80 *:*
>
> LISTEN 0 128 *:2225 *:*
>
> LISTEN 0 10 127.0.0.1:5010 *:*
>
> LISTEN 0 128 *:20 *:*
>
> LISTEN 0 128 127.0.0.1:20150 *:*
>
> LISTEN 0 128 *:61719 *:*
>
> LISTEN 0 100 *:25 *:*
>
> LISTEN 0 3 *:1723 *:*
>
> LISTEN 0 128 *:17500 *:*
>
> LISTEN 0 128 127.0.0.1:17600 *:*
>
> LISTEN 0 128 *:8000 *:*
>
> LISTEN 0 100 *:993 *:*
>
> LISTEN 0 128 127.0.0.1:17603 *:*
>
> LISTEN 0 100 *:995 *:*
>
> LISTEN 0 100 :::587 :::*
>
> LISTEN 0 100 :::110 :::*
>
> LISTEN 0 100 :::143 :::*
>
> LISTEN 0 128 :::22000 :::*
>
> LISTEN 0 128 :::80 :::*
>
> LISTEN 0 128 :::2225 :::*
>
> LISTEN 0 128 :::20 :::*
>
> LISTEN 0 128 ::1:20150 :::*
>
> LISTEN 0 100 :::25 :::*
>
> LISTEN 0 128 :::17500 :::*
>
> LISTEN 0 128 :::8384 :::*
>
> LISTEN 0 100 :::993 :::*
>
> LISTEN 0 100 :::995 :::*
>
> iproute2-4.13
> -------------
>
> $ ss --version
> ss utility, iproute2-ss170905
>
> $ ss -ntl
> State Recv-Q Send-Q Local Address:Port Peer
> Address:Port
> LISTEN 0 100 *:587 *:*
>
> LISTEN 0 100 *:110 *:*
>
> LISTEN 0 100 *:143 *:*
>
> LISTEN 0 128 *:80 *:*
>
> LISTEN 0 128 *:2225 *:*
>
> LISTEN 0 10 127.0.0.1:5010 *:*
>
> LISTEN 0 128 *:20 *:*
>
> LISTEN 0 128 127.0.0.1:20150 *:*
>
> LISTEN 0 128 *:61719 *:*
>
> LISTEN 0 100 *:25 *:*
>
> LISTEN 0 3 *:1723 *:*
>
> LISTEN 0 128 *:17500 *:*
>
> LISTEN 0 128 127.0.0.1:17600 *:*
>
> LISTEN 0 128 *:8000 *:*
>
> LISTEN 0 100 *:993 *:*
>
> LISTEN 0 128 127.0.0.1:17603 *:*
>
> LISTEN 0 100 *:995 *:*
>
> LISTEN 0 100 *:587 *:*
>
> LISTEN 0 100 *:110 *:*
>
> LISTEN 0 100 *:143 *:*
>
> LISTEN 0 128 *:22000 *:*
>
> LISTEN 0 128 *:80 *:*
>
> LISTEN 0 128 *:2225 *:*
>
> LISTEN 0 128 *:20 *:*
>
> LISTEN 0 128 [::1]:20150 *:*
>
> LISTEN 0 100 *:25 *:*
>
> LISTEN 0 128 *:17500 *:*
>
> LISTEN 0 128 *:8384 *:*
>
> LISTEN 0 100 *:993 *:*
>
> LISTEN 0 100 *:995 *:*
All changes are not regressions.
Yes it was intentional because the outputing [::]:20 looked ugly and using * makes IPv4 and IPv6
look the same.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-16 16:20 ` [iproute2] regression in ss output Stephen Hemminger
@ 2017-10-16 20:34 ` Humberto Alves
0 siblings, 0 replies; 12+ messages in thread
From: Humberto Alves @ 2017-10-16 20:34 UTC (permalink / raw)
To: Stephen Hemminger, netdev@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 5750 bytes --]
IMHO that's not ugly.
How is that a feature? Differentiating IPv4 from IPv6 sockets is a
feature to me!
If you want to use '*' in IPv4 and IPv6, add another column please.
Thank you
On 10/16/2017 05:20 PM, Stephen Hemminger wrote:
> On Fri, 13 Oct 2017 09:57:37 +0000
> Humberto Alves <hjalves@live.com> wrote:
>
>> Hi! With the last iproute2 release, ss command output does not
>> differentiate between any-address IPv4 sockets from the IPv6 ones.
>> I don't know if this is an expected behaviour, but the old output looks
>> more useful. Below I pasted the difference between the old behaviour and
>> the new one.
>> I am happy to send a patch if you want. Thanks
>>
>>
>> iproute2-4.12
>> -------------
>>
>> $ ss --version
>> ss utility, iproute2-ss170705
>>
>> $ ss -ntl
>> State Recv-Q Send-Q Local Address:Port Peer
>> Address:Port
>> LISTEN 0 100 *:587 *:*
>>
>> LISTEN 0 100 *:110 *:*
>>
>> LISTEN 0 100 *:143 *:*
>>
>> LISTEN 0 128 *:80 *:*
>>
>> LISTEN 0 128 *:2225 *:*
>>
>> LISTEN 0 10 127.0.0.1:5010 *:*
>>
>> LISTEN 0 128 *:20 *:*
>>
>> LISTEN 0 128 127.0.0.1:20150 *:*
>>
>> LISTEN 0 128 *:61719 *:*
>>
>> LISTEN 0 100 *:25 *:*
>>
>> LISTEN 0 3 *:1723 *:*
>>
>> LISTEN 0 128 *:17500 *:*
>>
>> LISTEN 0 128 127.0.0.1:17600 *:*
>>
>> LISTEN 0 128 *:8000 *:*
>>
>> LISTEN 0 100 *:993 *:*
>>
>> LISTEN 0 128 127.0.0.1:17603 *:*
>>
>> LISTEN 0 100 *:995 *:*
>>
>> LISTEN 0 100 :::587 :::*
>>
>> LISTEN 0 100 :::110 :::*
>>
>> LISTEN 0 100 :::143 :::*
>>
>> LISTEN 0 128 :::22000 :::*
>>
>> LISTEN 0 128 :::80 :::*
>>
>> LISTEN 0 128 :::2225 :::*
>>
>> LISTEN 0 128 :::20 :::*
>>
>> LISTEN 0 128 ::1:20150 :::*
>>
>> LISTEN 0 100 :::25 :::*
>>
>> LISTEN 0 128 :::17500 :::*
>>
>> LISTEN 0 128 :::8384 :::*
>>
>> LISTEN 0 100 :::993 :::*
>>
>> LISTEN 0 100 :::995 :::*
>>
>> iproute2-4.13
>> -------------
>>
>> $ ss --version
>> ss utility, iproute2-ss170905
>>
>> $ ss -ntl
>> State Recv-Q Send-Q Local Address:Port Peer
>> Address:Port
>> LISTEN 0 100 *:587 *:*
>>
>> LISTEN 0 100 *:110 *:*
>>
>> LISTEN 0 100 *:143 *:*
>>
>> LISTEN 0 128 *:80 *:*
>>
>> LISTEN 0 128 *:2225 *:*
>>
>> LISTEN 0 10 127.0.0.1:5010 *:*
>>
>> LISTEN 0 128 *:20 *:*
>>
>> LISTEN 0 128 127.0.0.1:20150 *:*
>>
>> LISTEN 0 128 *:61719 *:*
>>
>> LISTEN 0 100 *:25 *:*
>>
>> LISTEN 0 3 *:1723 *:*
>>
>> LISTEN 0 128 *:17500 *:*
>>
>> LISTEN 0 128 127.0.0.1:17600 *:*
>>
>> LISTEN 0 128 *:8000 *:*
>>
>> LISTEN 0 100 *:993 *:*
>>
>> LISTEN 0 128 127.0.0.1:17603 *:*
>>
>> LISTEN 0 100 *:995 *:*
>>
>> LISTEN 0 100 *:587 *:*
>>
>> LISTEN 0 100 *:110 *:*
>>
>> LISTEN 0 100 *:143 *:*
>>
>> LISTEN 0 128 *:22000 *:*
>>
>> LISTEN 0 128 *:80 *:*
>>
>> LISTEN 0 128 *:2225 *:*
>>
>> LISTEN 0 128 *:20 *:*
>>
>> LISTEN 0 128 [::1]:20150 *:*
>>
>> LISTEN 0 100 *:25 *:*
>>
>> LISTEN 0 128 *:17500 *:*
>>
>> LISTEN 0 128 *:8384 *:*
>>
>> LISTEN 0 100 *:993 *:*
>>
>> LISTEN 0 100 *:995 *:*
>
> All changes are not regressions.
>
> Yes it was intentional because the outputing [::]:20 looked ugly and using * makes IPv4 and IPv6
> look the same.
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3984 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-16 10:33 ` Phil Sutter
@ 2017-10-16 20:44 ` Humberto Alves
2017-10-16 21:28 ` Stephen Hemminger
0 siblings, 1 reply; 12+ messages in thread
From: Humberto Alves @ 2017-10-16 20:44 UTC (permalink / raw)
To: Phil Sutter, netdev@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]
Yes, just get rid of this 'if statement'.
in6addr_any should be represented as '::', not '*'. Otherwise it's
impossible to distinguish IPv4 listening addresses from IPv6. Thank you :)
On 10/16/2017 11:33 AM, Phil Sutter wrote:
> Hi,
>
> On Fri, Oct 13, 2017 at 09:57:37AM +0000, Humberto Alves wrote:
>> Hi! With the last iproute2 release, ss command output does not
>> differentiate between any-address IPv4 sockets from the IPv6 ones.
>> I don't know if this is an expected behaviour, but the old output looks
>> more useful. Below I pasted the difference between the old behaviour and
>> the new one.
>
> Although the change is certainly intentional (it was introduced by
> Stephen Hemminger as a side effect of aba9c23a6e1cb ("ss: enclose IPv6
> address in brackets"), I second reverting to the old display of
> in6addr_any as '::'.
>
>> I am happy to send a patch if you want. Thanks
>
> It should be enough to just getting rid of the
>
> | if (!memcmp(a->data, &in6addr_any, sizeof(in6addr_any))) {
>
> case in inet_addr_print(). The else-case which calls format_host()
> should deal with in6addr_any just fine. This way the address also gets
> enclosed in brackets which helps separating it from the ':port' part.
>
> Cheers, Phil
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3984 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-16 20:44 ` Humberto Alves
@ 2017-10-16 21:28 ` Stephen Hemminger
2017-10-17 2:00 ` Eric Dumazet
0 siblings, 1 reply; 12+ messages in thread
From: Stephen Hemminger @ 2017-10-16 21:28 UTC (permalink / raw)
To: Humberto Alves; +Cc: Phil Sutter, netdev@vger.kernel.org
On Mon, 16 Oct 2017 20:44:07 +0000
Humberto Alves <hjalves@live.com> wrote:
> Yes, just get rid of this 'if statement'.
> in6addr_any should be represented as '::', not '*'. Otherwise it's
> impossible to distinguish IPv4 listening addresses from IPv6. Thank you :)
But IPv6 accepts IPv4 as well.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-16 21:28 ` Stephen Hemminger
@ 2017-10-17 2:00 ` Eric Dumazet
[not found] ` <20171016194958.669625db@xeon-e3>
0 siblings, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2017-10-17 2:00 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Humberto Alves, Phil Sutter, netdev@vger.kernel.org
On Mon, 2017-10-16 at 14:28 -0700, Stephen Hemminger wrote:
> On Mon, 16 Oct 2017 20:44:07 +0000
> Humberto Alves <hjalves@live.com> wrote:
>
> > Yes, just get rid of this 'if statement'.
> > in6addr_any should be represented as '::', not '*'. Otherwise it's
> > impossible to distinguish IPv4 listening addresses from IPv6. Thank you :)
>
> But IPv6 accepts IPv4 as well.
Not always (IPV6_V6ONLY socket option)
I agree that this recent change in ss is problematic.
Please give us back a way to distinguish IPV6 and IPv4
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
[not found] ` <20171016194958.669625db@xeon-e3>
@ 2017-10-18 14:08 ` Humberto Alves
2017-10-18 14:17 ` Eric Dumazet
2017-10-18 17:11 ` Phil Sutter
2017-10-18 17:58 ` [iproute PATCH] ss: Distinguish between IPv4 and IPv6 wildcard sockets Phil Sutter
2 siblings, 1 reply; 12+ messages in thread
From: Humberto Alves @ 2017-10-18 14:08 UTC (permalink / raw)
To: Stephen Hemminger, Eric Dumazet; +Cc: Phil Sutter, netdev@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 855 bytes --]
Looks perfect to me. Thanks!
On 10/17/2017 03:49 AM, Stephen Hemminger wrote:
> On Mon, 16 Oct 2017 19:00:36 -0700
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>> On Mon, 2017-10-16 at 14:28 -0700, Stephen Hemminger wrote:
>>> On Mon, 16 Oct 2017 20:44:07 +0000
>>> Humberto Alves <hjalves@live.com> wrote:
>>>
>>>> Yes, just get rid of this 'if statement'.
>>>> in6addr_any should be represented as '::', not '*'. Otherwise it's
>>>> impossible to distinguish IPv4 listening addresses from IPv6. Thank you :)
>>>
>>> But IPv6 accepts IPv4 as well.
>>
>> Not always (IPV6_V6ONLY socket option)
>>
>> I agree that this recent change in ss is problematic.
>>
>> Please give us back a way to distinguish IPV6 and IPv4
>
> What about
> *:80 << both IPV6 and IPV4
> [::]:80 << IPV6_ONLY
> 0.0.0.0:80 << IPV4_ONLY
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3984 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
2017-10-18 14:08 ` Humberto Alves
@ 2017-10-18 14:17 ` Eric Dumazet
0 siblings, 0 replies; 12+ messages in thread
From: Eric Dumazet @ 2017-10-18 14:17 UTC (permalink / raw)
To: Humberto Alves; +Cc: Stephen Hemminger, Phil Sutter, netdev@vger.kernel.org
On Wed, 2017-10-18 at 14:08 +0000, Humberto Alves wrote:
> Looks perfect to me. Thanks!
>
> On 10/17/2017 03:49 AM, Stephen Hemminger wrote:
> >
> > What about
> > *:80 << both IPV6 and IPV4
> > [::]:80 << IPV6_ONLY
> > 0.0.0.0:80 << IPV4_ONLY
> >
>
Yes, I missed your email Stephen, this looks a nice idea. Thanks !
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [iproute2] regression in ss output
[not found] ` <20171016194958.669625db@xeon-e3>
2017-10-18 14:08 ` Humberto Alves
@ 2017-10-18 17:11 ` Phil Sutter
2017-10-18 17:58 ` [iproute PATCH] ss: Distinguish between IPv4 and IPv6 wildcard sockets Phil Sutter
2 siblings, 0 replies; 12+ messages in thread
From: Phil Sutter @ 2017-10-18 17:11 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Eric Dumazet, Humberto Alves, netdev
On Mon, Oct 16, 2017 at 07:49:58PM -0700, Stephen Hemminger wrote:
> On Mon, 16 Oct 2017 19:00:36 -0700
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> > On Mon, 2017-10-16 at 14:28 -0700, Stephen Hemminger wrote:
> > > On Mon, 16 Oct 2017 20:44:07 +0000
> > > Humberto Alves <hjalves@live.com> wrote:
> > >
> > > > Yes, just get rid of this 'if statement'.
> > > > in6addr_any should be represented as '::', not '*'. Otherwise it's
> > > > impossible to distinguish IPv4 listening addresses from IPv6. Thank you :)
> > >
> > > But IPv6 accepts IPv4 as well.
> >
> > Not always (IPV6_V6ONLY socket option)
> >
> > I agree that this recent change in ss is problematic.
> >
> > Please give us back a way to distinguish IPV6 and IPv4
>
> What about
> *:80 << both IPV6 and IPV4
> [::]:80 << IPV6_ONLY
> 0.0.0.0:80 << IPV4_ONLY
Assuming that this will be distinguished based on INET_DIAG_SKV6ONLY
attribute, tc will then use the asterisk for v6only sockets on older
kernels not supporting the feature.
Fine with me, just a heads-up!
Cheers, Phil
^ permalink raw reply [flat|nested] 12+ messages in thread
* [iproute PATCH] ss: Distinguish between IPv4 and IPv6 wildcard sockets
[not found] ` <20171016194958.669625db@xeon-e3>
2017-10-18 14:08 ` Humberto Alves
2017-10-18 17:11 ` Phil Sutter
@ 2017-10-18 17:58 ` Phil Sutter
2017-10-23 12:41 ` Stephen Hemminger
2 siblings, 1 reply; 12+ messages in thread
From: Phil Sutter @ 2017-10-18 17:58 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, Humberto Alves, Eric Dumazet
Commit aba9c23a6e1cb ("ss: enclose IPv6 address in brackets") unified
display of wildcard sockets in IPv4 and IPv6 to print the unspecified
address as '*'. Users then complained that they can't distinguish
between address families anymore, so change this again to what Stephen
Hemminger suggested:
| *:80 << both IPV6 and IPV4
| [::]:80 << IPV6_ONLY
| 0.0.0.0:80 << IPV4_ONLY
Note that on older kernels which don't support INET_DIAG_SKV6ONLY
attribute, pure IPv6 sockets will still show as '*'.
Cc: Humberto Alves <hjalves@live.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 09bff8a7e2d28..e37aba6022eb4 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1041,7 +1041,8 @@ do_numeric:
return buf;
}
-static void inet_addr_print(const inet_prefix *a, int port, unsigned int ifindex)
+static void inet_addr_print(const inet_prefix *a, int port,
+ unsigned int ifindex, bool v6only)
{
char buf[1024];
const char *ap = buf;
@@ -1049,14 +1050,10 @@ static void inet_addr_print(const inet_prefix *a, int port, unsigned int ifindex
const char *ifname = NULL;
if (a->family == AF_INET) {
- if (a->data[0] == 0) {
- buf[0] = '*';
- buf[1] = 0;
- } else {
- ap = format_host(AF_INET, 4, a->data);
- }
+ ap = format_host(AF_INET, 4, a->data);
} else {
- if (!memcmp(a->data, &in6addr_any, sizeof(in6addr_any))) {
+ if (!v6only &&
+ !memcmp(a->data, &in6addr_any, sizeof(in6addr_any))) {
buf[0] = '*';
buf[1] = 0;
} else {
@@ -1728,12 +1725,12 @@ static void proc_ctx_print(struct sockstat *s)
}
}
-static void inet_stats_print(struct sockstat *s)
+static void inet_stats_print(struct sockstat *s, bool v6only)
{
sock_state_print(s);
- inet_addr_print(&s->local, s->lport, s->iface);
- inet_addr_print(&s->remote, s->rport, 0);
+ inet_addr_print(&s->local, s->lport, s->iface, v6only);
+ inet_addr_print(&s->remote, s->rport, 0, v6only);
proc_ctx_print(s);
}
@@ -2065,7 +2062,7 @@ static int tcp_show_line(char *line, const struct filter *f, int family)
s.rto = s.rto != 3 * hz ? s.rto / hz : 0;
s.ss.type = IPPROTO_TCP;
- inet_stats_print(&s.ss);
+ inet_stats_print(&s.ss, false);
if (show_options)
tcp_timer_print(&s);
@@ -2411,6 +2408,7 @@ static int inet_show_sock(struct nlmsghdr *nlh,
{
struct rtattr *tb[INET_DIAG_MAX+1];
struct inet_diag_msg *r = NLMSG_DATA(nlh);
+ unsigned char v6only = 0;
parse_rtattr(tb, INET_DIAG_MAX, (struct rtattr *)(r+1),
nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
@@ -2418,7 +2416,10 @@ static int inet_show_sock(struct nlmsghdr *nlh,
if (tb[INET_DIAG_PROTOCOL])
s->type = rta_getattr_u8(tb[INET_DIAG_PROTOCOL]);
- inet_stats_print(s);
+ if (s->local.family == AF_INET6 && tb[INET_DIAG_SKV6ONLY])
+ v6only = rta_getattr_u8(tb[INET_DIAG_SKV6ONLY]);
+
+ inet_stats_print(s, v6only);
if (show_options) {
struct tcpstat t = {};
@@ -2434,12 +2435,9 @@ static int inet_show_sock(struct nlmsghdr *nlh,
if (show_details) {
sock_details_print(s);
- if (s->local.family == AF_INET6 && tb[INET_DIAG_SKV6ONLY]) {
- unsigned char v6only;
-
- v6only = rta_getattr_u8(tb[INET_DIAG_SKV6ONLY]);
+ if (s->local.family == AF_INET6 && tb[INET_DIAG_SKV6ONLY])
printf(" v6only:%u", v6only);
- }
+
if (tb[INET_DIAG_SHUTDOWN]) {
unsigned char mask;
@@ -2910,7 +2908,7 @@ static int dgram_show_line(char *line, const struct filter *f, int family)
opt[0] = 0;
s.type = dg_proto == UDP_PROTO ? IPPROTO_UDP : 0;
- inet_stats_print(&s);
+ inet_stats_print(&s, false);
if (show_details && opt[0])
printf(" opt:\"%s\"", opt);
--
2.13.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [iproute PATCH] ss: Distinguish between IPv4 and IPv6 wildcard sockets
2017-10-18 17:58 ` [iproute PATCH] ss: Distinguish between IPv4 and IPv6 wildcard sockets Phil Sutter
@ 2017-10-23 12:41 ` Stephen Hemminger
0 siblings, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2017-10-23 12:41 UTC (permalink / raw)
To: Phil Sutter; +Cc: netdev, Humberto Alves, Eric Dumazet
On Wed, 18 Oct 2017 19:58:13 +0200
Phil Sutter <phil@nwl.cc> wrote:
> Commit aba9c23a6e1cb ("ss: enclose IPv6 address in brackets") unified
> display of wildcard sockets in IPv4 and IPv6 to print the unspecified
> address as '*'. Users then complained that they can't distinguish
> between address families anymore, so change this again to what Stephen
> Hemminger suggested:
>
> | *:80 << both IPV6 and IPV4
> | [::]:80 << IPV6_ONLY
> | 0.0.0.0:80 << IPV4_ONLY
>
> Note that on older kernels which don't support INET_DIAG_SKV6ONLY
> attribute, pure IPv6 sockets will still show as '*'.
>
> Cc: Humberto Alves <hjalves@live.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Applied both.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-10-23 12:41 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 9:57 [iproute2] regression in ss output Humberto Alves
2017-10-16 10:33 ` Phil Sutter
2017-10-16 20:44 ` Humberto Alves
2017-10-16 21:28 ` Stephen Hemminger
2017-10-17 2:00 ` Eric Dumazet
[not found] ` <20171016194958.669625db@xeon-e3>
2017-10-18 14:08 ` Humberto Alves
2017-10-18 14:17 ` Eric Dumazet
2017-10-18 17:11 ` Phil Sutter
2017-10-18 17:58 ` [iproute PATCH] ss: Distinguish between IPv4 and IPv6 wildcard sockets Phil Sutter
2017-10-23 12:41 ` Stephen Hemminger
2017-10-16 16:20 ` [iproute2] regression in ss output Stephen Hemminger
2017-10-16 20:34 ` Humberto Alves
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).