netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Mike Manning <mmanning@vyatta.att-mail.com>, netdev@vger.kernel.org
Cc: Dewi Morgan <morgand@vyatta.att-mail.com>
Subject: Re: [PATCH net-next 4/5] ipv6: do not drop vrf udp multicast packets
Date: Thu, 20 Sep 2018 15:02:25 +0200	[thread overview]
Message-ID: <09797df92f76885b0e3244a3aca68dbf07a09a3a.camel@redhat.com> (raw)
In-Reply-To: <20180920085848.17721-5-mmanning@vyatta.att-mail.com>

Hi,

On Thu, 2018-09-20 at 09:58 +0100, Mike Manning wrote:
> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index 108f5f88ec98..fc60f297d95b 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -325,9 +325,12 @@ static int ip6_input_finish(struct net *net, struct sock *sk, struct sk_buff *sk
>  {
>  	const struct inet6_protocol *ipprot;
>  	struct inet6_dev *idev;
> +	struct net_device *dev;
>  	unsigned int nhoff;
> +	int sdif = inet6_sdif(skb);
>  	int nexthdr;
>  	bool raw;
> +	bool deliver;
>  	bool have_final = false;

Please, try instead to sort the variable in reverse x-mas tree order.
>  
>  	/*
> @@ -371,9 +374,27 @@ static int ip6_input_finish(struct net *net, struct sock *sk, struct sk_buff *sk
>  			skb_postpull_rcsum(skb, skb_network_header(skb),
>  					   skb_network_header_len(skb));
>  			hdr = ipv6_hdr(skb);
> -			if (ipv6_addr_is_multicast(&hdr->daddr) &&
> -			    !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
> -			    &hdr->saddr) &&
> +
> +			/* skb->dev passed may be master dev for vrfs. */
> +			if (sdif) {
> +				rcu_read_lock();

AFAICS, the rcu lock is already acquired at the beginning of
ip6_input_finish(), not need to acquire it here again.
+				dev = dev_get_by_index_rcu(dev_net(skb->dev),
> +							   sdif);
> +				if (!dev) {
> +					rcu_read_unlock();
> +					kfree_skb(skb);
> +					return -ENODEV;
> +				}
> +			} else {
> +				dev = skb->dev;

The above fragment of code is a recurring pattern in this series,
perhaps adding an helper for it would reduce code duplication ?

Cheers,

Paolo

  reply	other threads:[~2018-09-20 18:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  8:58 [PATCH net-next 0/5] vrf: allow simultaneous service instances in default and other VRFs Mike Manning
2018-09-20  8:58 ` [PATCH net-next 1/5] net: allow binding socket in a VRF when there's an unbound socket Mike Manning
2018-09-23  8:47   ` kbuild test robot
2018-09-23  9:58   ` kbuild test robot
2018-09-20  8:58 ` [PATCH net-next 2/5] ipv6: allow link-local and multicast packets inside vrf Mike Manning
2018-09-20  8:58 ` [PATCH net-next 3/5] ipv4: Allow sending multicast packets on specific i/f using VRF socket Mike Manning
2018-09-20  8:58 ` [PATCH net-next 4/5] ipv6: do not drop vrf udp multicast packets Mike Manning
2018-09-20 13:02   ` Paolo Abeni [this message]
2018-09-20 16:50     ` Mike Manning
2018-09-20  8:58 ` [PATCH net-next 5/5] ipv6: add vrf table handling code for ipv6 mcast Mike Manning
2018-09-21  4:28 ` [PATCH net-next 0/5] vrf: allow simultaneous service instances in default and other VRFs David Ahern
2018-09-21 14:41   ` 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=09797df92f76885b0e3244a3aca68dbf07a09a3a.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=mmanning@vyatta.att-mail.com \
    --cc=morgand@vyatta.att-mail.com \
    --cc=netdev@vger.kernel.org \
    /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).