diff mbox

Commit 8ef874bfc7296fa206eea2ad1e8a426f576bf6f6 has broken ss command

Message ID 1333534877.18626.566.camel@edumazet-glaptop
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Eric Dumazet April 4, 2012, 10:21 a.m. UTC
On Wed, 2012-04-04 at 19:00 +0900, Kusanagi Kouichi wrote:
> On 2012-04-04 11:07:43 +0200, Eric Dumazet wrote:
> > On Wed, 2012-04-04 at 18:03 +0900, Kusanagi Kouichi wrote:
> > > Since commit 8ef874bfc7296fa206eea2ad1e8a426f576bf6f6 ("sock_diag:
> > > Move the sock_ code to net/core/"), ss command from iproute package
> > > doesn't work if INET_DIAG is not enabled.
> > > 
> > > $ ss
> > > State       Recv-Q Send-Q                                             Local Address:Port                                                 Peer Address:Port
> > > TCPDIAG answers: Operation not supported
> > > --
> > 
> > Try to update your iproute2 package ?
> 
> iproute seems up to date.
> $ ss --version
> ss utility, iproute2-ss120319
> 
> I tried git master commit 4bb00cd2b7525ad7d6cf6bbea945ad6e546873f4.
> It still fails.

Please try this patch :



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

Kusanagi Kouichi April 4, 2012, 1:22 p.m. UTC | #1
On 2012-04-04 12:21:17 +0200, Eric Dumazet wrote:
> Please try this patch :
> 
> diff --git a/misc/ss.c b/misc/ss.c
> index 5414f75..8c00760 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -1534,8 +1534,10 @@ static int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
>  		.msg_iovlen = f->f ? 3 : 1,
>  	};
>  
> -	if (sendmsg(fd, &msg, 0) < 0)
> +	if (sendmsg(fd, &msg, 0) < 0) {
> +		close(fd);
>  		return -1;
> +	}
>  
>  	iov[0] = (struct iovec){
>  		.iov_base = buf,
> @@ -1589,6 +1591,10 @@ static int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
>  					fprintf(stderr, "ERROR truncated\n");
>  				} else {
>  					errno = -err->error;
> +					if (errno == EOPNOTSUPP) {
> +						close(fd);
> +						return -1;
> +					}
>  					perror("TCPDIAG answers");
>  				}
>  				close(fd);

This patch solved the problem. Thank you!
--
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 5414f75..8c00760 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1534,8 +1534,10 @@  static int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
 		.msg_iovlen = f->f ? 3 : 1,
 	};
 
-	if (sendmsg(fd, &msg, 0) < 0)
+	if (sendmsg(fd, &msg, 0) < 0) {
+		close(fd);
 		return -1;
+	}
 
 	iov[0] = (struct iovec){
 		.iov_base = buf,
@@ -1589,6 +1591,10 @@  static int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
 					fprintf(stderr, "ERROR truncated\n");
 				} else {
 					errno = -err->error;
+					if (errno == EOPNOTSUPP) {
+						close(fd);
+						return -1;
+					}
 					perror("TCPDIAG answers");
 				}
 				close(fd);