diff mbox series

[ovs-dev,1/2] dpif-netlink: Fix a bug that causes duplicate key error in datapath

Message ID 1548976201-25288-1-git-send-email-pkusunyifeng@gmail.com
State Accepted
Headers show
Series [ovs-dev,1/2] dpif-netlink: Fix a bug that causes duplicate key error in datapath | expand

Commit Message

Yifeng Sun Jan. 31, 2019, 11:10 p.m. UTC
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 <pkusunyifeng@gmail.com>
---
 lib/dpif-netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Feb. 4, 2019, 9:41 p.m. UTC | #1
On Thu, Jan 31, 2019 at 03:10:00PM -0800, Yifeng Sun wrote:
> 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 <pkusunyifeng@gmail.com>

Thanks.  I applied this to master and backported as far as it would go.
diff mbox series

Patch

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index dfa9d9199a73..e23a35da4f4e 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;