odp-util: Commit ICMP set only for ICMP packets.
authorDaniele Di Proietto <diproiettod@vmware.com>
Tue, 8 Dec 2015 23:44:51 +0000 (15:44 -0800)
committerDaniele Di Proietto <diproiettod@vmware.com>
Fri, 11 Dec 2015 01:38:23 +0000 (17:38 -0800)
commitefa6665e4d72e4d4f7cc971fb0df54278dba3e47
tree32b014caed992ef3ea267c671c944246c7e638df
parent5be5370d361b91d1dcda80897d20610c752d6975
odp-util: Commit ICMP set only for ICMP packets.

commit_set_icmp_action() should do its job only if the packet is ICMP,
otherwise there will be two problems:

* A set ICMP action will be inserted in the ODP actions and the flow
  will be slow pathed.
* The tp_src and tp_dst field will be unwildcarded.

Normal TCP or UDP packets won't be impacted, because
commit_set_icmp_action() is called after commit_set_port_action() and it
will see the fields as already committed (TCP/UCP transport ports and ICMP
code/type are stored in the same members in struct flow).

MPLS packets though will hit the bug, causing a nonsensical set action
(which will end up zeroing the transport source port) and an invalid
mask to be generated.

The commit also alters an MPLS testcase to trigger the bug.
lib/odp-util.c
tests/mpls-xlate.at