netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Cong Wang <cwang@twopensource.com>
Cc: Jet Chen <jet.chen@intel.com>, netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Fengguang Wu <fengguang.wu@intel.com>
Subject: Re: [net] WARNING: CPU: 1 PID: 1 at net/batman-adv/hard-interface.c:92 batadv_is_on_batman_iface()
Date: Thu, 22 May 2014 10:29:20 +0200	[thread overview]
Message-ID: <20140522082919.GF32371@secunet.com> (raw)
In-Reply-To: <CAHA+R7Mhd2KYaU8THAd+O4HzQNRLxhpGccvEPOqWJRKAwZbpgQ@mail.gmail.com>

On Wed, May 21, 2014 at 11:12:36PM -0700, Cong Wang wrote:
> 
> batman needs to fix:
> 
> diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
> index b851cc5..fbda6b5 100644
> --- a/net/batman-adv/hard-interface.c
> +++ b/net/batman-adv/hard-interface.c
> @@ -83,7 +83,7 @@ static bool batadv_is_on_batman_iface(const struct
> net_device *net_dev)
>                 return true;
> 
>         /* no more parents..stop recursion */
> -       if (net_dev->iflink == net_dev->ifindex)
> +       if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex)
>                 return false;
> 
>         /* recurse over the parent device */

Right, I think this is the correct fix.
Please do a proper patch submission for this.

I wondered why this issue does not show up with ipv6 tunnels
and it appears to be a bug :)

When a ipv6 tunnel interface is created, ip6_tnl_create2()
calls ip6_tnl_dev_init() which calls ip6_tnl_link_config().
ip6_tnl_link_config() sets dev->iflink.

Then register_netdev() overwrites this setting with
dev->iflink = dev->ifindex.

The output of the 'ip a' command looks like this:


9: ip6tnl0: <NOARP> mtu 1452 qdisc noop state DOWN                              
    link/tunnel6 :: brd ::
11: ip6tunnel1: <POINTOPOINT,NOARP> mtu 1452 qdisc noop state DOWN              
    link/tunnel6 2001:470:1f00:ffff::191 peer 2001:470:1f00:ffff::189


When I change to avoid the overwriting of dev->iflink it looks
like this:

9: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN                         
    link/tunnel6 :: brd :: 
12: ip6tunnel1@eth0: <POINTOPOINT,NOARP> mtu 1452 qdisc noop state DOWN         
    link/tunnel6 2001:470:1f00:ffff::191 peer 2001:470:1f00:ffff::189

So I think dev->iflink should be set in the ndo_init() function
of the tunnel, then register_netdev() leaves dev->iflink alone.

Thoughts, comments?

      parent reply	other threads:[~2014-05-22  8:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22  4:42 [net] WARNING: CPU: 1 PID: 1 at net/batman-adv/hard-interface.c:92 batadv_is_on_batman_iface() Jet Chen
2014-05-22  6:12 ` Cong Wang
2014-05-22  7:34   ` Jet Chen
2014-05-22  8:29   ` Steffen Klassert [this message]

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=20140522082919.GF32371@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=cwang@twopensource.com \
    --cc=fengguang.wu@intel.com \
    --cc=jet.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).