Subject: Re: [iproute PATCH 04/18] ss: Use sockstat->type in all socket types

From: Stephen Hemminger <[email-masked]>
Date: Thu, 1 Dec 2016 10:41:01 -0800

On Fri, 11 Nov 2016 14:10:00 +0100
Phil Sutter <[email-masked]> wrote:

> Unix sockets used that field already to hold info about the socket type.
> By replicating this approach in all other socket types, we can get rid
> of protocol parameter in inet_stats_print() and have sock_state_print()
> figure things out by itself.
> 
> Signed-off-by: Phil Sutter <[email-masked]>

Cleaning out the patch backlog...
This patch does not apply to current master branch, rejects are:

--- misc/ss.c
+++ misc/ss.c
@@ -1719,27 +1768,11 @@ void *parse_markmask(const char *markmask)
 	return res;
 }
 
-static char *proto_name(int protocol)
-{
-	switch (protocol) {
-	case 0:
-		return "raw";
-	case IPPROTO_UDP:
-		return "udp";
-	case IPPROTO_TCP:
-		return "tcp";
-	case IPPROTO_DCCP:
-		return "dccp";
-	}
-
-	return "???";
-}
-
-static void inet_stats_print(struct sockstat *s, int protocol)
+static void inet_stats_print(struct sockstat *s)
 {
 	char *buf = NULL;
 
-	sock_state_print(s, proto_name(protocol));
+	sock_state_print(s);
 
 	inet_addr_print(&s->local, s->lport, s->iface);
 	inet_addr_print(&s->remote, s->rport, 0);

Please fix and resubmit whole series.