From patchwork Fri Jun 14 02:06:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao feng X-Patchwork-Id: 251203 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 C3D2B2C007A for ; Fri, 14 Jun 2013 12:05:24 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759526Ab3FNCFS (ORCPT ); Thu, 13 Jun 2013 22:05:18 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:55822 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1758933Ab3FNCFN (ORCPT ); Thu, 13 Jun 2013 22:05:13 -0400 X-IronPort-AV: E=Sophos;i="4.87,863,1363104000"; d="scan'208";a="7542302" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 14 Jun 2013 10:02:17 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r5E25A3F006673; Fri, 14 Jun 2013 10:05:10 +0800 Received: from Donkey-I5.fnst.cn.fujitsu.com ([10.167.233.32]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013061410031477-2116472 ; Fri, 14 Jun 2013 10:03:14 +0800 From: Gao feng To: davem@davemloft.net Cc: ebiederm@xmission.com, netdev@vger.kernel.org, Gao feng Subject: [PATCH v2 2/4] neigh: only allow init_net to change the default neigh_parms Date: Fri, 14 Jun 2013 10:06:45 +0800 Message-Id: <1371175607-1405-2-git-send-email-gaofeng@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371175607-1405-1-git-send-email-gaofeng@cn.fujitsu.com> References: <1371175607-1405-1-git-send-email-gaofeng@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/06/14 10:03:14, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/06/14 10:03:15, Serialize complete at 2013/06/14 10:03:15 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Though we don't export the /proc/sys/net/ipv[4,6]/neigh/default/ directory to the un-init_net, but we can still use cmd such as "ip ntable change name arp_cache locktime 129" to change the locktime of default neigh_parms. This patch disallows the un-init_net to find out the neigh_table.parms. So the un-init_net will failed to influence the init_net. Signed-off-by: Gao feng --- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 62d9757..2ec1faf 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1419,7 +1419,7 @@ static inline struct neigh_parms *lookup_neigh_parms(struct neigh_table *tbl, for (p = &tbl->parms; p; p = p->next) { if ((p->dev && p->dev->ifindex == ifindex && net_eq(neigh_parms_net(p), net)) || - (!p->dev && !ifindex)) + (!p->dev && !ifindex && net_eq(net, &init_net))) return p; }