diff mbox

[iproute2] ss: Filter inet dgram sockets with established state by default

Message ID 1420738342-3750-1-git-send-email-vadim4j@gmail.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Vadym Kochan Jan. 8, 2015, 5:32 p.m. UTC
From: Vadim Kochan <vadim4j@gmail.com>

As inet dgram sockets (udp, raw) can call connect(...)  - they
might be set in ESTABLISHED state. So keep the original behaviour of
'ss' which filtered them by ESTABLISHED state by default. So:

    $ ss -u

    or

    $ ss -w

Will show only ESTABLISHED UDP sockets by default.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stephen Hemminger Jan. 14, 2015, 1:31 a.m. UTC | #1
On Thu,  8 Jan 2015 19:32:22 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> From: Vadim Kochan <vadim4j@gmail.com>
> 
> As inet dgram sockets (udp, raw) can call connect(...)  - they
> might be set in ESTABLISHED state. So keep the original behaviour of
> 'ss' which filtered them by ESTABLISHED state by default. So:
> 
>     $ ss -u
> 
>     or
> 
>     $ ss -w
> 
> Will show only ESTABLISHED UDP sockets by default.
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> ---
>  misc/ss.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/misc/ss.c b/misc/ss.c
> index 08d210a..015d829 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
>  		.families = (1 << AF_INET) | (1 << AF_INET6),
>  	},
>  	[UDP_DB] = {
> -		.states   = (1 << SS_CLOSE),
> +		.states   = (1 << SS_ESTABLISHED),
>  		.families = (1 << AF_INET) | (1 << AF_INET6),
>  	},
>  	[RAW_DB] = {
> -		.states   = (1 << SS_CLOSE),
> +		.states   = (1 << SS_ESTABLISHED),
>  		.families = (1 << AF_INET) | (1 << AF_INET6),
>  	},
>  	[UNIX_DG_DB] = {

This is a change likely to break somebody using 'ss -u' now and the bound
sockets will disappear from the output.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vadym Kochan Jan. 14, 2015, 6:49 a.m. UTC | #2
On Tue, Jan 13, 2015 at 05:31:50PM -0800, Stephen Hemminger wrote:
> On Thu,  8 Jan 2015 19:32:22 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
> 
> > From: Vadim Kochan <vadim4j@gmail.com>
> > 
> > As inet dgram sockets (udp, raw) can call connect(...)  - they
> > might be set in ESTABLISHED state. So keep the original behaviour of
> > 'ss' which filtered them by ESTABLISHED state by default. So:
> > 
> >     $ ss -u
> > 
> >     or
> > 
> >     $ ss -w
> > 
> > Will show only ESTABLISHED UDP sockets by default.
> > 
> > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> > ---
> >  misc/ss.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/misc/ss.c b/misc/ss.c
> > index 08d210a..015d829 100644
> > --- a/misc/ss.c
> > +++ b/misc/ss.c
> > @@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
> >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> >  	},
> >  	[UDP_DB] = {
> > -		.states   = (1 << SS_CLOSE),
> > +		.states   = (1 << SS_ESTABLISHED),
> >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> >  	},
> >  	[RAW_DB] = {
> > -		.states   = (1 << SS_CLOSE),
> > +		.states   = (1 << SS_ESTABLISHED),
> >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> >  	},
> >  	[UNIX_DG_DB] = {
> 
> This is a change likely to break somebody using 'ss -u' now and the bound
> sockets will disappear from the output.
> 

But thats was as original behaviour before I added table-driven code
(about few commits ago), so thats a rather fix (sorry I did not noticed
about it) to keep the previous behaviour for dgram sockets - show
established states by default.

Regards,
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger Jan. 14, 2015, 10:41 p.m. UTC | #3
On Wed, 14 Jan 2015 08:49:44 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> On Tue, Jan 13, 2015 at 05:31:50PM -0800, Stephen Hemminger wrote:
> > On Thu,  8 Jan 2015 19:32:22 +0200
> > Vadim Kochan <vadim4j@gmail.com> wrote:
> > 
> > > From: Vadim Kochan <vadim4j@gmail.com>
> > > 
> > > As inet dgram sockets (udp, raw) can call connect(...)  - they
> > > might be set in ESTABLISHED state. So keep the original behaviour of
> > > 'ss' which filtered them by ESTABLISHED state by default. So:
> > > 
> > >     $ ss -u
> > > 
> > >     or
> > > 
> > >     $ ss -w
> > > 
> > > Will show only ESTABLISHED UDP sockets by default.
> > > 
> > > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> > > ---
> > >  misc/ss.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/misc/ss.c b/misc/ss.c
> > > index 08d210a..015d829 100644
> > > --- a/misc/ss.c
> > > +++ b/misc/ss.c
> > > @@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
> > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > >  	},
> > >  	[UDP_DB] = {
> > > -		.states   = (1 << SS_CLOSE),
> > > +		.states   = (1 << SS_ESTABLISHED),
> > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > >  	},
> > >  	[RAW_DB] = {
> > > -		.states   = (1 << SS_CLOSE),
> > > +		.states   = (1 << SS_ESTABLISHED),
> > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > >  	},
> > >  	[UNIX_DG_DB] = {
> > 
> > This is a change likely to break somebody using 'ss -u' now and the bound
> > sockets will disappear from the output.
> > 
> 
> But thats was as original behaviour before I added table-driven code
> (about few commits ago), so thats a rather fix (sorry I did not noticed
> about it) to keep the previous behaviour for dgram sockets - show
> established states by default.
> 
> Regards,

Ok, I will merge it and update the comments.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vadym Kochan Jan. 14, 2015, 10:43 p.m. UTC | #4
On Wed, Jan 14, 2015 at 02:41:20PM -0800, Stephen Hemminger wrote:
> On Wed, 14 Jan 2015 08:49:44 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
> 
> > On Tue, Jan 13, 2015 at 05:31:50PM -0800, Stephen Hemminger wrote:
> > > On Thu,  8 Jan 2015 19:32:22 +0200
> > > Vadim Kochan <vadim4j@gmail.com> wrote:
> > > 
> > > > From: Vadim Kochan <vadim4j@gmail.com>
> > > > 
> > > > As inet dgram sockets (udp, raw) can call connect(...)  - they
> > > > might be set in ESTABLISHED state. So keep the original behaviour of
> > > > 'ss' which filtered them by ESTABLISHED state by default. So:
> > > > 
> > > >     $ ss -u
> > > > 
> > > >     or
> > > > 
> > > >     $ ss -w
> > > > 
> > > > Will show only ESTABLISHED UDP sockets by default.
> > > > 
> > > > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> > > > ---
> > > >  misc/ss.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/misc/ss.c b/misc/ss.c
> > > > index 08d210a..015d829 100644
> > > > --- a/misc/ss.c
> > > > +++ b/misc/ss.c
> > > > @@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
> > > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > > >  	},
> > > >  	[UDP_DB] = {
> > > > -		.states   = (1 << SS_CLOSE),
> > > > +		.states   = (1 << SS_ESTABLISHED),
> > > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > > >  	},
> > > >  	[RAW_DB] = {
> > > > -		.states   = (1 << SS_CLOSE),
> > > > +		.states   = (1 << SS_ESTABLISHED),
> > > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > > >  	},
> > > >  	[UNIX_DG_DB] = {
> > > 
> > > This is a change likely to break somebody using 'ss -u' now and the bound
> > > sockets will disappear from the output.
> > > 
> > 
> > But thats was as original behaviour before I added table-driven code
> > (about few commits ago), so thats a rather fix (sorry I did not noticed
> > about it) to keep the previous behaviour for dgram sockets - show
> > established states by default.
> > 
> > Regards,
> 
> Ok, I will merge it and update the comments.
Even with this PATCH I am still confused what is preferred behaviour -
show established dgram sockets (as it was all the way) or closed + established by default.

What do you think ?

Thanks,
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger Jan. 15, 2015, 2:48 a.m. UTC | #5
On Thu, 15 Jan 2015 00:43:47 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> On Wed, Jan 14, 2015 at 02:41:20PM -0800, Stephen Hemminger wrote:
> > On Wed, 14 Jan 2015 08:49:44 +0200
> > Vadim Kochan <vadim4j@gmail.com> wrote:
> > 
> > > On Tue, Jan 13, 2015 at 05:31:50PM -0800, Stephen Hemminger wrote:
> > > > On Thu,  8 Jan 2015 19:32:22 +0200
> > > > Vadim Kochan <vadim4j@gmail.com> wrote:
> > > > 
> > > > > From: Vadim Kochan <vadim4j@gmail.com>
> > > > > 
> > > > > As inet dgram sockets (udp, raw) can call connect(...)  - they
> > > > > might be set in ESTABLISHED state. So keep the original behaviour of
> > > > > 'ss' which filtered them by ESTABLISHED state by default. So:
> > > > > 
> > > > >     $ ss -u
> > > > > 
> > > > >     or
> > > > > 
> > > > >     $ ss -w
> > > > > 
> > > > > Will show only ESTABLISHED UDP sockets by default.
> > > > > 
> > > > > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> > > > > ---
> > > > >  misc/ss.c | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/misc/ss.c b/misc/ss.c
> > > > > index 08d210a..015d829 100644
> > > > > --- a/misc/ss.c
> > > > > +++ b/misc/ss.c
> > > > > @@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
> > > > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > > > >  	},
> > > > >  	[UDP_DB] = {
> > > > > -		.states   = (1 << SS_CLOSE),
> > > > > +		.states   = (1 << SS_ESTABLISHED),
> > > > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > > > >  	},
> > > > >  	[RAW_DB] = {
> > > > > -		.states   = (1 << SS_CLOSE),
> > > > > +		.states   = (1 << SS_ESTABLISHED),
> > > > >  		.families = (1 << AF_INET) | (1 << AF_INET6),
> > > > >  	},
> > > > >  	[UNIX_DG_DB] = {
> > > > 
> > > > This is a change likely to break somebody using 'ss -u' now and the bound
> > > > sockets will disappear from the output.
> > > > 
> > > 
> > > But thats was as original behaviour before I added table-driven code
> > > (about few commits ago), so thats a rather fix (sorry I did not noticed
> > > about it) to keep the previous behaviour for dgram sockets - show
> > > established states by default.
> > > 
> > > Regards,
> > 
> > Ok, I will merge it and update the comments.
> Even with this PATCH I am still confused what is preferred behaviour -
> show established dgram sockets (as it was all the way) or closed + established by default.
> 
> What do you think ?
> 
> Thanks,

Make it work like earliest releases (like 3 months ago).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vadym Kochan Jan. 15, 2015, 4:49 a.m. UTC | #6
So it means showing by established state by default.

On Thu, Jan 15, 2015 at 4:48 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Thu, 15 Jan 2015 00:43:47 +0200
> Vadim Kochan <vadim4j@gmail.com> wrote:
>
>> On Wed, Jan 14, 2015 at 02:41:20PM -0800, Stephen Hemminger wrote:
>> > On Wed, 14 Jan 2015 08:49:44 +0200
>> > Vadim Kochan <vadim4j@gmail.com> wrote:
>> >
>> > > On Tue, Jan 13, 2015 at 05:31:50PM -0800, Stephen Hemminger wrote:
>> > > > On Thu,  8 Jan 2015 19:32:22 +0200
>> > > > Vadim Kochan <vadim4j@gmail.com> wrote:
>> > > >
>> > > > > From: Vadim Kochan <vadim4j@gmail.com>
>> > > > >
>> > > > > As inet dgram sockets (udp, raw) can call connect(...)  - they
>> > > > > might be set in ESTABLISHED state. So keep the original behaviour of
>> > > > > 'ss' which filtered them by ESTABLISHED state by default. So:
>> > > > >
>> > > > >     $ ss -u
>> > > > >
>> > > > >     or
>> > > > >
>> > > > >     $ ss -w
>> > > > >
>> > > > > Will show only ESTABLISHED UDP sockets by default.
>> > > > >
>> > > > > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
>> > > > > ---
>> > > > >  misc/ss.c | 4 ++--
>> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
>> > > > >
>> > > > > diff --git a/misc/ss.c b/misc/ss.c
>> > > > > index 08d210a..015d829 100644
>> > > > > --- a/misc/ss.c
>> > > > > +++ b/misc/ss.c
>> > > > > @@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
>> > > > >               .families = (1 << AF_INET) | (1 << AF_INET6),
>> > > > >       },
>> > > > >       [UDP_DB] = {
>> > > > > -             .states   = (1 << SS_CLOSE),
>> > > > > +             .states   = (1 << SS_ESTABLISHED),
>> > > > >               .families = (1 << AF_INET) | (1 << AF_INET6),
>> > > > >       },
>> > > > >       [RAW_DB] = {
>> > > > > -             .states   = (1 << SS_CLOSE),
>> > > > > +             .states   = (1 << SS_ESTABLISHED),
>> > > > >               .families = (1 << AF_INET) | (1 << AF_INET6),
>> > > > >       },
>> > > > >       [UNIX_DG_DB] = {
>> > > >
>> > > > This is a change likely to break somebody using 'ss -u' now and the bound
>> > > > sockets will disappear from the output.
>> > > >
>> > >
>> > > But thats was as original behaviour before I added table-driven code
>> > > (about few commits ago), so thats a rather fix (sorry I did not noticed
>> > > about it) to keep the previous behaviour for dgram sockets - show
>> > > established states by default.
>> > >
>> > > Regards,
>> >
>> > Ok, I will merge it and update the comments.
>> Even with this PATCH I am still confused what is preferred behaviour -
>> show established dgram sockets (as it was all the way) or closed + established by default.
>>
>> What do you think ?
>>
>> Thanks,
>
> Make it work like earliest releases (like 3 months ago).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/ss.c b/misc/ss.c
index 08d210a..015d829 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -170,11 +170,11 @@  static const struct filter default_dbs[MAX_DB] = {
 		.families = (1 << AF_INET) | (1 << AF_INET6),
 	},
 	[UDP_DB] = {
-		.states   = (1 << SS_CLOSE),
+		.states   = (1 << SS_ESTABLISHED),
 		.families = (1 << AF_INET) | (1 << AF_INET6),
 	},
 	[RAW_DB] = {
-		.states   = (1 << SS_CLOSE),
+		.states   = (1 << SS_ESTABLISHED),
 		.families = (1 << AF_INET) | (1 << AF_INET6),
 	},
 	[UNIX_DG_DB] = {