From 7c5793e62a024c16a2151a13be91a86b49c10779 Mon Sep 17 00:00:00 2001 From: Yifeng Sun Date: Thu, 31 Jan 2019 15:10:00 -0800 Subject: dpif-netlink: Fix a bug that causes duplicate key error in datapath Kmod tests 122 and 123 failed and kernel reports a "Duplicate key of type 6" error. Further debugging reveals that nl_attr_find__() should start looking for OVS_KEY_ATTR_ETHERTYPE from offset returned by a previous called nl_msg_start_nested(). This patch fixes it. Tests 122 and 123 were skipped by kernel 4.15 and older versions. Kernel 4.16 and later kernels start showing this failure. Signed-off-by: Yifeng Sun Signed-off-by: Ben Pfaff --- lib/dpif-netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index dfa9d9199..e23a35da4 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -3925,7 +3925,7 @@ put_exclude_packet_type(struct ofpbuf *buf, uint16_t type, ovs_be16 pt = pt_ns_type_be(nl_attr_get_be32(packet_type)); const struct nlattr *nla; - nla = nl_attr_find(buf, NLA_HDRLEN, OVS_KEY_ATTR_ETHERTYPE); + nla = nl_attr_find(buf, ofs + NLA_HDRLEN, OVS_KEY_ATTR_ETHERTYPE); if (nla) { ovs_be16 *ethertype; -- cgit v1.2.1