Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1480261ybh; Sun, 15 Mar 2020 04:02:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuuzLQ9R8y9btBrH/04bjauZtu+sx8+McUNDLCmdvsJ4ohw2psHP1tkpmqI1vlgzEIqf1nw X-Received: by 2002:a54:4099:: with SMTP id i25mr473437oii.175.1584270147419; Sun, 15 Mar 2020 04:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584270147; cv=none; d=google.com; s=arc-20160816; b=YURn+Xyot+69CRSDhtUYyuXyFAyR0TTgo3mMAsnLTCTDi3ltROM7MyLIOApG/0pirk Adlko+hYwPOYm87FV7qCwFoxdns5NqIu7jm+pGEY1eO3E4hBo9XnE6ey7shKQxXo+U4h XME0EmcbtqFZ1C8Bm8sdFaELCE2vUri8pAXn/HG6I/tXg/vc7EVn/j2EmD2HGQQavv9O bzUrJggbShb0d2/FMm8ACnFAycQXzsAYl/GQb7zh6Rhe6AUqqLcik4D+rMo0wlpcgnnU NIEmnq2XS7Bblj+P8a5YN9f715Mojq+oKWoyu6gwd14dWvyrpf1dzPTtCJ2cCJ9R/8HK eghg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=N2kTRo0cAjZS3iXV7JRY4YHuBVu8GhTuPzmRGZPb2Ko=; b=ri3+x+7+Acah3KdL2qAIcSmu/hw24NrY9SFIMISw81jtm8kxr7twyhWEcwL8E9c8gM EutYuXacEovFB4sdYL3F3GawBlazdre34XtzmFWErnbDK+gt3e5Dw3saU1S1Le4x7zPi cegMqdVXDVvl+IfGeMMJlKH8b9NOR7kI5XEXaq/PuXBdZ4Pi7zGjk12u82IcyZjeyEbM Uahmuys7S1VCOmmItIOvHG4IlW65gcq4+CapnN7Hh/flm5QD8adLBKaczgi/3hMUS6x5 c/6HNyr3RiFgmwIOVmEHf688/8tcbQcJkEbxPkUy/BP1MNl+CYMrYvniw25olt4YbFZa V1SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si7462454ois.29.2020.03.15.04.02.14; Sun, 15 Mar 2020 04:02:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728341AbgCOLB5 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 15 Mar 2020 07:01:57 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:9059 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728234AbgCOLB5 (ORCPT ); Sun, 15 Mar 2020 07:01:57 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.9]) by rmmx-syy-dmz-app12-12012 (RichMail) with SMTP id 2eec5e6e0b0862b-c9319; Sun, 15 Mar 2020 19:01:28 +0800 (CST) X-RM-TRANSID: 2eec5e6e0b0862b-c9319 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from [10.0.0.249] (unknown[112.0.145.8]) by rmsmtp-syy-appsvr05-12005 (RichMail) with SMTP id 2ee55e6e0b07b40-1577c; Sun, 15 Mar 2020 19:01:28 +0800 (CST) X-RM-TRANSID: 2ee55e6e0b07b40-1577c Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH] ipvs: optimize tunnel dumps for icmp errors From: Haishuang Yan In-Reply-To: Date: Sun, 15 Mar 2020 19:01:26 +0800 Cc: Simon Horman , Pablo Neira Ayuso , netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <1584253087-8316-1-git-send-email-yanhaishuang@cmss.chinamobile.com> To: Julian Anastasov X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 2020??3??15??, at ????4:17, Julian Anastasov wrote: > > > Hello, > > On Sun, 15 Mar 2020, Haishuang Yan wrote: > >> After strip GRE/UDP tunnel header for icmp errors, it's better to show >> "ICMP for GRE/UDP" instead of "ICMP for IPIP" in debug message. >> >> Signed-off-by: Haishuang Yan >> --- >> net/netfilter/ipvs/ip_vs_core.c | 41 +++++++++++++++++++++++------------------ >> 1 file changed, 23 insertions(+), 18 deletions(-) >> >> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c >> index 512259f..f39ae6b 100644 >> --- a/net/netfilter/ipvs/ip_vs_core.c >> +++ b/net/netfilter/ipvs/ip_vs_core.c > >> @@ -1703,8 +1707,8 @@ static int ipvs_gre_decap(struct netns_ipvs *ipvs, struct sk_buff *skb, >> return NF_ACCEPT; /* The packet looks wrong, ignore */ >> raddr = (union nf_inet_addr *)&cih->daddr; >> >> - /* Special case for errors for IPIP packets */ >> - ipip = false; >> + /* Special case for errors for IPIP/UDP/GRE tunnel packets */ >> + tunnel = false; > > At this point it is safe to store cih->protocol in some new > var, eg. outer_proto... > >> @@ -1809,17 +1813,18 @@ static int ipvs_gre_decap(struct netns_ipvs *ipvs, struct sk_buff *skb, >> u32 mtu = ntohs(ic->un.frag.mtu); >> __be16 frag_off = cih->frag_off; >> >> - /* Strip outer IP and ICMP, go to IPIP header */ >> + /* Strip outer IP and ICMP, go to IPIP/UDP/GRE header */ >> if (pskb_pull(skb, ihl + sizeof(_icmph)) == NULL) >> - goto ignore_ipip; >> + goto ignore_tunnel; >> offset2 -= ihl + sizeof(_icmph); >> skb_reset_network_header(skb); >> - IP_VS_DBG(12, "ICMP for IPIP %pI4->%pI4: mtu=%u\n", >> - &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, mtu); >> + IP_VS_DBG(12, "ICMP for %s %pI4->%pI4: mtu=%u\n", >> + ip_vs_proto_name(cih->protocol), > > Because here cih points to the embedded UDP/TCP/SCTP IP header, so > we can not see GRE here. Or it is even better if we do not add more code > to ip_vs_proto_name(), just use char *outer_proto and assign it with > "IPIP" (where ipip was set) and "UDP"/"GRE" (where ulen was set) and print > outer_proto here. Yes, you??re right. I will send v2 commit according to your suggestion, thanks very much. > >> + &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, mtu); > > Regards > > -- > Julian Anastasov >