From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f67.google.com ([74.125.83.67]:37235 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934169AbeCGPzA (ORCPT ); Wed, 7 Mar 2018 10:55:00 -0500 Received: by mail-pg0-f67.google.com with SMTP id y26so1028997pgv.4 for ; Wed, 07 Mar 2018 07:55:00 -0800 (PST) Date: Wed, 7 Mar 2018 07:54:57 -0800 From: Stephen Hemminger To: Sergei Shtylyov Cc: dsahern@gmail.com, netdev@vger.kernel.org, Stephen Hemminger Subject: Re: [PATCH iproute2-next 2/3] ipmroute: don't complain about unicast routes Message-ID: <20180307075457.5644f4cf@xeon-e3> In-Reply-To: <7f1443f3-5040-0adb-a544-1a42650dea28@cogentembedded.com> References: <20180307010355.5011-1-stephen@networkplumber.org> <20180307010355.5011-3-stephen@networkplumber.org> <7f1443f3-5040-0adb-a544-1a42650dea28@cogentembedded.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 7 Mar 2018 11:43:33 +0300 Sergei Shtylyov wrote: > Hello! > > On 3/7/2018 4:03 AM, Stephen Hemminger wrote: > > > From: Stephen Hemminger > > > > Every non-multicast route prints an error message. > > Kernel doesn't filter out unicast routes, it is up to filter function > > to do this. > > > > Signed-off-by: Stephen Hemminger > > --- > > ip/ipmroute.c | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/ip/ipmroute.c b/ip/ipmroute.c > > index aa5029b44f41..03ca0575e571 100644 > > --- a/ip/ipmroute.c > > +++ b/ip/ipmroute.c > > @@ -75,15 +75,14 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) > > fprintf(stderr, "BUG: wrong nlmsg len %d\n", len); > > return -1; > > } > > - if (r->rtm_type != RTN_MULTICAST) { > > - fprintf(stderr, "Not a multicast route (type: %s)\n", > > - rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1))); > > + > > + if (r->rtm_type != RTN_MULTICAST) > > return 0; > > - } > > > > parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); > > table = rtm_get_table(r, tb); > > > > + > > Why? > > > if (filter.tb > 0 && filter.tb != table) > > return 0; > > > > MBR, Sergei The kernel dumps all routes in response to the RTM_GETROUTE and therefore all routes show up in print_mroute. On my system (which has no mcast), I get this with standard 4.14 kernel and ip commands. $ ip mroute Not a multicast route (type: unicast) Not a multicast route (type: unicast) Not a multicast route (type: unicast) Not a multicast route (type: unicast) Not a multicast route (type: unicast) Not a multicast route (type: broadcast) Not a multicast route (type: local) Not a multicast route (type: local) Not a multicast route (type: broadcast) Not a multicast route (type: broadcast) Not a multicast route (type: local)