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: <20150414053045.GA2063@nanopsycho.orion>
Date:	Tue, 14 Apr 2015 07:30:45 +0200
From:	Jiri Pirko <jiri@...nulli.us>
To:	roopa <roopa@...ulusnetworks.com>
Cc:	sfeldma@...il.com, netdev@...r.kernel.org, linux@...ck-us.net,
	f.fainelli@...il.com, sridhar.samudrala@...el.com,
	ronen.arad@...el.com, andrew@...n.ch
Subject: Re: [PATCH net-next v4 09/24] switchdev: add new swdev bridge setlink

Tue, Apr 14, 2015 at 06:09:28AM CEST, roopa@...ulusnetworks.com wrote:
>On 4/12/15, 11:17 PM, sfeldma@...il.com wrote:
>>From: Scott Feldman <sfeldma@...il.com>
>>
>>Add new swdev_port_bridge_setlink that can be used by drivers implementing
>>.ndo_bridge_setlink to set swdev bridge attributes.  Basically turn the raw
>>rtnl_bridge_setlink netlink into swdev attr sets.  Proper netlink attr policy
>>checking is done on the protinfo part of the netlink msg.
>>
>>Currently, for protinfo, only bridge port attrs BR_LEARNING and
>>BR_LEARNING_SYNC are parsed and passed to port driver.
>>
>>For afspec, VLAN objs are passed so swdev driver can set VLANs assigned to
>>SELF.  To illustrate with iproute2 cmd, we have:
>>
>>	bridge vlan add vid 10 dev sw1p1 self master
>>
>>To add VLAN 10 to port sw1p1 for both the bridge (master) and the device
>>(self).
>>
>>Signed-off-by: Scott Feldman <sfeldma@...il.com>
>>---
>>  include/net/switchdev.h   |    8 +++
>>  net/switchdev/switchdev.c |  152 +++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 160 insertions(+)
>>

...

>>+static int swdev_port_br_afspec(struct net_device *dev,
>>+				struct nlattr *afspec,
>>+				int (*f)(struct net_device *dev,
>>+					 struct swdev_obj *obj))
>>+{
>>+	struct nlattr *attr;
>>+	struct bridge_vlan_info *vinfo;
>>+	struct swdev_obj obj = {
>>+		.id = SWDEV_OBJ_PORT_VLAN,
>>+	};
>>+	int rem;
>>+	int err;
>>+
>>+	nla_for_each_nested(attr, afspec, rem) {
>>+		if (nla_type(attr) != IFLA_BRIDGE_VLAN_INFO)
>>+			continue;
>>+		if (nla_len(attr) != sizeof(struct bridge_vlan_info))
>>+			return -EINVAL;
>>+		vinfo = nla_data(attr);
>>+		obj.vlan.flags = vinfo->flags;
>>+		if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
>>+			if (obj.vlan.vid_start)
>>+				return -EINVAL;
>>+			obj.vlan.vid_start = vinfo->vid;
>>+		} else if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) {
>>+			if (!obj.vlan.vid_start)
>>+				return -EINVAL;
>>+			obj.vlan.vid_end = vinfo->vid;
>>+			if (obj.vlan.vid_end <= obj.vlan.vid_start)
>>+				return -EINVAL;
>>+			err = f(dev, &obj);
>>+			if (err)
>>+				return err;
>>+			memset(&obj.vlan, 0, sizeof(obj.vlan));
>>+		} else {
>>+			if (obj.vlan.vid_start)
>>+				return -EINVAL;
>>+			obj.vlan.vid_start = vinfo->vid;
>>+			obj.vlan.vid_end = vinfo->vid;
>>+			err = f(dev, &obj);
>>+			if (err)
>>+				return err;
>>+			memset(&obj.vlan, 0, sizeof(obj.vlan));
>>+		}
>>+	}
>>+
>>+	return 0;
>>+}
>>+
>
>This seems to be duplicating code that is already there in the bridge driver.
>
 
Sure, this is used by swdev_port_bridge_setlink, default ndo.

--
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