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]
Date:	Sat, 4 Apr 2015 16:56:12 +0000
From:	"Arad, Ronen" <ronen.arad@...el.com>
To:	"sfeldma@...il.com" <sfeldma@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:	"jiri@...nulli.us" <jiri@...nulli.us>,
	"roopa@...ulusnetworks.com" <roopa@...ulusnetworks.com>,
	"linux@...ck-us.net" <linux@...ck-us.net>,
	"f.fainelli@...il.com" <f.fainelli@...il.com>,
	"Samudrala, Sridhar" <sridhar.samudrala@...el.com>
Subject: RE: [PATCH net-next v3 19/26] switchdev: add new
 swdev_port_bridge_getlink



>-----Original Message-----
>From: sfeldma@...il.com [mailto:sfeldma@...il.com]
>Sent: Thursday, April 02, 2015 1:10 AM
>To: netdev@...r.kernel.org
>Cc: jiri@...nulli.us; roopa@...ulusnetworks.com; linux@...ck-us.net;
>f.fainelli@...il.com; Samudrala, Sridhar; Arad, Ronen
>Subject: [PATCH net-next v3 19/26] switchdev: add new
>swdev_port_bridge_getlink
>
>From: Scott Feldman <sfeldma@...il.com>
>
>Like bridge_setlink, add swdev wrapper to handle bridge_getlink and call into
>port driver to get port attrs.  For now, only BR_LEARNING and BR_LEARNING_SYNC
>are returned.  To add more, we'll probably want to break away from
>ndo_dflt_bridge_getlink() and build the netlink skb directly in the swdev
>code.
>
>Signed-off-by: Scott Feldman <sfeldma@...il.com>
>---
> include/net/switchdev.h   |    9 +++++++++
> net/switchdev/switchdev.c |   27 +++++++++++++++++++++++++++
> 2 files changed, 36 insertions(+)
>
>diff --git a/include/net/switchdev.h b/include/net/switchdev.h
>index a88754c..efd7753 100644
>--- a/include/net/switchdev.h
>+++ b/include/net/switchdev.h
>@@ -115,6 +115,8 @@ int swdev_port_attr_get(struct net_device *dev, struct
>swdev_attr *attr);
> int swdev_port_attr_set(struct net_device *dev, struct swdev_attr *attr);
> int swdev_port_obj_add(struct net_device *dev, struct swdev_obj *obj);
> int swdev_port_obj_del(struct net_device *dev, struct swdev_obj *obj);
>+int swdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>+			      struct net_device *dev, u32 filter_mask);
> int swdev_port_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
> 			      u16 flags);
> int swdev_port_bridge_dellink(struct net_device *dev, struct nlmsghdr *nlh,
>@@ -155,6 +157,13 @@ static inline int swdev_port_obj_del(struct net_device
>*dev,
> 	return -EOPNOTSUPP;
> }
>
>+static inline int swdev_port_bridge_getlink(struct sk_buff *skb, u32 pid,
>+					    u32 seq, struct net_device *dev,
>+					    u32 filter_mask)
>+{
>+	return -EOPNOTSUPP;
>+}
>+
> static inline int swdev_port_bridge_setlink(struct net_device *dev,
> 					    struct nlmsghdr *nlh, u16 flags)
> {
>diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
>index 19936ccc..5324248 100644
>--- a/net/switchdev/switchdev.c
>+++ b/net/switchdev/switchdev.c
>@@ -317,6 +317,33 @@ int call_netdev_switch_notifiers(unsigned long val,
>struct net_device *dev,
> }
> EXPORT_SYMBOL_GPL(call_netdev_switch_notifiers);
>
>+/**
>+ *	swdev_port_bridge_getlink - Get bridge port attributes
>+ *
>+ *	@dev: port device
>+ *
>+ *	Called for SELF on rtnl_bridge_getlink to get bridge port
>+ *	attributes.
>+ */
>+int swdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>+			      struct net_device *dev, u32 filter_mask)
>+{
>+	struct swdev_attr attr = {
>+		.id = SWDEV_ATTR_PORT_BRIDGE_FLAGS,
>+	};
>+	u16 mode = BRIDGE_MODE_UNDEF;
>+	u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
>+	int err;
>+
>+	err = swdev_port_attr_get(dev, &attr);
>+	if (err)
>+		return err;
>+
>+	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
>+				       attr.brport_flags, mask);
>+}
>+EXPORT_SYMBOL_GPL(swdev_port_bridge_getlink);
>+

swdev_port_bridge_getlink and the function it wraps 
ndo_dflt_bridge_getlink are only useful when all you need is to return
a set of brport attributes.
When a switchdev driver supports VLAN filtering without being enslaved
to a bridge this no longer works. ndo_dflt_bridge_getlink will end up in
a netlink RTM_NEWLINK message without the VLAN filtering info which is
maintained internally by the switchdev driver.
The driver will have to duplicate the code in ndo_dflt_bridge_getlink in
order to return a single RTM_NEWLINK message per port.
Can we break ndo_dflt_bridge_getlink to components that could be used
by such driver?
It would be useful to have one function that could fill the 
IFLA_PROTINFO and another one for the IFLA_AF_SPEC. 
 
> static int swdev_port_br_setflag(struct net_device *dev, struct nlattr
>*nlattr,
> 				 unsigned long brport_flag)
> {
>--
>1.7.10.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