Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2409282ybd; Thu, 27 Jun 2019 11:49:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxm14rBLU3nMI6MpclKGN6OIvlqL8PQlzUL24OF/pP/q1HH5wG4WkB070dkXhFpnYqFG0jV X-Received: by 2002:a17:90a:fa07:: with SMTP id cm7mr7578573pjb.138.1561661375049; Thu, 27 Jun 2019 11:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561661375; cv=none; d=google.com; s=arc-20160816; b=TF6X5ic8rpOHqzJsZEEqDypOCRLge3oWgQH98sPesyP/lfDFjN4yJHv1C6mT3xpKeU nK/qZ7taydsOd2mt/ZWZh32tOEm1bMcjCh/Mjvlp1PxBG6IS+5B5r9ckPYixGqKkhxc5 z+sFDPIe7LNfJ3Cnh6CFNWl1DfyM17YuygYKns8I2zXUGLEhIo1LhCS7rmVErFkm2hIX L3iUGXbmag2e6A9oADm7REkUu2+JBq1Z1DYPHU1TmE3ANpaMW3d4nMWkHAbeUSBWyXsv z2fHqjT1oynB0HFaqj3FaqwbE3vw4oyCoNGgPoWOamGfgWFhOsD9ACruCQYvBsvFfnsl bY8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=fV91UIhs/aP2x0zfaGG3YKp4m5pyTbUcnCRK9nZotnk=; b=h4k9+1+faNL6um+OInKSQBCipdi6SY4U2buBCOaA5r2tX+sCksl5Bv51xomTZ7BKNW U2mqVXSUJgT0050O2syfNQf2GVu6MMU/RTZPNrG7Q/Nj+MDfy7dqWFS0Bz2cARGxGIqx 1Gm4KNEJFFjhPd4WZNNLas/SKzM5f6Ebd3EoBzuaHUMDdBt5qlPx/zt0u462p6+sz8ux wyULWapr5N+OKuldAJqufkFU+ilIpnKBbyZnifapZjuJQ6/7J8dst/qCNKCKH+4Xp5gd UVxjOHctKv1wCeZVbG27dT8eiABoWSNvXHUjccu3aXgRb+5on3mMF6AwOqkcUsdyt4xW aVxw== 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 y10si2965171plp.117.2019.06.27.11.49.17; Thu, 27 Jun 2019 11:49:35 -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 S1726566AbfF0StJ (ORCPT + 99 others); Thu, 27 Jun 2019 14:49:09 -0400 Received: from mail.us.es ([193.147.175.20]:46990 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbfF0StJ (ORCPT ); Thu, 27 Jun 2019 14:49:09 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 74D8CEA460 for ; Thu, 27 Jun 2019 20:49:07 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 64DD5DA732 for ; Thu, 27 Jun 2019 20:49:07 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 5A4211021A4; Thu, 27 Jun 2019 20:49:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 12F28DA7B6; Thu, 27 Jun 2019 20:49:04 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Thu, 27 Jun 2019 20:49:04 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from us.es (sys.soleta.eu [212.170.55.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 1984lsi) by entrada.int (Postfix) with ESMTPSA id DE7B54265A31; Thu, 27 Jun 2019 20:49:03 +0200 (CEST) Date: Thu, 27 Jun 2019 20:49:03 +0200 X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: zhe.he@windriver.com Cc: kadlec@blackhole.kfki.hu, fw@strlen.de, davem@davemloft.net, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] netfilter: Fix remainder of pseudo-header protocol 0 Message-ID: <20190627184903.atdcwk4wnfaayyer@salvia> References: <1561346258-272481-1-git-send-email-zhe.he@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1561346258-272481-1-git-send-email-zhe.he@windriver.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 24, 2019 at 11:17:38AM +0800, zhe.he@windriver.com wrote: > From: He Zhe > > Since v5.1-rc1, some types of packets do not get unreachable reply with the > following iptables setting. Fox example, > > $ iptables -A INPUT -p icmp --icmp-type 8 -j REJECT > $ ping 127.0.0.1 -c 1 > PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. > — 127.0.0.1 ping statistics — > 1 packets transmitted, 0 received, 100% packet loss, time 0ms > > We should have got the following reply from command line, but we did not. > From 127.0.0.1 icmp_seq=1 Destination Port Unreachable > > Yi Zhao reported it and narrowed it down to: > 7fc38225363d ("netfilter: reject: skip csum verification for protocols that don't support it"), > > This is because nf_ip_checksum still expects pseudo-header protocol type 0 for > packets that are of neither TCP or UDP, and thus ICMP packets are mistakenly > treated as TCP/UDP. > > This patch corrects the conditions in nf_ip_checksum and all other places that > still call it with protocol 0. Looking at 7fc38225363dd8f19e667ad7c77b63bc4a5c065d, I wonder this can be fixed while simplifying it... I think nf_reject_verify_csum() is useless? In your patch, now you explicitly check for IPPROTO_TCP and IPPROTO_UDP to validate the checksum.