Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1373764ybh; Sun, 15 Mar 2020 01:26:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs+72v+60Ete/PnbRAIAQdbP6sdjPDytpCBpVaCDkNdxR32sBEJ6A7DP82S1c3VeA5ISKqU X-Received: by 2002:aca:57cd:: with SMTP id l196mr13549508oib.1.1584260804452; Sun, 15 Mar 2020 01:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584260804; cv=none; d=google.com; s=arc-20160816; b=ZMOlh4gAnhLZVzg8pU+57eeiypIsEKpXVdwJ3mFIMa7r7zvcGBhOoZPR7kLPGTPg3n r4WhpGA4pxIKDhXaxoF3o0dvPimWNHMaQOueq0J2pqwIsHw8GIOUN//8f5eRBiq4Bxak V9Tp8b59OdK3MNKcVtIyRPoyjlezR8PAD87MbE6w4J1aZHyUgCmVy3z695KK0qTpoI33 I/FLh7Ea7bdUeLJEEIZehTpaEMD+HaLNn/2cuIKhj3u5c2MpAOmrkgSN0TjrORaqdKUy QyE1S5oZjhcU6GvkcVuJvJbmIdzqK4M3Jqn4CX93ueHVEN+K7WuVjVPoXJmvyOkzYFo/ wTzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=UHxpCrPs+vhmMjjDI1wDwOGnqUaBu+JX4200vbVkSM0=; b=OYhPRmHLHWIaFEPj5wMGaFXUMIaK9pgRbQnl0ic1fm2XYcTb54vgPtNajkxQ+zjVnq xPJrgX0OipcB/FIaUJueWEiJHsHK+c+bgvJQ+jKvV+NUbYQPiTKimS39nxFCi5VSMiGj 7eHmxspIonW9Rgn2QFMsyU69EJvs+cvmWNpddBDO2Qu+vqUzelIl80xO3u/x5Lf02P3v OlgGOXi4dBW1VjOfzT3W9NeEoZW8of2EvLnqZFJd/vbtcJ+LNUYajWWUH7z7OtGc86Vb ZbYzfvMQReOf1cdZksiS4JwcTk2/s13E2Qo15AS1pHgR4902BJzN5pygJQ1ZXbfJce3L UokQ== 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 y65si7290970oie.92.2020.03.15.01.26.32; Sun, 15 Mar 2020 01:26:44 -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 S1727860AbgCOI0O (ORCPT + 99 others); Sun, 15 Mar 2020 04:26:14 -0400 Received: from ja.ssi.bg ([178.16.129.10]:44374 "EHLO ja.ssi.bg" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727646AbgCOI0O (ORCPT ); Sun, 15 Mar 2020 04:26:14 -0400 X-Greylist: delayed 504 seconds by postgrey-1.27 at vger.kernel.org; Sun, 15 Mar 2020 04:26:13 EDT Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by ja.ssi.bg (8.15.2/8.15.2) with ESMTP id 02F8HNco007937; Sun, 15 Mar 2020 10:17:23 +0200 Date: Sun, 15 Mar 2020 10:17:23 +0200 (EET) From: Julian Anastasov To: Haishuang Yan 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 Subject: Re: [PATCH] ipvs: optimize tunnel dumps for icmp errors In-Reply-To: <1584253087-8316-1-git-send-email-yanhaishuang@cmss.chinamobile.com> Message-ID: References: <1584253087-8316-1-git-send-email-yanhaishuang@cmss.chinamobile.com> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > + &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, mtu); Regards -- Julian Anastasov