Skip to contentSkip to conversation

ss: Filter inet dgram sockets with established state by default

PATCH In review Vadim Kochan 2 participants 7 messages Jan 8, 2015 – Jan 15, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ss: Filter inet dgram sockets with established state by default

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +2 -2
index 08d210a..015d829 100644
@@ -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] = {
Signature · 1 line
2.1.3
#1 lore raw
Quoted 27 lines · On Thu, 8 Jan 2015 19:32:22 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +0 -0
index 08d210a..015d829 100644
@@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
 		.families = (1 << AF_INET) | (1 << AF_INET6),
 	},
 	[UDP_DB] = {

misc/ss.c static const struct filter default_dbs[MAX_DB] = { · line 180

Quoted 10 lines
misc/ss.c +2 -2
-		.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.

#2 lore raw
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Thu, 8 Jan 2015 19:32:22 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +1 -1
index 08d210a..015d829 100644
@@ -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] = {
Quoted 9 lines

misc/ss.c static const struct filter default_dbs[MAX_DB] = { · line 180

Quoted 5 lines
misc/ss.c +1 -1
-		.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,

#3 lore raw
Quoted 46 lines · On Wed, 14 Jan 2015 08:49:44 +0200 Vadim Kochan <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Thu, 8 Jan 2015 19:32:22 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +1 -1
index 08d210a..015d829 100644
@@ -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] = {
Quoted 9 lines

misc/ss.c static const struct filter default_dbs[MAX_DB] = { · line 180

Quoted 5 lines
misc/ss.c +1 -1
-		.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.

Quoted 6 lines

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.

#4 lore raw
Quoted 49 lines · Stephen Hemminger
Quoted 46 lines · On Wed, 14 Jan 2015 08:49:44 +0200 Vadim Kochan <[email protected]> wrote:
Quoted 44 lines · Stephen Hemminger
Quoted 27 lines · On Thu, 8 Jan 2015 19:32:22 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +0 -0
index 08d210a..015d829 100644
@@ -170,11 +170,11 @@ static const struct filter default_dbs[MAX_DB] = {
 		.families = (1 << AF_INET) | (1 << AF_INET6),
 	},
 	[UDP_DB] = {

misc/ss.c static const struct filter default_dbs[MAX_DB] = { · line 180

Quoted 10 lines
misc/ss.c +2 -2
-		.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.

Quoted 8 lines
Quoted 6 lines

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,

#5 lore raw
Quoted 57 lines · On Thu, 15 Jan 2015 00:43:47 +0200 Vadim Kochan <[email protected]> wrote:
Quoted 56 lines · Stephen Hemminger
Quoted 52 lines · On Wed, 14 Jan 2015 08:49:44 +0200 Vadim Kochan <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Thu, 8 Jan 2015 19:32:22 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +1 -1
index 08d210a..015d829 100644
@@ -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] = {
Quoted 9 lines

misc/ss.c static const struct filter default_dbs[MAX_DB] = { · line 180

Quoted 5 lines
misc/ss.c +1 -1
-		.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,

Quoted 7 lines
Quoted 1 line

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).

#6 lore raw

So it means showing by established state by default.

Quoted 69 lines · Stephen Hemminger
Quoted 57 lines · On Thu, 15 Jan 2015 00:43:47 +0200 Vadim Kochan <[email protected]> wrote:
Quoted 56 lines · Stephen Hemminger
Quoted 52 lines · On Wed, 14 Jan 2015 08:49:44 +0200 Vadim Kochan <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Thu, 8 Jan 2015 19:32:22 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

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.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +1 -1
index 08d210a..015d829 100644
@@ -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] = {
Quoted 9 lines

misc/ss.c static const struct filter default_dbs[MAX_DB] = { · line 180

Quoted 5 lines
misc/ss.c +1 -1
-             .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,

Quoted 7 lines
Quoted 1 line

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).