From: Isaac Boukris <hidden> Date: 2016-10-29 19:22:18
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed by ss the
same way the null prefix is currently being translated.
Signed-off-by: Isaac Boukris <redacted>
---
misc/ss.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Isaac Boukris <hidden> Date: 2016-10-29 19:22:26
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed out to
proc the same way the null prefix is currently being
translated.
This helps for tools such as netstat, lsof and the proc
based implementation in ss to show all the significant
bytes of the name (instead of getting cut at the first
null occurrence).
Signed-off-by: Isaac Boukris <redacted>
---
net/unix/af_unix.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2016-10-31 19:31:24
From: Isaac Boukris <redacted>
Date: Sat, 29 Oct 2016 22:20:20 +0300
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed out to
proc the same way the null prefix is currently being
translated.
This helps for tools such as netstat, lsof and the proc
based implementation in ss to show all the significant
bytes of the name (instead of getting cut at the first
null occurrence).
Signed-off-by: Isaac Boukris <redacted>
...
quoted hunk
@@ -2805,14 +2805,19 @@ static int unix_seq_show(struct seq_file *seq, void *v) i = 0; len = u->addr->len - sizeof(short);- if (!UNIX_ABSTRACT(s))+ if (!UNIX_ABSTRACT(s)) { len--;- else {+ for ( ; i < len; i++)+ seq_putc(seq,+ u->addr->name->sun_path[i]);+ } else { seq_putc(seq, '@'); i++;+ for ( ; i < len; i++)+ seq_putc(seq,+ u->addr->name->sun_path[i] ?:+ '@'); }- for ( ; i < len; i++)- seq_putc(seq, u->addr->name->sun_path[i]);
I think this patch is simpler if you just do the "@" translation
unconditionally, if it'll never trigger for the !UNIX_ABSTRACT case
that is perfectly fine.
From: Isaac Boukris <hidden> Date: 2016-11-01 00:57:06
Hi David, thanks for looking at it.
On Mon, Oct 31, 2016 at 9:31 PM, David Miller [off-list ref] wrote:
From: Isaac Boukris <redacted>
Date: Sat, 29 Oct 2016 22:20:20 +0300
quoted
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed out to
proc the same way the null prefix is currently being
translated.
This helps for tools such as netstat, lsof and the proc
based implementation in ss to show all the significant
bytes of the name (instead of getting cut at the first
null occurrence).
Signed-off-by: Isaac Boukris <redacted>
...
quoted
@@ -2805,14 +2805,19 @@ static int unix_seq_show(struct seq_file *seq, void *v) i = 0; len = u->addr->len - sizeof(short);- if (!UNIX_ABSTRACT(s))+ if (!UNIX_ABSTRACT(s)) { len--;- else {+ for ( ; i < len; i++)+ seq_putc(seq,+ u->addr->name->sun_path[i]);+ } else { seq_putc(seq, '@'); i++;+ for ( ; i < len; i++)+ seq_putc(seq,+ u->addr->name->sun_path[i] ?:+ '@'); }- for ( ; i < len; i++)- seq_putc(seq, u->addr->name->sun_path[i]);
I think this patch is simpler if you just do the "@" translation
unconditionally, if it'll never trigger for the !UNIX_ABSTRACT case
that is perfectly fine.
I've sent an updated patch.
Logically now, the 'else' block just above could be removed, but it
isn't obvious from the code that 'sun_path[0] == 0' so I left it as
is.
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2016-11-12 07:17:35
On Sat, 29 Oct 2016 22:20:19 +0300
Isaac Boukris [off-list ref] wrote:
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed by ss the
same way the null prefix is currently being translated.
Signed-off-by: Isaac Boukris <redacted>
From: Eric Dumazet <hidden> Date: 2016-12-02 19:01:00
On Sat, 2016-11-12 at 10:17 +0300, Stephen Hemminger wrote:
On Sat, 29 Oct 2016 22:20:19 +0300
Isaac Boukris [off-list ref] wrote:
quoted
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed by ss the
same way the null prefix is currently being translated.
Signed-off-by: Isaac Boukris <redacted>
Applied
Probably not a good idea to have :
for (int i = 0; i < len; i++)
if (name[i] == '\0')
name[i] = '@';
ss.c: In function 'unix_show_sock':
ss.c:3128:4: error: 'for' loop initial declarations are only allowed in C99 mode
ss.c:3128:4: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [ss.o] Error 1
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2016-12-02 23:19:14
On Fri, 02 Dec 2016 10:59:56 -0800
Eric Dumazet [off-list ref] wrote:
On Sat, 2016-11-12 at 10:17 +0300, Stephen Hemminger wrote:
quoted
On Sat, 29 Oct 2016 22:20:19 +0300
Isaac Boukris [off-list ref] wrote:
quoted
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed by ss the
same way the null prefix is currently being translated.
Signed-off-by: Isaac Boukris <redacted>
Applied
Probably not a good idea to have :
for (int i = 0; i < len; i++)
if (name[i] == '\0')
name[i] = '@';
ss.c: In function 'unix_show_sock':
ss.c:3128:4: error: 'for' loop initial declarations are only allowed in C99 mode
ss.c:3128:4: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [ss.o] Error 1
From: Eric Dumazet <hidden> Date: 2016-12-02 23:26:33
On Fri, 2016-12-02 at 15:18 -0800, Stephen Hemminger wrote:
name[i] = '@';
quoted
ss.c: In function 'unix_show_sock':
ss.c:3128:4: error: 'for' loop initial declarations are only allowed in C99 mode
ss.c:3128:4: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [ss.o] Error 1
From: Isaac Boukris <hidden> Date: 2016-12-05 05:38:28
On Sat, Dec 3, 2016 at 1:24 AM, Eric Dumazet [off-list ref] wrote:
On Fri, 2016-12-02 at 15:18 -0800, Stephen Hemminger wrote:
quoted
name[i] = '@';
quoted
ss.c: In function 'unix_show_sock':
ss.c:3128:4: error: 'for' loop initial declarations are only allowed in C99 mode
ss.c:3128:4: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [ss.o] Error 1
Thanks, fixed by patch from Simon
Right, thanks !
Thanks for notifying me. Sorry for the bug and thanks for the fix!