From patchwork Thu Jun 12 06:17:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenweilong X-Patchwork-Id: 359017 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D6ACC140081 for ; Thu, 12 Jun 2014 16:19:01 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752954AbaFLGS5 (ORCPT ); Thu, 12 Jun 2014 02:18:57 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:5083 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbaFLGS4 (ORCPT ); Thu, 12 Jun 2014 02:18:56 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BWS68787; Thu, 12 Jun 2014 14:18:18 +0800 (CST) Received: from SZXEML402-HUB.china.huawei.com (10.82.67.32) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 12 Jun 2014 14:17:44 +0800 Received: from localhost (10.177.37.162) by szxeml402-hub.china.huawei.com (10.82.67.32) with Microsoft SMTP Server id 14.3.158.1; Thu, 12 Jun 2014 14:17:38 +0800 From: Chen Weilong To: , , , , CC: , Weilong Chen Subject: [request for stable inclusion] ipv6: reallocate addrconf router for ipv6 address when lo device up Date: Thu, 12 Jun 2014 14:17:31 +0800 Message-ID: <1402553851-8944-1-git-send-email-chenweilong@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.37.162] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Weilong Chen "commit 33d99113b1102c2d2f8603b9ba72d89d915c13f5 ipv6: reallocate addrconf router for ipv6 address when lo device up." This commit don't have a stable tag, but it fix the bug no reply after loopback down-up.I think it should be applied to stable 3.4.x kernels. The bug is 67951 on bugzilla https://bugzilla.kernel.org/show_bug.cgi?id=67951 The patch can't be applied directly. And it used the function introduced by "commit 94e187c0" ip6_rt_put(), this patch can't be applied directly either. Signed-off-by: Weilong Chen --- include/net/ip6_fib.h | 9 +++++++++ net/ipv6/addrconf.c | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 0ae759a..7c17c35 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -171,6 +171,15 @@ static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) dst_hold(new); } +static inline void ip6_rt_put(struct rt6_info *rt) +{ + /* dst_release() accepts a NULL parameter. + * We rely on dst being first structure in struct rt6_info + */ + BUILD_BUG_ON(offsetof(struct rt6_info, dst) != 0); + dst_release(&rt->dst); +} + struct fib6_walker_t { struct list_head lh; struct fib6_node *root, *node; diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 9b8c3c6..00a0904 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2424,8 +2424,18 @@ static void init_loopback(struct net_device *dev) if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE)) continue; - if (sp_ifa->rt) - continue; + if (sp_ifa->rt) { + /* This dst has been added to garbage list when + * lo device down, release this obsolete dst and + * reallocate a new router for ifa. + */ + if (sp_ifa->rt->dst.obsolete > 0) { + ip6_rt_put(sp_ifa->rt); + sp_ifa->rt = NULL; + } else { + continue; + } + } sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);