lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130903081034.GC1437@minipsycho.brq.redhat.com>
Date:	Tue, 3 Sep 2013 10:10:34 +0200
From:	Jiri Pirko <jiri@...nulli.us>
To:	Veaceslav Falico <vfalico@...hat.com>
Cc:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Alexander Duyck <alexander.h.duyck@...el.com>
Subject: Re: [PATCH RFC net-next 18/21] net: add a function to get the
 next/prev private

Mon, Sep 02, 2013 at 11:39:22PM CEST, vfalico@...hat.com wrote:
>The boolean flag specifies which direction to go.
>
>CC: "David S. Miller" <davem@...emloft.net>
>CC: Eric Dumazet <edumazet@...gle.com>
>CC: Jiri Pirko <jiri@...nulli.us>
>CC: Alexander Duyck <alexander.h.duyck@...el.com>
>Signed-off-by: Veaceslav Falico <vfalico@...hat.com>
>---
> include/linux/netdevice.h |  2 ++
> net/core/dev.c            | 24 ++++++++++++++++++++++++
> 2 files changed, 26 insertions(+)
>
>diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>index bde2244..a112ccc 100644
>--- a/include/linux/netdevice.h
>+++ b/include/linux/netdevice.h
>@@ -2835,6 +2835,8 @@ extern void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
> 					      struct net_device *lower_dev);
> extern void *netdev_lower_dev_get_private(struct net_device *dev,
> 					  struct net_device *lower_dev);
>+extern void *netdev_lower_dev_get_next_private(struct net_device *dev,
>+					       void *private, bool prev);
> extern int skb_checksum_help(struct sk_buff *skb);
> extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
> 	netdev_features_t features, bool tx_path);
>diff --git a/net/core/dev.c b/net/core/dev.c
>index 6df11a0..c694059 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -5163,6 +5163,30 @@ void *netdev_lower_dev_get_private(struct net_device *dev,
> }
> EXPORT_SYMBOL(netdev_lower_dev_get_private);
> 
>+extern void *netdev_lower_dev_get_next_private(struct net_device *dev,
>+					       void *private, bool prev)

                                                             ^^^^^^^^^^^
				Please rather do this in 2 functions
				Next should return next, not previous...

>+{
>+	struct netdev_adjacent *lower;
>+
>+	list_for_each_entry(lower, &dev->neighbour_dev_list.lower, list)
>+		if (lower->private == private)
>+			break;
>+
>+	if (&lower->list == &dev->neighbour_dev_list.lower)
>+		return NULL;
>+
>+	lower = prev ? list_entry(lower->list.prev, struct netdev_adjacent, list) :
>+		       list_entry(lower->list.next, struct netdev_adjacent, list);
>+	if (&lower->list != &dev->neighbour_dev_list.lower)
>+		return lower->private;
>+
>+	lower = prev ? list_entry(lower->list.prev, struct netdev_adjacent, list) :
>+		       list_entry(lower->list.next, struct netdev_adjacent, list);
>+
>+	return lower->private;
>+}
>+EXPORT_SYMBOL(netdev_lower_dev_get_next_private);
>+
> static void dev_change_rx_flags(struct net_device *dev, int flags)
> {
> 	const struct net_device_ops *ops = dev->netdev_ops;
>-- 
>1.8.4
>
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ