From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin KaFai Lau Subject: [RFC PATCH net-next 06/10] ipv6: Avoid deleting RTF_CACHE route from ip6_route_del() Date: Fri, 10 Apr 2015 18:59:32 -0700 Message-ID: <1428717576-1040383-7-git-send-email-kafai@fb.com> References: <1428717576-1040383-1-git-send-email-kafai@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Hannes Frederic Sowa , To: Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:7159 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755237AbbDKB7u (ORCPT ); Fri, 10 Apr 2015 21:59:50 -0400 Received: from pps.filterd (m0004077 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t3B1sh8J011860 for ; Fri, 10 Apr 2015 18:59:50 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1tpt9t80gd-5 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 10 Apr 2015 18:59:49 -0700 Received: from facebook.com (2401:db00:20:7029:face:0:33:0) by mx-out.facebook.com (10.212.232.63) with ESMTP id 6d932bbadfee11e48ed50002c992ebde-7ecd12c0 for ; Fri, 10 Apr 2015 18:59:46 -0700 In-Reply-To: <1428717576-1040383-1-git-send-email-kafai@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: Before patch 'Allow pmtu update on /128 via gateway route', RTF_CACHE route was not created for DST_HOST. It also requires changes on both delete code path and rt6_select() code patch. This patch fixes the delete code path to avoid deleting the RTF_CACHE route by 'ip -6 r del...' Signed-off-by: Martin KaFai Lau Reviewed-by: Hannes Frederic Sowa --- net/ipv6/route.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 75f3b5d..5d0fd6c 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1780,6 +1780,9 @@ static int ip6_route_del(struct fib6_config *cfg) if (fn) { for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) { + if ((rt->rt6i_flags & RTF_CACHE) && + !(cfg->fc_flags & RTF_CACHE)) + continue; if (cfg->fc_ifindex && (!rt->dst.dev || rt->dst.dev->ifindex != cfg->fc_ifindex)) @@ -2424,6 +2427,9 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, if (rtm->rtm_type == RTN_LOCAL) cfg->fc_flags |= RTF_LOCAL; + if (rtm->rtm_flags & RTM_F_CLONED) + cfg->fc_flags |= RTF_CACHE; + cfg->fc_nlinfo.portid = NETLINK_CB(skb).portid; cfg->fc_nlinfo.nlh = nlh; cfg->fc_nlinfo.nl_net = sock_net(skb->sk); -- 1.8.1