{"id":812745,"url":"http://patchwork.ozlabs.org/api/patches/812745/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1505209677-12728-2-git-send-email-yanhaishuang@cmss.chinamobile.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505209677-12728-2-git-send-email-yanhaishuang@cmss.chinamobile.com>","list_archive_url":null,"date":"2017-09-12T09:47:57","name":"[v4,2/2] ip6_tunnel: fix ip6 tunnel lookup in collect_md mode","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"289aa526ed0bd07ce85bd11a03a54aed2ae0fba2","submitter":{"id":68606,"url":"http://patchwork.ozlabs.org/api/people/68606/?format=json","name":"Haishuang Yan","email":"yanhaishuang@cmss.chinamobile.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1505209677-12728-2-git-send-email-yanhaishuang@cmss.chinamobile.com/mbox/","series":[{"id":2647,"url":"http://patchwork.ozlabs.org/api/series/2647/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=2647","date":"2017-09-12T09:47:57","name":"[v4,1/2] ip_tunnel: fix ip tunnel lookup in collect_md mode","version":4,"mbox":"http://patchwork.ozlabs.org/series/2647/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812745/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812745/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs0Nc5QT1z9ryk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 12 Sep 2017 19:48:32 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751493AbdILJsY (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 12 Sep 2017 05:48:24 -0400","from cmccmta1.chinamobile.com ([221.176.66.79]:57434 \"EHLO\n\tcmccmta1.chinamobile.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751326AbdILJsU (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 12 Sep 2017 05:48:20 -0400","from spf.mail.chinamobile.com (unknown[172.16.121.5]) by\n\trmmx-syy-dmz-app01-12001 (RichMail) with SMTP id\n\t2ee159b7ad62a57-13ab7; Tue, 12 Sep 2017 17:48:18 +0800 (CST)","from localhost (unknown[223.105.0.240])\n\tby rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id\n\t2ee359b7ad61196-6fbf2; Tue, 12 Sep 2017 17:48:18 +0800 (CST)"],"X-RM-TRANSID":["2ee159b7ad62a57-13ab7","2ee359b7ad61196-6fbf2"],"X-RM-SPAM-FLAG":"00000000","From":"Haishuang Yan <yanhaishuang@cmss.chinamobile.com>","To":"\"David S. Miller\" <davem@davemloft.net>,\n\tAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>,\n\tHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>","Cc":"netdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tHaishuang Yan <yanhaishuang@cmss.chinamobile.com>,\n\tAlexei Starovoitov <ast@fb.com>","Subject":"[PATCH v4 2/2] ip6_tunnel: fix ip6 tunnel lookup in collect_md mode","Date":"Tue, 12 Sep 2017 17:47:57 +0800","Message-Id":"<1505209677-12728-2-git-send-email-yanhaishuang@cmss.chinamobile.com>","X-Mailer":"git-send-email 1.8.3.1","In-Reply-To":"<1505209677-12728-1-git-send-email-yanhaishuang@cmss.chinamobile.com>","References":"<1505209677-12728-1-git-send-email-yanhaishuang@cmss.chinamobile.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"In collect_md mode, if the tun dev is down, it still can call\n__ip6_tnl_rcv to receive on packets, and the rx statistics increase\nimproperly.\n\nWhen the md tunnel is down, it's not neccessary to increase RX drops\nfor the tunnel device, packets would be recieved on fallback tunnel,\nand the RX drops on fallback device will be increased as expected.\n\nFixes: 8d79266bc48c (\"ip6_tunnel: add collect_md mode to IPv6 tunnels\")\nCc: Alexei Starovoitov <ast@fb.com>\nSigned-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>\n\n---\nChange since v4:\n  * Make the commit message more clearer\n  * Fix wrong recipient address\n---\n net/ipv6/ip6_tunnel.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c\nindex 10a693a..ae73164 100644\n--- a/net/ipv6/ip6_tunnel.c\n+++ b/net/ipv6/ip6_tunnel.c\n@@ -171,7 +171,7 @@ static struct net_device_stats *ip6_get_stats(struct net_device *dev)\n \t}\n \n \tt = rcu_dereference(ip6n->collect_md_tun);\n-\tif (t)\n+\tif (t && t->dev->flags & IFF_UP)\n \t\treturn t;\n \n \tt = rcu_dereference(ip6n->tnls_wc[0]);\n","prefixes":["v4","2/2"]}