netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH iproute2-next 2/3] ipmroute: don't complain about unicast routes
Date: Thu, 8 Mar 2018 10:12:34 -0700	[thread overview]
Message-ID: <1618b072-97d3-7b97-892c-b76ccd094bea@gmail.com> (raw)
In-Reply-To: <20180307085148.3176384e@xeon-e3>

On 3/7/18 9:51 AM, Stephen Hemminger wrote:
> On Tue,  6 Mar 2018 17:03:54 -0800
> Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
>> From: Stephen Hemminger <sthemmin@microsoft.com>
>>
>> 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 <stephen@networkplumber.org>
> 
> 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.

If I ask the kernel for IP{6}MR address family and the kernel returns a
dump of all address families, that seems like a kernel bug to me. From a
short review it seems to be that way for a long time. I guess iproute2
has no choice but to adapt to the kernel design.

Are you going to resubmit this series?


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

  reply	other threads:[~2018-03-08 17:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07  1:03 [PATCH iproute2-next 0/3] ip multicast command JSON support Stephen Hemminger
2018-03-07  1:03 ` [PATCH iproute2-next 1/3] ipmaddr: json and color support Stephen Hemminger
2018-03-07  1:03 ` [PATCH iproute2-next 2/3] ipmroute: don't complain about unicast routes Stephen Hemminger
2018-03-07  8:43   ` Sergei Shtylyov
2018-03-07 15:54     ` Stephen Hemminger
2018-03-07 15:56       ` Sergei Shtylyov
2018-03-07 16:03   ` Stephen Hemminger
2018-03-07 16:47     ` David Ahern
2018-03-07 16:51   ` Stephen Hemminger
2018-03-08 17:12     ` David Ahern [this message]
2018-03-07  1:03 ` [PATCH iproute2-next 3/3] ipmroute: convert to output JSON Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1618b072-97d3-7b97-892c-b76ccd094bea@gmail.com \
    --to=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).