public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Roopa Prabhu <roopa@cumulusnetworks•com>
To: David Ahern <dsa@cumulusnetworks•com>
Cc: netdev@vger•kernel.org, rshearma@brocade•com
Subject: Re: [PATCH net-next 1/2] net: mpls: Don't show nexthop if device has been deleted
Date: Sun, 26 Mar 2017 10:20:50 -0700	[thread overview]
Message-ID: <58D7F872.9070707@cumulusnetworks.com> (raw)
In-Reply-To: <1490394117-19268-2-git-send-email-dsa@cumulusnetworks.com>

On 3/24/17, 3:21 PM, David Ahern wrote:
> If the device for a nexthop in a multipath route is deleted, the nexthop
> is effectively removed from the route. Currently, a route dump still
> returns the nexhop though without the device set:
>
> $ ip -f mpls ro ls
> 100
> 	nexthopvia inet 10.11.1.2  dev br0
> 	nexthopvia inet 10.100.3.1  dev eth3
> $ ip li del br0
> $ ip -f mpls ro ls
> 100
> 	nexthopvia inet 10.11.1.2  dev * dead linkdown
> 	nexthopvia inet 10.100.3.1  dev eth3
>
> Since the nexthop is effectively deleted, drop the hop from the route
> dump.
>
> Signed-off-by: David Ahern <dsa@cumulusnetworks•com>
> ---
>  net/mpls/af_mpls.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
> index cd8be8d5e4ad..3861f8dfa9c1 100644
> --- a/net/mpls/af_mpls.c
> +++ b/net/mpls/af_mpls.c
> @@ -1769,13 +1769,15 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event,
>  			goto nla_put_failure;
>  
>  		for_nexthops(rt) {
> +			dev = rtnl_dereference(nh->nh_dev);
> +			if (!dev)
> +				continue;
> +

size calculation may have to account for this too ?.
>  			rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh));
>  			if (!rtnh)
>  				goto nla_put_failure;
>  
> -			dev = rtnl_dereference(nh->nh_dev);
> -			if (dev)
> -				rtnh->rtnh_ifindex = dev->ifindex;
> +			rtnh->rtnh_ifindex = dev->ifindex;
>  			if (nh->nh_flags & RTNH_F_LINKDOWN) {
>  				rtnh->rtnh_flags |= RTNH_F_LINKDOWN;
>  				linkdown++;



Acked-by: Roopa Prabhu <roopa@cumulusnetworks•com>

  reply	other threads:[~2017-03-26 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 22:21 [PATCH net-next 0/2] net: mpls: multipath route cleanups David Ahern
2017-03-24 22:21 ` [PATCH net-next 1/2] net: mpls: Don't show nexthop if device has been deleted David Ahern
2017-03-26 17:20   ` Roopa Prabhu [this message]
2017-03-24 22:21 ` [PATCH net-next 2/2] net: mpls: Delete route when all nexthops have " David Ahern
2017-03-26 17:26   ` Roopa Prabhu
2017-03-27 10:17 ` [PATCH net-next 0/2] net: mpls: multipath route cleanups Robert Shearman
2017-03-27 21:12 ` David Miller

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=58D7F872.9070707@cumulusnetworks.com \
    --to=roopa@cumulusnetworks$(echo .)com \
    --cc=dsa@cumulusnetworks$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rshearma@brocade$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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