flow_compose() can generate packets with bad IPv4 checksum, however the associated Rx flags were not correctly set. Add missing helper in dp packet API and use it.
Fixes: c62b4ac8f8da ("ovs-ofctl: Implement compose-packet --bare [--bad-csum].") Signed-off-by: David Marchand <david.march...@redhat.com> --- lib/dp-packet.h | 9 ++++++++- lib/flow.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/dp-packet.h b/lib/dp-packet.h index 0f487a4283..29a0620e4b 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -1411,7 +1411,6 @@ dp_packet_ol_reset_ip_csum_good(struct dp_packet *p) *dp_packet_ol_flags_ptr(p) &= ~DP_PACKET_OL_RX_IP_CKSUM_GOOD; } -/* Marks packet 'p' with bad IPv4 checksum. */ static inline bool dp_packet_ip_checksum_bad(const struct dp_packet *p) { @@ -1419,6 +1418,14 @@ dp_packet_ip_checksum_bad(const struct dp_packet *p) DP_PACKET_OL_RX_IP_CKSUM_BAD; } +/* Marks packet 'p' with bad IPv4 checksum. */ +static inline void +dp_packet_ol_set_ip_csum_bad(struct dp_packet *p) +{ + *dp_packet_ol_flags_ptr(p) &= ~DP_PACKET_OL_RX_IP_CKSUM_GOOD; + *dp_packet_ol_flags_ptr(p) |= DP_PACKET_OL_RX_IP_CKSUM_BAD; +} + /* Return 'true' is packet 'b' is not encapsulated and is marked for IPv4 * checksum offload, or if 'b' is encapsulated and the outer layer is marked * for IPv4 checksum offload. IPv6 packets, non offloaded packets, and IPv4 diff --git a/lib/flow.c b/lib/flow.c index ef719471c6..f813d70bb9 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -3411,7 +3411,7 @@ flow_compose(struct dp_packet *p, const struct flow *flow, * bit. */ ip->ip_csum ^= (OVS_FORCE ovs_be16) 0x1; - dp_packet_ip_checksum_bad(p); + dp_packet_ol_set_ip_csum_bad(p); } else { dp_packet_ol_set_ip_csum_good(p); } -- 2.48.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev