Skip to content

Commit

Permalink
openvswitch: Specify the minimal length of OVS_PACKET_ATTR_PACKET in …
Browse files Browse the repository at this point in the history
…the policy

Specifying the minimal length in the policy makes it reuseable
and documents the interface.

Signed-off-by: Thomas Graf <[email protected]>
Signed-off-by: Jesse Gross <[email protected]>
  • Loading branch information
tgraf authored and jessegross committed Mar 30, 2013
1 parent f498354 commit dded45f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/openvswitch/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,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]);
Expand Down Expand Up @@ -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] = {
[OVS_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC },
[OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
[OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
};
Expand Down

0 comments on commit dded45f

Please sign in to comment.