mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
odp-execute: Fix length checking while executing check_pkt_len action.
If dp-packet contains l2 padding or cutlen was applied to it, size will
be larger than the actual size of a payload and action will work
incorrectly.
Ex. Padding could be added during miniflow_extract() if detected.
Fixes: 5b34f8fc3b
("Add a new OVS action check_pkt_larger")
Reported-by: Miroslav Kubiczek <miroslav.kubiczek@adaptivemobile.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2020-May/050157.html
Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
@@ -761,10 +761,11 @@ odp_execute_check_pkt_len(void *dp, struct dp_packet *packet, bool steal,
|
||||
|
||||
const struct nlattr *a;
|
||||
struct dp_packet_batch pb;
|
||||
uint32_t size = dp_packet_get_send_len(packet)
|
||||
- dp_packet_l2_pad_size(packet);
|
||||
|
||||
a = attrs[OVS_CHECK_PKT_LEN_ATTR_PKT_LEN];
|
||||
bool is_greater = dp_packet_size(packet) > nl_attr_get_u16(a);
|
||||
if (is_greater) {
|
||||
if (size > nl_attr_get_u16(a)) {
|
||||
a = attrs[OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER];
|
||||
} else {
|
||||
a = attrs[OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL];
|
||||
|
Reference in New Issue
Block a user