From patchwork Thu Oct 15 23:39:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin KaFai Lau X-Patchwork-Id: 530986 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 4C59A1402DD for ; Fri, 16 Oct 2015 10:40:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=fb.com header.i=@fb.com header.b=jNjS0Mda; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753403AbbJOXke (ORCPT ); Thu, 15 Oct 2015 19:40:34 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:24161 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752294AbbJOXkb (ORCPT ); Thu, 15 Oct 2015 19:40:31 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id t9FNaoEX007258 for ; Thu, 15 Oct 2015 16:40:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=EazEkhatRkJ9ve5cH/ioHRRKKkJdRUcvnqKueqq028g=; b=jNjS0MdaaQlSQubKFNrQONnNm9D2pRKDmNou/I9b1Pi1t12t73/HIm0+QzrGSL4AS8nO W0ARJaQIvZwIznuur2S4gXC16rbdCGfpIZ/o0Uqby+/bQ0GNfNPnLI4ug7w96vEDe/Nc EoTlZSp0CXeV0PzivEfs/1K3Senmlisj3tA= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1xh6fqp228-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Thu, 15 Oct 2015 16:40:31 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB13.TheFacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 15 Oct 2015 16:40:29 -0700 Received: from facebook.com (2401:db00:11:d0a6:face:0:33:0) by mx-out.facebook.com (10.223.100.97) with ESMTP id 1e3268ec739611e5bbb824be0593f280-9a7fa230 for ; Thu, 15 Oct 2015 16:40:29 -0700 Received: by devbig298.prn1.facebook.com (Postfix, from userid 6611) id A93F349A1609; Thu, 15 Oct 2015 16:40:28 -0700 (PDT) From: Martin KaFai Lau To: netdev CC: Kernel Team , Hannes Frederic Sowa , Julian Anastasov , Phil Sutter , Steffen Klassert Subject: [PATCH net 1/2] ipv6: Move common init code for rt6_info to a new function rt6_info_init() Date: Thu, 15 Oct 2015 16:39:57 -0700 Message-ID: <1444952398-1505791-2-git-send-email-kafai@fb.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1444952398-1505791-1-git-send-email-kafai@fb.com> References: <1444952398-1505791-1-git-send-email-kafai@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-10-16_01:, , signatures=0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Introduce rt6_info_init() to do the common init work for 'struct rt6_info' (after calling dst_alloc). It is a prep work to fix the rt6_info init logic in the ip6_blackhole_route(). Signed-off-by: Martin KaFai Lau Cc: Hannes Frederic Sowa Cc: Julian Anastasov Cc: Phil Sutter Cc: Steffen Klassert --- net/ipv6/route.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ed04e29..4198017 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -319,6 +319,15 @@ static const struct rt6_info ip6_blk_hole_entry_template = { #endif +static void rt6_info_init(struct rt6_info *rt) +{ + struct dst_entry *dst = &rt->dst; + + memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); + INIT_LIST_HEAD(&rt->rt6i_siblings); + INIT_LIST_HEAD(&rt->rt6i_uncached); +} + /* allocate dst with ip6_dst_ops */ static struct rt6_info *__ip6_dst_alloc(struct net *net, struct net_device *dev, @@ -327,13 +336,9 @@ static struct rt6_info *__ip6_dst_alloc(struct net *net, struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, 0, DST_OBSOLETE_FORCE_CHK, flags); - if (rt) { - struct dst_entry *dst = &rt->dst; + if (rt) + rt6_info_init(rt); - memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); - INIT_LIST_HEAD(&rt->rt6i_siblings); - INIT_LIST_HEAD(&rt->rt6i_uncached); - } return rt; }