Skip to content

Commit e10d3ba

Browse files
ismaellummakynes
authored andcommitted
ipvs: Fix checksumming on GSO of SCTP packets
It was observed in the wild that pairs of consecutive packets would leave the IPVS with the same wrong checksum, and the issue only went away when disabling GSO. IPVS needs to avoid computing the SCTP checksum when using GSO. Fixes: 90017ac ("sctp: Add GSO support") Co-developed-by: Firo Yang <[email protected]> Signed-off-by: Ismael Luceno <[email protected]> Tested-by: Andreas Taschner <[email protected]> Acked-by: Julian Anastasov <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent a9176f7 commit e10d3ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/netfilter/ipvs/ip_vs_proto_sctp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
126126
if (sctph->source != cp->vport || payload_csum ||
127127
skb->ip_summed == CHECKSUM_PARTIAL) {
128128
sctph->source = cp->vport;
129-
sctp_nat_csum(skb, sctph, sctphoff);
129+
if (!skb_is_gso(skb) || !skb_is_gso_sctp(skb))
130+
sctp_nat_csum(skb, sctph, sctphoff);
130131
} else {
131132
skb->ip_summed = CHECKSUM_UNNECESSARY;
132133
}
@@ -174,7 +175,8 @@ sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
174175
(skb->ip_summed == CHECKSUM_PARTIAL &&
175176
!(skb_dst(skb)->dev->features & NETIF_F_SCTP_CRC))) {
176177
sctph->dest = cp->dport;
177-
sctp_nat_csum(skb, sctph, sctphoff);
178+
if (!skb_is_gso(skb) || !skb_is_gso_sctp(skb))
179+
sctp_nat_csum(skb, sctph, sctphoff);
178180
} else if (skb->ip_summed != CHECKSUM_PARTIAL) {
179181
skb->ip_summed = CHECKSUM_UNNECESSARY;
180182
}

0 commit comments

Comments
 (0)