diff mbox

[BUG] "$ ss -a" incorrectly displays raw sockets as udp sockets

Message ID 1436455270.24939.32.camel@edumazet-glaptop2.roam.corp.google.com
State RFC, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Eric Dumazet July 9, 2015, 3:21 p.m. UTC
On Thu, 2015-07-09 at 17:14 +0200, Eric Dumazet wrote:

> 
> If I checkout iproute2 tree to db08bdb816d337102c5486744008db9c9faa43bf
> (before buggy commit) we indeed had this result :
> 
> # ./ss -an | grep 127.0.0.1
> raw    UNCONN     213486 0      127.0.0.1:6                     *:*                  

Maybe following patch would fix the issue.



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

Comments

Vadym Kochan July 9, 2015, 3:28 p.m. UTC | #1
On Thu, Jul 09, 2015 at 05:21:10PM +0200, Eric Dumazet wrote:
> On Thu, 2015-07-09 at 17:14 +0200, Eric Dumazet wrote:
> 
> > 
> > If I checkout iproute2 tree to db08bdb816d337102c5486744008db9c9faa43bf
> > (before buggy commit) we indeed had this result :
> > 
> > # ./ss -an | grep 127.0.0.1
> > raw    UNCONN     213486 0      127.0.0.1:6                     *:*                  
> 
> Maybe following patch would fix the issue.
> 
> diff --git a/misc/ss.c b/misc/ss.c
> index 03f92fa69270..9b7dad00290c 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -1552,6 +1552,8 @@ out:
>  static char *proto_name(int protocol)
>  {
>  	switch (protocol) {
> +	case 0:
> +		return "raw";
>  	case IPPROTO_UDP:
>  		return "udp";
>  	case IPPROTO_TCP:
> @@ -2416,7 +2418,7 @@ static int dgram_show_line(char *line, const struct filter *f, int family)
>  	if (n < 9)
>  		opt[0] = 0;
>  
> -	inet_stats_print(&s, IPPROTO_UDP);
> +	inet_stats_print(&s, 0);
>  
>  	if (show_details && opt[0])
>  		printf(" opt:\"%s\"", opt);
> 
> 

Yes, it fixes the issue too.
--
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
Nikolay Aleksandrov July 9, 2015, 3:30 p.m. UTC | #2
On 07/09/2015 05:28 PM, Vadim Kochan wrote:
> On Thu, Jul 09, 2015 at 05:21:10PM +0200, Eric Dumazet wrote:
>> On Thu, 2015-07-09 at 17:14 +0200, Eric Dumazet wrote:
>>
>>>
>>> If I checkout iproute2 tree to db08bdb816d337102c5486744008db9c9faa43bf
>>> (before buggy commit) we indeed had this result :
>>>
>>> # ./ss -an | grep 127.0.0.1
>>> raw    UNCONN     213486 0      127.0.0.1:6                     *:*                  
>>
>> Maybe following patch would fix the issue.
>>
>> diff --git a/misc/ss.c b/misc/ss.c
>> index 03f92fa69270..9b7dad00290c 100644
>> --- a/misc/ss.c
>> +++ b/misc/ss.c
>> @@ -1552,6 +1552,8 @@ out:
>>  static char *proto_name(int protocol)
>>  {
>>  	switch (protocol) {
>> +	case 0:
>> +		return "raw";
>>  	case IPPROTO_UDP:
>>  		return "udp";
>>  	case IPPROTO_TCP:
>> @@ -2416,7 +2418,7 @@ static int dgram_show_line(char *line, const struct filter *f, int family)
>>  	if (n < 9)
>>  		opt[0] = 0;
>>  
>> -	inet_stats_print(&s, IPPROTO_UDP);
>> +	inet_stats_print(&s, 0);
>>  
>>  	if (show_details && opt[0])
>>  		printf(" opt:\"%s\"", opt);
>>
>>
> 
> Yes, it fixes the issue too.

Yeah, I think this is better than my solution because it's not really
IPPROTO_RAW protocol, so I'll drop my submission.

Thanks,
 Nik

--
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 03f92fa69270..9b7dad00290c 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1552,6 +1552,8 @@  out:
 static char *proto_name(int protocol)
 {
 	switch (protocol) {
+	case 0:
+		return "raw";
 	case IPPROTO_UDP:
 		return "udp";
 	case IPPROTO_TCP:
@@ -2416,7 +2418,7 @@  static int dgram_show_line(char *line, const struct filter *f, int family)
 	if (n < 9)
 		opt[0] = 0;
 
-	inet_stats_print(&s, IPPROTO_UDP);
+	inet_stats_print(&s, 0);
 
 	if (show_details && opt[0])
 		printf(" opt:\"%s\"", opt);