diff options
author | Thomas Graf <tgraf@suug.ch> | 2013-03-29 09:46:47 -0400 |
---|---|---|
committer | Jesse Gross <jesse@nicira.com> | 2013-03-29 20:53:18 -0400 |
commit | dded45fc179a07f4463ce37fc376977568655836 (patch) | |
tree | 09327ae6d487c365e0df772f1bc4004a7475cf5f /net/openvswitch | |
parent | f498354793d57479d4e1b0f39969acd66737234c (diff) |
openvswitch: 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 'net/openvswitch')
-rw-r--r-- | net/openvswitch/datapath.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 8759265a3e46..5b58d163a4dc 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -662,8 +662,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) | |||
662 | 662 | ||
663 | err = -EINVAL; | 663 | err = -EINVAL; |
664 | if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] || | 664 | if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] || |
665 | !a[OVS_PACKET_ATTR_ACTIONS] || | 665 | !a[OVS_PACKET_ATTR_ACTIONS]) |
666 | nla_len(a[OVS_PACKET_ATTR_PACKET]) < ETH_HLEN) | ||
667 | goto err; | 666 | goto err; |
668 | 667 | ||
669 | len = nla_len(a[OVS_PACKET_ATTR_PACKET]); | 668 | len = nla_len(a[OVS_PACKET_ATTR_PACKET]); |
@@ -744,7 +743,7 @@ err: | |||
744 | } | 743 | } |
745 | 744 | ||
746 | static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = { | 745 | static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = { |
747 | [OVS_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC }, | 746 | [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN }, |
748 | [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED }, | 747 | [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED }, |
749 | [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED }, | 748 | [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED }, |
750 | }; | 749 | }; |