Received: by 10.223.164.202 with SMTP id h10csp218066wrb; Mon, 13 Nov 2017 05:27:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMYrhmF3xW2S9caZ6f2LRVwNmCS//ZYjqcE0VVW7XYgb9xS+fsdwFHNuBOFguMfPHds3EShj X-Received: by 10.98.211.153 with SMTP id z25mr9847863pfk.61.1510579632046; Mon, 13 Nov 2017 05:27:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510579632; cv=none; d=google.com; s=arc-20160816; b=uN77RzECUJbeN65iFrl4h7ChJGAikNBosgNIbeYlDmOfEHOyoCj5pjrwnEuBDayoBn 3BHmwjctXtKKUeDlalep1lrjsyUrCbjnhLqUouazCqztQ7i9UNKzmmYZdPveJwEQl5d1 kKM3DAU19oCGeRtcxaSZxNwIpxgev0wVKEAutWS/voJYAUeYTpHCVIMERGtcaGkT/jXZ uPhoVKELpYI6AGWWtE/tHEjYgRL/bW8DjMmdpxRvclpY+NQRVp+0Ymo/43Tx3R28EdmA F8M3DEB6t8m1i6ZaePMwOksQSzX/dhuiZiNwRdVZiWJ83PwrvPbgNffVr+JIhpOBiKZA b3MA== 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 :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=q3Nmfdiqi41r5rcU3GJ9Jdt1X9V7C5BJfFZOfSlYnrU=; b=p0H4wbRYlel1p+Ug0jLl5St+QfFmkc8UY0sJbq1x7duuIhO4c3t0Mqf5zBHtGjsTtg usS6y4ClR0dPUfaHYAkpEy6x2J5cFC+tkSDCKYbpj0Kbe+4Q0q1dbvR4iXH8eqJLZPDW eEHlBKBSHmYD+oMCgQXJcvQvp2RmE3KIDLiJQtfaC0fThLFLRrJGqw8DbAdMiNilssjH 6zFWcrBtCBd2IaO882pqEgVfjUODbCZn6fuJnxZ1VmikXFJoRQIwzvW5FEuw42W1TySu TnmfF3I087opCL6K7HawBbW4qQ57d1PUCdU9cOj3wWWi0lZYOjKD8L5IeC3wlWV5gJOv ta3A== 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 17si2423427pfh.401.2017.11.13.05.26.58; Mon, 13 Nov 2017 05:27:12 -0800 (PST) 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 S1754328AbdKMNA2 (ORCPT + 95 others); Mon, 13 Nov 2017 08:00:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:49970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754305AbdKMNA0 (ORCPT ); Mon, 13 Nov 2017 08:00:26 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 80129AA5; Mon, 13 Nov 2017 13:00:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liping Zhang , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.9 31/87] netfilter: nft_meta: deal with PACKET_LOOPBACK in netdev family Date: Mon, 13 Nov 2017 13:55:48 +0100 Message-Id: <20171113125618.176887504@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Liping Zhang [ Upstream commit f169fd695b192dd7b23aff8e69d25a1bc881bbfa ] After adding the following nft rule, then ping 224.0.0.1: # nft add rule netdev t c pkttype host counter The warning complain message will be printed out again and again: WARNING: CPU: 0 PID: 10182 at net/netfilter/nft_meta.c:163 \ nft_meta_get_eval+0x3fe/0x460 [nft_meta] [...] Call Trace: dump_stack+0x85/0xc2 __warn+0xcb/0xf0 warn_slowpath_null+0x1d/0x20 nft_meta_get_eval+0x3fe/0x460 [nft_meta] nft_do_chain+0xff/0x5e0 [nf_tables] So we should deal with PACKET_LOOPBACK in netdev family too. For ipv4, convert it to PACKET_BROADCAST/MULTICAST according to the destination address's type; For ipv6, convert it to PACKET_MULTICAST directly. Signed-off-by: Liping Zhang Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_meta.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) --- a/net/netfilter/nft_meta.c +++ b/net/netfilter/nft_meta.c @@ -159,8 +159,34 @@ void nft_meta_get_eval(const struct nft_ else *dest = PACKET_BROADCAST; break; + case NFPROTO_NETDEV: + switch (skb->protocol) { + case htons(ETH_P_IP): { + int noff = skb_network_offset(skb); + struct iphdr *iph, _iph; + + iph = skb_header_pointer(skb, noff, + sizeof(_iph), &_iph); + if (!iph) + goto err; + + if (ipv4_is_multicast(iph->daddr)) + *dest = PACKET_MULTICAST; + else + *dest = PACKET_BROADCAST; + + break; + } + case htons(ETH_P_IPV6): + *dest = PACKET_MULTICAST; + break; + default: + WARN_ON_ONCE(1); + goto err; + } + break; default: - WARN_ON(1); + WARN_ON_ONCE(1); goto err; } break; From 1584114216802032024@xxx Wed Nov 15 06:57:22 +0000 2017 X-GM-THRID: 1584109318745003306 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread