[pve-devel] [PATCH] kernel4.2: fix bridge vlan command with bond

Alexandre Derumier aderumier at odiso.com
Wed Sep 16 14:35:10 CEST 2015


They are a bug in kernel 4.2, and "bridge vlan" command return nothing
if a bond is present.

See my discussion on netdev mailing:
https://www.mail-archive.com/netdev@vger.kernel.org/msg77632.html

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 Makefile                      |  1 +
 fix-rtnl_bridge_getlink.patch | 69 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 fix-rtnl_bridge_getlink.patch

diff --git a/Makefile b/Makefile
index 655acaf..09c9ffa 100644
--- a/Makefile
+++ b/Makefile
@@ -204,6 +204,7 @@ ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR}
 	tar xf ${KERNELSRCTAR}
 	cat ${KERNEL_SRC}/debian.master/config/config.common.ubuntu ${KERNEL_SRC}/debian.master/config/amd64/config.common.amd64 ${KERNEL_SRC}/debian.master/config/amd64/config.flavour.generic > ${KERNEL_CFG_ORG}
 	cd ${KERNEL_SRC}; patch -p1 <../add-thp-never-option.patch
+	cd ${KERNEL_SRC}; patch -p1 <../fix-rtnl_bridge_getlink.patch
 	# see https://github.com/zfsonlinux/zfs/issues/3511
 	# should be fixed with zfs 0.6.5
 	cd ${KERNEL_SRC}; patch -p1 <../0001-Revert-block-loop-switch-to-VFS-ITER_BVEC.patch
diff --git a/fix-rtnl_bridge_getlink.patch b/fix-rtnl_bridge_getlink.patch
new file mode 100644
index 0000000..aaaef66
--- /dev/null
+++ b/fix-rtnl_bridge_getlink.patch
@@ -0,0 +1,69 @@
+From f8b65172fe4f8e6aab8946ba004a7176c0249e1d Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Wed, 16 Sep 2015 08:43:56 +0200
+Subject: [PATCH] fix rtnl_bridge_getlink
+
+Looks like this was due to 85fdb956726ff2a ("switchdev: cut over to new
+switchdev_port_bridge_getlink").
+When CONFIG_SWITCHDEV is off, nodes that use switchdev api for
+ndo_bridge_getlink (example, bonds, teams, rocker) can return
+-EOPNOTSUPP. The problem went away on my box with the following patch. I
+will submit an official patch in a bit.
+
+Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
+---
+ net/core/rtnetlink.c | 27 +++++++++++++++++----------
+ 1 file changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
+index dc004b1..9e8cffc 100644
+--- a/net/core/rtnetlink.c
++++ b/net/core/rtnetlink.c
+@@ -3021,6 +3021,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
+ 	u32 portid = NETLINK_CB(cb->skb).portid;
+ 	u32 seq = cb->nlh->nlmsg_seq;
+ 	u32 filter_mask = 0;
++	int err;
+ 
+ 	if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) {
+ 		struct nlattr *extfilt;
+@@ -3041,20 +3042,26 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
+ 		struct net_device *br_dev = netdev_master_upper_dev_get(dev);
+ 
+ 		if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) {
+-			if (idx >= cb->args[0] &&
+-			    br_dev->netdev_ops->ndo_bridge_getlink(
+-				    skb, portid, seq, dev, filter_mask,
+-				    NLM_F_MULTI) < 0)
+-				break;
++			if (idx >= cb->args[0]) {
++				err = br_dev->netdev_ops->ndo_bridge_getlink(
++						skb, portid, seq, dev,
++						filter_mask, NLM_F_MULTI);
++				if ( err < 0 && err != -EOPNOTSUPP)
++					break;
++			}
++
+ 			idx++;
+ 		}
+ 
+ 		if (ops->ndo_bridge_getlink) {
+-			if (idx >= cb->args[0] &&
+-			    ops->ndo_bridge_getlink(skb, portid, seq, dev,
+-						    filter_mask,
+-						    NLM_F_MULTI) < 0)
+-				break;
++			if (idx >= cb->args[0]) {
++				err = ops->ndo_bridge_getlink(skb, portid,
++							      seq, dev,
++							      filter_mask,
++							      NLM_F_MULTI);
++				if ( err < 0 && err != -EOPNOTSUPP)
++					break;
++			}
+ 			idx++;
+ 		}
+ 	}
+-- 
+2.1.4
+
-- 
2.1.4



More information about the pve-devel mailing list