Skip to content

Commit 0fb370b

Browse files
committed
flow: Explicitly pad tcp_flags for TCP and tp_dst for IGMP.
'tcp_flags' are not placed at the beginning of the 64-bit block, so they have to be padded. Today it is done in a hacky way by pushing zeroes over the last 32-bits of the arp_tha. When that was written the miniflow_pad_from_64() didn't exist, but it's better to use it now instead to avoid confusion. 'ct_tp_src/dst' are not actually extracted for IGMP. See the write_ct_md() function. The pushes are there for the padding purposes, since 'tp_dst' doesn't end on a 64-bit boundary and so we need to pad before pushing the IGMP group. Use an explicit padding function instead to avoid a false impression that IGMP can have non-zero "ports" in the conntrack tuple. This change should not change anything functionally. Acked-by: Paolo Valerio <pvalerio@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
1 parent cb9e21d commit 0fb370b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/flow.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,8 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
10671067

10681068
if (OVS_LIKELY(tcp_hdr_len >= TCP_HEADER_LEN)
10691069
&& OVS_LIKELY(size >= tcp_hdr_len)) {
1070-
miniflow_push_be32(mf, arp_tha.ea[2], 0);
1070+
/* tcp_flags are not at the beginning of the block. */
1071+
miniflow_pad_from_64(mf, tcp_flags);
10711072
miniflow_push_be32(mf, tcp_flags,
10721073
TCP_FLAGS_BE32(tcp->tcp_ctl));
10731074
miniflow_push_be16(mf, tp_src, tcp->tcp_src);
@@ -1138,8 +1139,8 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
11381139

11391140
miniflow_push_be16(mf, tp_src, htons(igmp->igmp_type));
11401141
miniflow_push_be16(mf, tp_dst, htons(igmp->igmp_code));
1141-
miniflow_push_be16(mf, ct_tp_src, ct_tp_src);
1142-
miniflow_push_be16(mf, ct_tp_dst, ct_tp_dst);
1142+
/* ct_tp_src/dst are not extracted for IGMP. */
1143+
miniflow_pad_to_64(mf, tp_dst);
11431144
miniflow_push_be32(mf, igmp_group_ip4,
11441145
get_16aligned_be32(&igmp->group));
11451146
miniflow_pad_to_64(mf, igmp_group_ip4);

0 commit comments

Comments
 (0)