From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:42562 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933948AbeCGQv4 (ORCPT ); Wed, 7 Mar 2018 11:51:56 -0500 Received: by mail-pl0-f67.google.com with SMTP id 93-v6so1635253plc.9 for ; Wed, 07 Mar 2018 08:51:56 -0800 (PST) Date: Wed, 7 Mar 2018 08:51:48 -0800 From: Stephen Hemminger To: dsahern@gmail.com Cc: netdev@vger.kernel.org, Stephen Hemminger Subject: Re: [PATCH iproute2-next 2/3] ipmroute: don't complain about unicast routes Message-ID: <20180307085148.3176384e@xeon-e3> In-Reply-To: <20180307010355.5011-3-stephen@networkplumber.org> References: <20180307010355.5011-1-stephen@networkplumber.org> <20180307010355.5011-3-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 6 Mar 2018 17:03:54 -0800 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 I found the issue (in kernel) but not sure how to deal with it. If kernel is built without multicast routing configured !CONFIG_IP_MROUTE then the netlink request to return multicast routes will return all routes! This is because in the kernel the way route dump works is that each address family registers a callback to dump routes for a specific address family. If that address family is not registered then the fall back is to address family PF_UNSPEC which has a handler that dumps all routes. Unfortunately, changing that behavior in kernel will certainly break some user. And there is no direct way to determine multicast routing is enabled in ip mroute code. Maybe just change the message in ip mroute to do: diff --git a/ip/ipmroute.c b/ip/ipmroute.c index aa5029b44f41..31b9bfe95596 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -76,9 +76,8 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) 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))); - return 0; + fprintf(stderr, "Multicast routing does not appear to be enabled\n"); + return -1; } parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);