Commit dded45fc authored by Thomas Graf's avatar Thomas Graf Committed by Jesse Gross

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: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarJesse Gross <jesse@nicira.com>
parent f4983547
...@@ -662,8 +662,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) ...@@ -662,8 +662,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
err = -EINVAL; err = -EINVAL;
if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] || if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
!a[OVS_PACKET_ATTR_ACTIONS] || !a[OVS_PACKET_ATTR_ACTIONS])
nla_len(a[OVS_PACKET_ATTR_PACKET]) < ETH_HLEN)
goto err; goto err;
len = nla_len(a[OVS_PACKET_ATTR_PACKET]); len = nla_len(a[OVS_PACKET_ATTR_PACKET]);
...@@ -744,7 +743,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) ...@@ -744,7 +743,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
} }
static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = { static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
[OVS_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC }, [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
[OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED }, [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED }, [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment