Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3258901lfo; Mon, 23 May 2022 00:11:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZlUm+Ay641FRA79Uwp2xkz6PtJ01P/WiZB/wXVwiENuc98gVF4HrJlA0v3JxRBB4plCiT X-Received: by 2002:a17:902:ecd0:b0:161:9ccf:f3f4 with SMTP id a16-20020a170902ecd000b001619ccff3f4mr21441945plh.19.1653289873247; Mon, 23 May 2022 00:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653289873; cv=none; d=google.com; s=arc-20160816; b=EF7Z17lnIauB3s3PKMKeBIr1uQ3cP0xQ/ONlSWKPiOFSnUvgrnBtAQA9a91VJmgjZq iEYKWV5809FldZNnSKVcKo73PW6RMXsZzBVSwpMRKhTiDgJiGqwIfdyckZ/FzYSH5eOi CulTNadTpnFRGlihs8gw7Jyo2BNvSnb/7WwXtvldbVukbaEYqmJ6ERmgYRnGe4VkB8J1 gXLP824icDWa4b/HlWejC/qq+heFpuIOghO54CEaOMyNotUlhAIUGM++0Qj2RE5kiyit 8nDyxzRqmefDn8sgwsU9gTj1FzcDihjGIg8nSaq4h+RNqNEOM3a/bL7KXGSu0Dkka9/E WuOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vm+iy+NOIbMMRLLjKp5SRZvj7j/0bEsMLbF9xbtKOuU=; b=gQYiNWXRR3MGj1kcPi6h9jpghk1vXzsMD6ZcwEynaVhWY1iZCoEACnz5/AyDHEXPAk OLl6GLiJfiInjsS5D6agwO0m3BnGL/JMv1cYK428T0uG8H+H8nKAN2HbP4mvxPH/QvIB xpHJAxmiD26RsnOsbgt/oDzDrbz0GbDtUpc+8BF2CEOB1F5l7ucRQGulnsJaL2JAWO+o wS70h0ModV52Df9A5fwTW6TYS90vHVJKv28bjNg7KLKsTf2FB/UsI4nlBURhA7kB38nz 8kCAemnaOdB2Fl+vuHHJfiBk1HJJe97JDf7Hjl3NPMAghu4FxJgmzub2LkfCkge9MuQV H5lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DJVpep95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mi18-20020a17090b4b5200b001d8f3569fb9si15206097pjb.165.2022.05.23.00.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DJVpep95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8FF4C377EB; Sun, 22 May 2022 23:30:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348264AbiETKtI (ORCPT + 99 others); Fri, 20 May 2022 06:49:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbiETKtF (ORCPT ); Fri, 20 May 2022 06:49:05 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0355BE53; Fri, 20 May 2022 03:49:04 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id j24so10986890wrb.1; Fri, 20 May 2022 03:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vm+iy+NOIbMMRLLjKp5SRZvj7j/0bEsMLbF9xbtKOuU=; b=DJVpep95PDnmwOH6ep0mHZrxyIWYwVpeMszZ2/zMg2+bddK1SBiUg9+i5K7Euk9Bgw jSbNbNakj9Zy+VGnVBYJqnrr9GAsfPFHRlKCg54VxWkVqogrGaToQQafHFfuFUvbMhcP BFBwclCJq6DHLCCbkTaYId/a3uDEMDA/w0yfd2JIQwiJViY8XcDrjEEHF1o6HEZJADiB gmUigmnOp/qEV6GH9GRktysKVr1F/+9C/Ef039g6/kQKquiG19bhBRFMAStwtm6bpnoH 8uHh7HDOuYav6B4KixLBV/RUQ+rSK6JU55jJbZeoLW01t3Uy8uoMTrV922PXH8mr99Az nq8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vm+iy+NOIbMMRLLjKp5SRZvj7j/0bEsMLbF9xbtKOuU=; b=Bu7mvjtBWmoivFRxgb5XFemmWC1fNsEz0cRMQBOjzBIvUvzEEyWzYiW5jAPtcyW5r2 Zg0+7hyBG/UTu8/fQYhy3MLq/Dslj3mtmOERcTH+hGLrjd4yDbGzPSQYxTms49t1sgm+ mony2YxBV4kV/Tyy6n84SsT14hvdKbRB0CLuxluWEqzKQU1+dLi2tgyyGGwhk1yDdfWT RjtuEOxOtOtt4fzCdN81z9Kuzf6mFi0nVXn0CgpwFrXE3aGEpvUIILDRo3lvpfHPaifN GU38Amfq3vimMicIQJHwCy4sTXaB5iZACOIupNSbmPjY03s+0ILq+FtwVEauaH27E2D+ ZIlg== X-Gm-Message-State: AOAM531QkS8pN+ymKKI3f+wPwPjWpcJRsrPHGuV/d/+utBqU5KpHRAch e7cHK62RpvkGvRw4Ths0kao= X-Received: by 2002:adf:dccc:0:b0:20e:5930:9e85 with SMTP id x12-20020adfdccc000000b0020e59309e85mr7787867wrm.20.1653043742564; Fri, 20 May 2022 03:49:02 -0700 (PDT) Received: from jimi.localdomain ([213.57.189.88]) by smtp.gmail.com with ESMTPSA id o9-20020adf8b89000000b0020d0351dbb6sm2166876wra.80.2022.05.20.03.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 03:49:02 -0700 (PDT) From: Eyal Birger To: dsahern@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, yoshfuji@linux-ipv6.org, steffen.klassert@secunet.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nicolas.dichtel@6wind.com, shmulik.ladkani@gmail.com, Eyal Birger Subject: [PATCH ipsec-next] xfrm: no need to set DST_NOPOLICY in IPv4 Date: Fri, 20 May 2022 13:48:45 +0300 Message-Id: <20220520104845.2644470-1-eyal.birger@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a cleanup patch following commit e6175a2ed1f1 ("xfrm: fix "disable_policy" flag use when arriving from different devices") which made DST_NOPOLICY no longer be used for inbound policy checks. On outbound the flag was set, but never used. As such, avoid setting it altogether and remove the nopolicy argument from rt_dst_alloc(). Signed-off-by: Eyal Birger --- This patch assumes ipsec-next is aligned with net-next and commit e6175a2ed1f1 is already merged. --- drivers/net/vrf.c | 2 +- include/net/route.h | 3 +-- net/ipv4/route.c | 24 ++++++++---------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index cfc30ce4c6e1..3c99de582c09 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -1077,7 +1077,7 @@ static int vrf_rtable_create(struct net_device *dev) return -ENOMEM; /* create a dst for routing packets out through a VRF device */ - rth = rt_dst_alloc(dev, 0, RTN_UNICAST, 1, 1); + rth = rt_dst_alloc(dev, 0, RTN_UNICAST, 1); if (!rth) return -ENOMEM; diff --git a/include/net/route.h b/include/net/route.h index 991a3985712d..b6743ff88e30 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -244,8 +244,7 @@ void ip_rt_multicast_event(struct in_device *); int ip_rt_ioctl(struct net *, unsigned int cmd, struct rtentry *rt); void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); struct rtable *rt_dst_alloc(struct net_device *dev, - unsigned int flags, u16 type, - bool nopolicy, bool noxfrm); + unsigned int flags, u16 type, bool noxfrm); struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt); struct in_ifaddr; diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 356f535f3443..d990bb3b1587 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1627,12 +1627,11 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr, struct rtable *rt_dst_alloc(struct net_device *dev, unsigned int flags, u16 type, - bool nopolicy, bool noxfrm) + bool noxfrm) { struct rtable *rt; rt = dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK, - (nopolicy ? DST_NOPOLICY : 0) | (noxfrm ? DST_NOXFRM : 0)); if (rt) { @@ -1727,7 +1726,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, struct in_device *in_dev = __in_dev_get_rcu(dev); unsigned int flags = RTCF_MULTICAST; struct rtable *rth; - bool no_policy; u32 itag = 0; int err; @@ -1738,12 +1736,11 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, if (our) flags |= RTCF_LOCAL; - no_policy = IN_DEV_ORCONF(in_dev, NOPOLICY); - if (no_policy) + if (IN_DEV_ORCONF(in_dev, NOPOLICY)) IPCB(skb)->flags |= IPSKB_NOPOLICY; rth = rt_dst_alloc(dev_net(dev)->loopback_dev, flags, RTN_MULTICAST, - no_policy, false); + false); if (!rth) return -ENOBUFS; @@ -1802,7 +1799,7 @@ static int __mkroute_input(struct sk_buff *skb, struct rtable *rth; int err; struct in_device *out_dev; - bool do_cache, no_policy; + bool do_cache; u32 itag = 0; /* get a working reference to the output device */ @@ -1847,8 +1844,7 @@ static int __mkroute_input(struct sk_buff *skb, } } - no_policy = IN_DEV_ORCONF(in_dev, NOPOLICY); - if (no_policy) + if (IN_DEV_ORCONF(in_dev, NOPOLICY)) IPCB(skb)->flags |= IPSKB_NOPOLICY; fnhe = find_exception(nhc, daddr); @@ -1863,7 +1859,7 @@ static int __mkroute_input(struct sk_buff *skb, } } - rth = rt_dst_alloc(out_dev->dev, 0, res->type, no_policy, + rth = rt_dst_alloc(out_dev->dev, 0, res->type, IN_DEV_ORCONF(out_dev, NOXFRM)); if (!rth) { err = -ENOBUFS; @@ -2238,7 +2234,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, struct rtable *rth; struct flowi4 fl4; bool do_cache = true; - bool no_policy; /* IP on this device is disabled. */ @@ -2357,8 +2352,7 @@ out: return err; RT_CACHE_STAT_INC(in_brd); local_input: - no_policy = IN_DEV_ORCONF(in_dev, NOPOLICY); - if (no_policy) + if (IN_DEV_ORCONF(in_dev, NOPOLICY)) IPCB(skb)->flags |= IPSKB_NOPOLICY; do_cache &= res->fi && !itag; @@ -2374,8 +2368,7 @@ out: return err; } rth = rt_dst_alloc(ip_rt_get_dev(net, res), - flags | RTCF_LOCAL, res->type, - no_policy, false); + flags | RTCF_LOCAL, res->type, false); if (!rth) goto e_nobufs; @@ -2598,7 +2591,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res, add: rth = rt_dst_alloc(dev_out, flags, type, - IN_DEV_ORCONF(in_dev, NOPOLICY), IN_DEV_ORCONF(in_dev, NOXFRM)); if (!rth) return ERR_PTR(-ENOBUFS); -- 2.34.1