Skip to content

Commit 154deab

Browse files
lxinklassert
authored andcommitted
esp: delete NETIF_F_SCTP_CRC bit from features for esp offload
Now in esp4/6_gso_segment(), before calling inner proto .gso_segment, NETIF_F_CSUM_MASK bits are deleted, as HW won't be able to do the csum for inner proto due to the packet encrypted already. So the UDP/TCP packet has to do the checksum on its own .gso_segment. But SCTP is using CRC checksum, and for that NETIF_F_SCTP_CRC should be deleted to make SCTP do the csum in own .gso_segment as well. In Xiumei's testing with SCTP over IPsec/veth, the packets are kept dropping due to the wrong CRC checksum. Reported-by: Xiumei Mu <[email protected]> Fixes: 7862b40 ("esp: Add gso handlers for esp4 and esp6") Signed-off-by: Xin Long <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent bc8e0ad commit 154deab

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

net/ipv4/esp4_offload.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
217217

218218
if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) &&
219219
!(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev)
220-
esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK);
220+
esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK |
221+
NETIF_F_SCTP_CRC);
221222
else if (!(features & NETIF_F_HW_ESP_TX_CSUM) &&
222223
!(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM))
223-
esp_features = features & ~NETIF_F_CSUM_MASK;
224+
esp_features = features & ~(NETIF_F_CSUM_MASK |
225+
NETIF_F_SCTP_CRC);
224226

225227
xo->flags |= XFRM_GSO_SEGMENT;
226228

net/ipv6/esp6_offload.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,11 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb,
254254
skb->encap_hdr_csum = 1;
255255

256256
if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev)
257-
esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK);
257+
esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK |
258+
NETIF_F_SCTP_CRC);
258259
else if (!(features & NETIF_F_HW_ESP_TX_CSUM))
259-
esp_features = features & ~NETIF_F_CSUM_MASK;
260+
esp_features = features & ~(NETIF_F_CSUM_MASK |
261+
NETIF_F_SCTP_CRC);
260262

261263
xo->flags |= XFRM_GSO_SEGMENT;
262264

0 commit comments

Comments
 (0)