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:43:03 +0000 (17:43 -0800)
commit2194adaf96cd481a274d0556c2ad9e1e9a53e524
tree0f1a468503662b4a5e9aeb8232adebc27ae7771d
parent1a5ed3461d74f972895683c97a61556635fe75ed
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