summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2013-03-29 18:03:05 -0700
committerJesse Gross <jesse@nicira.com>2013-03-29 18:03:05 -0700
commit7c3072cc440eb76f1960c2a914d9d7c87fe71ee3 (patch)
treeb1abedc2295c126f3df40954f7c8c953e95c6d12 /datapath
parent8e63fd14f921f0a5c97a3cfcf74381f05ce51f89 (diff)
downloadopenvswitch-7c3072cc440eb76f1960c2a914d9d7c87fe71ee3.tar.gz
datapath: Specify the minimal length of OVS_PACKET_ATTR_PACKET in the policy
Specifying the minimal length in the policy makes it reuseable and documents the interface. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/datapath.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index bab29d21b..076aa98be 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -815,8 +815,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
err = -EINVAL;
if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
- !a[OVS_PACKET_ATTR_ACTIONS] ||
- nla_len(a[OVS_PACKET_ATTR_PACKET]) < ETH_HLEN)
+ !a[OVS_PACKET_ATTR_ACTIONS])
goto err;
len = nla_len(a[OVS_PACKET_ATTR_PACKET]);
@@ -891,7 +890,11 @@ err:
}
static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
- [OVS_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC },
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
+ [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
+#else
+ [OVS_PACKET_ATTR_PACKET] = { .minlen = ETH_HLEN },
+#endif
[OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
};