From patchwork Tue Jan 28 17:32:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Emelyanov X-Patchwork-Id: 314800 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8FC3C2C0079 for ; Wed, 29 Jan 2014 04:32:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755100AbaA1RcF (ORCPT ); Tue, 28 Jan 2014 12:32:05 -0500 Received: from relay.parallels.com ([195.214.232.42]:42805 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754599AbaA1RcE (ORCPT ); Tue, 28 Jan 2014 12:32:04 -0500 Received: from [10.30.3.11] (helo=mail.sw.ru) by relay.parallels.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.80.1) (envelope-from ) id 1W8CW1-0006KY-Dm; Tue, 28 Jan 2014 21:32:01 +0400 Received: from [192.168.0.103] (89.169.95.100) by mail.sw.ru (10.30.3.11) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 28 Jan 2014 21:32:00 +0400 Message-ID: <52E7E990.7050501@parallels.com> Date: Tue, 28 Jan 2014 21:32:00 +0400 From: Pavel Emelyanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Stephen Hemminger , Linux Netdev List CC: =?ISO-8859-1?Q?Fran=E7ois-Xavier_Le_Bail?= Subject: [PATCH] iproute: Properly handle protocol level diag module absence X-Originating-IP: [89.169.95.100] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When *_diag module is missing in the kernel, the ss tool should go ad read legacry /proc/* files. This is the case when all *_diag stuff is missing, but in case the inet_diag.ko is loaded, but (tcp|udp)_diag.ko is not, the ss tool doesn't notice this and produces empty output. The reason for that is -- error from the inet_diag module (which means, that e.g. the udp_diag is missing) is reported in the NLMSG_DONE message body. That said, we need to check the NLMSG_DONE's message return code and act respectively. Reported-by: François-Xavier Le Bail Signed-off-by: Pavel Emelyanov Tested-by: François-Xavier Le Bail --- -- 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 --git a/misc/ss.c b/misc/ss.c index 37dcc11..9c7d937 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -1746,8 +1746,15 @@ again: h->nlmsg_seq != 123456) goto skip_it; - if (h->nlmsg_type == NLMSG_DONE) + if (h->nlmsg_type == NLMSG_DONE) { + int *len = (int *)NLMSG_DATA(h); + if (*len < 0) { + close(fd); + return -1; + } + goto done; + } if (h->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);