diff options
author | Thomas Graf <tgraf@suug.ch> | 2014-01-14 16:27:49 +0000 |
---|---|---|
committer | Jesse Gross <jesse@nicira.com> | 2014-02-04 22:21:11 -0800 |
commit | aea0bb4f8ee513537ad84b9f3f609f96e272d98e (patch) | |
tree | 9c07572b7e46ca19f688e7a17dd8aded9f5a8b3d /net/openvswitch/datapath.c | |
parent | bce3ea81d5b2a33ed0e275d58a45f10ce95cbd50 (diff) | |
download | op-kernel-dev-aea0bb4f8ee513537ad84b9f3f609f96e272d98e.zip op-kernel-dev-aea0bb4f8ee513537ad84b9f3f609f96e272d98e.tar.gz |
openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.
This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r-- | net/openvswitch/datapath.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index df46928..d1a73a6 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -466,6 +466,14 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, skb_zerocopy(user_skb, skb, skb->len, hlen); + /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */ + if (!(dp->user_features & OVS_DP_F_UNALIGNED)) { + size_t plen = NLA_ALIGN(user_skb->len) - user_skb->len; + + if (plen > 0) + memset(skb_put(user_skb, plen), 0, plen); + } + ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len; err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); |