[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120412103825.74ff915a@s6510.linuxnetplumber.net>
Date: Thu, 12 Apr 2012 10:38:25 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: David Miller <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/4] ipgre: follow state of lower device
On Thu, 12 Apr 2012 18:32:07 +0100
Ben Hutchings <bhutchings@...arflare.com> wrote:
> On Thu, 2012-04-12 at 09:31 -0700, Stephen Hemminger wrote:
>
> > GRE tunnels like other layered devices should propogate
> > carrier and RFC2863 state from lower device to tunnel.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@...tta.com>
> >
> > --- a/net/ipv4/ip_gre.c 2012-04-12 08:07:39.508107847 -0700
> > +++ b/net/ipv4/ip_gre.c 2012-04-12 08:10:14.177499183 -0700
> [...]
> > @@ -1732,6 +1734,36 @@ static struct rtnl_link_ops ipgre_tap_op
> > .fill_info = ipgre_fill_info,
> > };
> >
> > +/* If lower device changes state, reflect that to the tunnel. */
> > +static int ipgre_notify(struct notifier_block *unused,
> > + unsigned long event, void *ptr)
> > +{
> > + struct net_device *dev = ptr;
> > + struct net *net = dev_net(dev);
> > + struct ipgre_net *ign = net_generic(net, ipgre_net_id);
> > + unsigned int prio, h;
> > + struct ip_tunnel *t;
> > +
> > + if (event == NETDEV_CHANGE)
> > + return NOTIFY_DONE;
>
> Surely we should handle NETDEV_UP, NETDEV_CHANGE, NETDEV_DOWN here? Not
> everything other than NETDEV_CHANGE.
yes, up and down needed as well.
> > + for (prio = 0; prio < 4; prio++)
> > + for (h = 0; h < HASH_SIZE; h++) {
> > + for (t = rtnl_dereference(ign->tunnels[prio][h]);
> > + t; t = rtnl_dereference(t->next)) {
> > + if (dev->ifindex != t->dev->iflink)
> > + continue;
> > + netif_stacked_transfer_operstate(dev, t->dev);
> > + }
> > + }
> [...]
>
> This seems potentially very inefficient.
Yes, but there is no list of tunnels per device.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists