public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: dsahern@gmail.com, netdev@vger.kernel.org,
	Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH iproute2-next 2/3] ipmroute: don't complain about unicast routes
Date: Wed, 7 Mar 2018 07:54:57 -0800	[thread overview]
Message-ID: <20180307075457.5644f4cf@xeon-e3> (raw)
In-Reply-To: <7f1443f3-5040-0adb-a544-1a42650dea28@cogentembedded.com>

On Wed, 7 Mar 2018 11:43:33 +0300
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:

> Hello!
> 
> On 3/7/2018 4:03 AM, Stephen Hemminger 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>
> > ---
> >   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)

  reply	other threads:[~2018-03-07 15:55 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 [this message]
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
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=20180307075457.5644f4cf@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --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