Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5477788pxb; Sun, 13 Feb 2022 23:16:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJya+jbP4ysAI1pcldpg9KC06JQz3HqcJW14D0gUgJvIuUxfqB4LvWzJOj4bd5fUSETSfOel X-Received: by 2002:a05:6402:5285:: with SMTP id en5mr13886088edb.108.1644822966268; Sun, 13 Feb 2022 23:16:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644822966; cv=none; d=google.com; s=arc-20160816; b=lgn5a9b5qG6srw2TFnD7qPE6u5ATmgH1gFPTBJVC5mFZwr1cvF8UwqYdnUQ0I2MVWT KGwMtNz+n2DMc37AFqdzYlJrtilkuV9MowZw4sxpwUcgE5eO+Z4UauY+XAKL2+0Cgwm1 9ixhU4beoW2QRZgNtd5yCgKTBWZj3zvzH8hYFXFLv2qzT6Jqeug9Ur+YjIssJxweWQ4U UmTybTtNcIa/np/IAqYLT+NYnGDAJOvrcgmSYbf19aLIhBsVGi4kI116l22+ojeirBUO qcii5yxIov5NA4kI0zpzWpsTGQHBqKZxBEMal6WUx5C0/lqJYKk5CX12883xjBKn4BmU u1eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=NOzDmcE1Sa588Xl3OqxRJwxc5/mGH6LBb9B7+fXMrhY=; b=HlgFaDltbZ1ygrnB87l3IcU9ajRreziTyDRvuQtKoqq08IQI5ZSyLd7isvIglwdqJO uSx+eAS/W8U21Gvm2dkVOirxJ9vNd5TEL4ngg0MPK4d94fm8Ao36MB3mMejgqYI/cHwE VDWk5xa4gj+5UcGxYjq0+7syl0u78/lKDqsFuvWoyB67q+144zcDXN4bkyX6+xN6jc+H ygkNT19JBBV+cnISiklhZ5bdumJVTFBcpf8htj57SeiYPwjjttfx00JmTTot2DYwAads cSUo/7WMTj9ptRYyln81KX+kStZa4l4TGziDw2x3HtSrhuqG6bYyqKuiJJagWSLo2TNy Ultw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2si2622475ejf.632.2022.02.13.23.15.43; Sun, 13 Feb 2022 23:16:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236687AbiBMPKo (ORCPT + 99 others); Sun, 13 Feb 2022 10:10:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236678AbiBMPKn (ORCPT ); Sun, 13 Feb 2022 10:10:43 -0500 X-Greylist: delayed 474 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 13 Feb 2022 07:10:35 PST Received: from mail-m2458.qiye.163.com (mail-m2458.qiye.163.com [220.194.24.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8155BD0D; Sun, 13 Feb 2022 07:10:35 -0800 (PST) Received: from localhost.localdomain (unknown [124.126.138.100]) by mail-m2458.qiye.163.com (Hmail) with ESMTPA id C67C67400FC; Sun, 13 Feb 2022 23:02:37 +0800 (CST) From: Tao Liu To: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org, edumazet@google.com, sridhar.samudrala@intel.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Tao Liu Subject: [PATCH] gso: do not skip outer ip header in case of ipip and net_failover Date: Sun, 13 Feb 2022 23:02:34 +0800 Message-Id: <20220213150234.31602-1-thomas.liu@ucloud.cn> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUlCN1dZLVlBSVdZDwkaFQgSH1lBWRlNSktWGU0dH0gYHU5MTk 8YVRkRExYaEhckFA4PWVdZFhoPEhUdFFlBWVVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6P1E6FAw5KjIxTgsDGgM3NAxO FB5PCwhVSlVKTU9PTE1PTk5DS09IVTMWGhIXVQ8TFBYaCFUXEg47DhgXFA4fVRgVRVlXWRILWUFZ SklPVUpJTVVKSENVSktLWVdZCAFZQUhNTkk3Bg++ X-HM-Tid: 0a7ef39b722f8c17kuqtc67c67400fc X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We encouter a tcp drop issue in our cloud environment. Packet GROed in host forwards to a VM virtio_net nic with net_failover enabled. VM acts as a IPVS LB with ipip encapsulation. The full path like: host gro -> vm virtio_net rx -> net_failover rx -> ipvs fullnat -> ipip encap -> net_failover tx -> virtio_net tx When net_failover transmits a ipip pkt (gso_type = 0x0103), there is no gso performed because it supports TSO and GSO_IPXIP4. But network_header has been pointing to inner ip header. Call Trace: tcp4_gso_segment ------> return NULL inet_gso_segment ------> inner iph, network_header points to ipip_gso_segment inet_gso_segment ------> outer iph skb_mac_gso_segment Afterwards virtio_net transmits the pkt, only inner ip header is modified. And the outer one just keeps untouched. The pkt will be dropped in remote host. So we need to reset network header if there is no gso performed in net_failover. Call Trace: inet_gso_segment ------> inner iph, outer iph is skipped skb_mac_gso_segment __skb_gso_segment validate_xmit_skb validate_xmit_skb_list sch_direct_xmit __qdisc_run __dev_queue_xmit ------> virtio_net dev_hard_start_xmit __dev_queue_xmit ------> net_failover ip_finish_output2 ip_output iptunnel_xmit ip_tunnel_xmit ipip_tunnel_xmit ------> ipip dev_hard_start_xmit __dev_queue_xmit ip_finish_output2 ip_output ip_forward ip_rcv __netif_receive_skb_one_core netif_receive_skb_internal napi_gro_receive receive_buf virtnet_poll net_rx_action Fixes: cb32f511a70b ("ipip: add GSO/TSO support") Fixes: cfc80d9a1163 ("net: Introduce net_failover driver") Signed-off-by: Tao Liu --- net/ipv4/af_inet.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 9c465ba..f8b3f8a 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1425,10 +1425,18 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, static struct sk_buff *ipip_gso_segment(struct sk_buff *skb, netdev_features_t features) { + struct sk_buff *segs; + int nhoff; + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_IPXIP4)) return ERR_PTR(-EINVAL); - return inet_gso_segment(skb, features); + nhoff = skb_network_header(skb) - skb_mac_header(skb); + segs = inet_gso_segment(skb, features); + if (!segs) + skb->network_header = skb_mac_header(skb) + nhoff - skb->head; + + return segs; } struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb) -- 1.8.3.1