From patchwork Thu Oct 31 15:52:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13858129 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13A5C6A019 for ; Thu, 31 Oct 2024 15:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389965; cv=none; b=uMP5Kpc3sPIn27tc71LC898i2Z+NiNk3oAaA0HzqUWl3NfROT3ZW8a0awk/4kGkPNZc5LC625LtWBBy7Lk97P1rR1o03bXS1Ag/F1a0iLkO45sbWaEPtNcVeIwr4O989Jz2BnFlXDG9ox+15/XiTvM95bDNRLqXE9uUUtVr/gkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389965; c=relaxed/simple; bh=SH51NSo6hLlWLgHXnY5JBfRRWL4fJg1cmITcWVgxGYs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YO5vAb1h5oR/QXuavoti+y2TY3BPoOAqP4lfvzOMV2ZojlSdzFZuutSXLWgp6mJwWSdqE4RN3X50lbuIiQcI3iMrb9+sJSiIvN3PFuNvhX1PNMb33oh4E0TLD7RBsYVS2PyJ58BB7MxisLOme0miQA2ynrhHTCdFH0IrrwpyyNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Ec3j+rXg; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ec3j+rXg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730389961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8ejv1aLUSOfwGysIA9jTHFTpJtib9X7E8Le2y4iBvoQ=; b=Ec3j+rXg1DDOtVtQYuEaWlRb5sITGJyIt1uMf5a35MGbaUkZvYOcLVhjaSXRNJKWv+JqSk dN1vALOtYp0TEmEvdTQ/FJiL/MVyG9mocQWzxwL5PP1p6tK0MJvYtJJuezDVK2XvE7REY2 1b78YbS97oqCmWVfvEw8pU5P5fLGD5w= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-1raB9HH1PJaBcQdFp2qznA-1; Thu, 31 Oct 2024 11:52:40 -0400 X-MC-Unique: 1raB9HH1PJaBcQdFp2qznA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4316e2dde9eso9022615e9.2 for ; Thu, 31 Oct 2024 08:52:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730389959; x=1730994759; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8ejv1aLUSOfwGysIA9jTHFTpJtib9X7E8Le2y4iBvoQ=; b=hQV3UGMaGHqxwlSodZo94269HzRj1+7rvi6ST6F5cVUo8jh25SMwAoYxbI03qCuFTd toWLwluoa/2Oj+M4cyom2HhxXVgC8dtjY8viwNUljdieRqeQsQ5t6TxqxnAGJN1AJwaC Jukzgc3PTLoPbJ1K8vAvG5QNWyUz8bPGHyXKPc/TyntLuES6AuxrxKWFNYUq97EfabMu Bru13tVDH0ci0SRd4+UyN+fVCOu7P5UeywXksE8Ob2YTjzPMrJebyaol8sH505xFa6VP uRrXuQK6WQjCHEhZMcQC7owD9TlR7jHuv4ht5bPvnavaw7yzeovYiqcmadTpg8GD47+e EwPw== X-Gm-Message-State: AOJu0Yw/hyOw1XWnuwd+MhuVEtgPrInaUGxcJ2wZepfKQFCNo22guewm uwBS0eDyPUfzVEuRPEd18wlVPc+JRfnLqP6Z/dF8cpy/UXZPDCWoGZyXdSHvOsKGVO2O1Pd2uAf z3zN92u+MN5K0lSZXi3gEADDBmizX73WA7c2/ijG++/jWtA87b+vzMw== X-Received: by 2002:a05:6000:1867:b0:37d:5318:bf0a with SMTP id ffacd0b85a97d-381c7a46489mr456023f8f.1.1730389959246; Thu, 31 Oct 2024 08:52:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfGuerBc/ibv45+h3FVd1AJ5wWrpfNGR6Xm8sSUWtQe9Xc1VVsatB/cY4VRLU0ZB6DBComCA== X-Received: by 2002:a05:6000:1867:b0:37d:5318:bf0a with SMTP id ffacd0b85a97d-381c7a46489mr456005f8f.1.1730389958909; Thu, 31 Oct 2024 08:52:38 -0700 (PDT) Received: from debian (2a01cb058918ce002753490a7d66077e.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:2753:490a:7d66:77e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4327d698405sm32393315e9.41.2024.10.31.08.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 08:52:38 -0700 (PDT) Date: Thu, 31 Oct 2024 16:52:36 +0100 From: Guillaume Nault To: Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Simon Horman , David Ahern , Ido Schimmel , Eyal Birger Subject: [PATCH ipsec-next v2 1/4] xfrm: Convert xfrm_get_tos() to dscp_t. Message-ID: <5b34d13b962afc226c4ad1246ef57e502c047fab.1730387416.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Return a dscp_t variable to prepare for the future conversion of xfrm_bundle_create() to dscp_t. While there, rename the function "xfrm_get_dscp", to align its name with the new return type. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/xfrm/xfrm_policy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index a2ea9dbac90b..077e1c9b2025 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2576,10 +2576,10 @@ xfrm_tmpl_resolve(struct xfrm_policy **pols, int npols, const struct flowi *fl, } -static int xfrm_get_tos(const struct flowi *fl, int family) +static dscp_t xfrm_get_dscp(const struct flowi *fl, int family) { if (family == AF_INET) - return fl->u.ip4.flowi4_tos & INET_DSCP_MASK; + return inet_dsfield_to_dscp(fl->u.ip4.flowi4_tos); return 0; } @@ -2673,7 +2673,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, xfrm_flowi_addr_get(fl, &saddr, &daddr, family); - tos = xfrm_get_tos(fl, family); + tos = inet_dscp_to_dsfield(xfrm_get_dscp(fl, family)); dst_hold(dst); From patchwork Thu Oct 31 15:52:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13858130 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFF2E136664 for ; Thu, 31 Oct 2024 15:52:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389972; cv=none; b=QBtpF9PacHWih3VVxy7VFaNOd9UzC6guL8iLo+stP9JXKbSFltf9LBNWh6lhw9ztcnJSuUXIdoR/VIKv2xhbWAix4/+kFiX91zATiJs4NxJOdtdzmI+Kh774CE0GXgiIbkAp1X4QaEmqviFHS1kLD8ZhvrZeCknjLd0Nu3ZkRmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389972; c=relaxed/simple; bh=qSPrZ62DOpVQYFN4aRLbKmpOKm8H4jBLjkAX/sZjt88=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B7hSA793FHP70aBwtnQpjmF1/kh7M+qMPRfDTzTmlJEmVVijgWX1D0MNjTAjMhkQJk94q6XxDW5jCPFpyt82AfsM74AfTasoHYECD8f8H2iNuiCQjxr1Ko4N9Mlc72K0ExAYU50mW2eCi9QXPATPkLPzFsDOVs5y0txqMHgPClE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GqmRsM4K; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GqmRsM4K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730389969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7bEllOruw+nJ2hlVrPx0euQnj0LrVJdNE3PIAWDIu40=; b=GqmRsM4KT0DLGBHpq/PLUcUnOA4qfYh7+X50Wp77CJCoaCAQsC92XjlOW5he03A5iwTKB+ 6GMycVMV/0VR3bVIVNtM6ZlyVOyyp67z4MBbeWkFqKZjqmoEF1p6PweDgq8TxBHRGje2Ga HRq9Os3BW3ToHvGYNxqKQYxmfJ52mw4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-190-M9IKoLneMyiyGfhPTssyhA-1; Thu, 31 Oct 2024 11:52:48 -0400 X-MC-Unique: M9IKoLneMyiyGfhPTssyhA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-37d3e8dccc9so587506f8f.1 for ; Thu, 31 Oct 2024 08:52:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730389966; x=1730994766; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7bEllOruw+nJ2hlVrPx0euQnj0LrVJdNE3PIAWDIu40=; b=bndxK5BsYg3jPNL3LHmsomzVNMPYOPkZUYSZ4zDvze7CvNbGwPiwMRFJYtXuY3lmmE RSZAoFzAbnd5mlHlqI8vOPyb31dPs3JJRtncUon5Bhj6dq5LiEnvnz7Sez4cY5X/ms01 58xYheJkKnutwgHG8uEmIcTcgiDaobc84HqHVu3G/KIdAPjxIIwNFCxMnCZFJJizl3nY rMCC4SbWhAosjE3skHTIKi0yF5WspKgunWQkk/hHksMA9lMTUnR8wxfkwROp8M6ZVoLm RGSxN+appn1IA7/unQEYm0lZBN5crnASg3YNG/vbynN0tgdvwXSxIZzL3dKsqIOX4Kz8 o2qg== X-Gm-Message-State: AOJu0Yw8xa9fSF3+884oBzvE408s0/gw1e1kTKjJzdGRIcvWnY40SOpS RPmQAT3YXB6IenFCUao+Bg+S0WoQLD+dJHiA70qr9NZTEm5jQp6TeXHeZ+/tbHy3T0hQ6eHQzuB UONKkvl3YEKcoQw86D1rAxVy471l88zuYE3MSa3/trnoKHS9ORgnEO94cS8MVlw== X-Received: by 2002:a05:6000:1884:b0:37d:4dd5:220f with SMTP id ffacd0b85a97d-381be7d62ecmr2997937f8f.26.1730389966003; Thu, 31 Oct 2024 08:52:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUNCtDR9N2ADj3ZRsLkYxbo0wr+iTi58OMILgkstz5vR9tBaVrOit3fN8D3iT3YynhC0u85g== X-Received: by 2002:a05:6000:1884:b0:37d:4dd5:220f with SMTP id ffacd0b85a97d-381be7d62ecmr2997917f8f.26.1730389965560; Thu, 31 Oct 2024 08:52:45 -0700 (PDT) Received: from debian (2a01cb058918ce002753490a7d66077e.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:2753:490a:7d66:77e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7bf7sm2567556f8f.9.2024.10.31.08.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 08:52:45 -0700 (PDT) Date: Thu, 31 Oct 2024 16:52:43 +0100 From: Guillaume Nault To: Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Simon Horman , David Ahern , Ido Schimmel , Eyal Birger Subject: [PATCH ipsec-next v2 2/4] xfrm: Convert xfrm_bundle_create() to dscp_t. Message-ID: <4d3f3d32274bb4a652bd718f50f489aceb0c0405.1730387416.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Use a dscp_t variable to store the result of xfrm_get_dscp(). This prepares for the future conversion of xfrm_dst_lookup(). Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/xfrm/xfrm_policy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 077e1c9b2025..222410fa43e7 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2667,13 +2667,13 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, int header_len = 0; int nfheader_len = 0; int trailer_len = 0; - int tos; int family = policy->selector.family; xfrm_address_t saddr, daddr; + dscp_t dscp; xfrm_flowi_addr_get(fl, &saddr, &daddr, family); - tos = inet_dscp_to_dsfield(xfrm_get_dscp(fl, family)); + dscp = xfrm_get_dscp(fl, family); dst_hold(dst); @@ -2721,7 +2721,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, family = xfrm[i]->props.family; oif = fl->flowi_oif ? : fl->flowi_l3mdev; - dst = xfrm_dst_lookup(xfrm[i], tos, oif, + dst = xfrm_dst_lookup(xfrm[i], + inet_dscp_to_dsfield(dscp), oif, &saddr, &daddr, family, mark); err = PTR_ERR(dst); if (IS_ERR(dst)) From patchwork Thu Oct 31 15:52:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13858131 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 682721A265B for ; Thu, 31 Oct 2024 15:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389978; cv=none; b=WnjRb7CZug3cMGbWeUt60j6GlQw6nmxhK68qw9xNNyVGf5gAiCngaoVCLRFk7VoBDFLgFIjoevsgRGHdPHF0383SfwkiQ9MyWvmBWuJxDw2XCiZBzngZs937+nm04IVylEKedagF4I30nG1P4y8jni/g3nIdQoFNdq6q+IYDIaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389978; c=relaxed/simple; bh=s0LjKr2O3fNcL650wwfPcZip2r8/NFkj8iTeU93zdwQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p4X0662AYUuGwxv1pf1K2oJrB385idbcUWO0w72jXCoqOnL/MxBFH3FieLW4aCsdIizGJmp0titwmKvCXg8OL/UZk0i3c6c5NjSI+BJlmZq+HY9NJWjXdtXEBbp67lVhBmBehAHFycuk+tf1HUPTipaoEzAIaxd6Av86epTKQAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ajR945Qp; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ajR945Qp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730389975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/mhhX2jWVJfMOCuYXC4ZN+iHkyaB0OlM5THovFV3gFg=; b=ajR945QpVbiFT6QeFA/FxTM+x0lHJQ0SbJTtGEsN6ydGbOyH/ajFuDxypS/PoKkKAn7eB9 pQntfm0fv/GELnj0eR2tbjUpwPf/CLmne3/1vGnZbN0U9pxAmh9Wxm1QIYIA/atqS0vlLV xIsML75EFGNhF9ufWw8n8140tvxN5u4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-tWao877sM0aSx5uR0Yku3Q-1; Thu, 31 Oct 2024 11:52:53 -0400 X-MC-Unique: tWao877sM0aSx5uR0Yku3Q-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4316655b2f1so7960215e9.0 for ; Thu, 31 Oct 2024 08:52:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730389972; x=1730994772; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/mhhX2jWVJfMOCuYXC4ZN+iHkyaB0OlM5THovFV3gFg=; b=h37+gxFPLINVAt7QIrSBezyaoQk5b1kzbqkSWPEKEGmZ8kKmzPXCXrqiP/myc0LYG0 YaXwNLDLCJ6VtcX4whnQulCT19mtCwz4QuGkrwI7iqwN57qhOV0BAkJX43HzqELv6RaH qNBpbSDb0n3h+cFo4SSKHIPDnJmiBgPQ3+ad5lSYdXYBZtzE1pNbgmPdAcSw0giew+bN 1Tfdud0eqtTIo9l+oq3y2csH58LetOqsu8hUL5vY3TV0ucBlB0NyrsKOHn9eGRG3wgnT zA++xW0ZJeJlkIu9YXjqtNpEtTGoY5Bvr36UF4Rp4esqyraYUr5RWUzeIeLBHo7YYk4o cLRQ== X-Gm-Message-State: AOJu0YxV3g59ma8z2H3KeB5u+wBLLoABaBz7QrcntYDdQVv6bEWBwaTb qlN2hgb6SzLXuO5a0Bg7KcaLKoATZRy+SmS5VVzI19ULNRP+PdkGDbijuH+Ls5/l/VJBYzdSbMu LdOh7198ThwHsEnwSGbZExhGNO8d1Iv353GImI95mGQn5yi9BkgET8A== X-Received: by 2002:a05:600c:3514:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-4327b7ea586mr33440075e9.24.1730389972421; Thu, 31 Oct 2024 08:52:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEy/+hR95kc2lG+hGAyE8tGuv9KLn88Dic4HN0lvCvc5FJtUNU1no8tMoSTxmAqiMz6mv1zMg== X-Received: by 2002:a05:600c:3514:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-4327b7ea586mr33439875e9.24.1730389972090; Thu, 31 Oct 2024 08:52:52 -0700 (PDT) Received: from debian (2a01cb058918ce002753490a7d66077e.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:2753:490a:7d66:77e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd8e8466sm61537515e9.2.2024.10.31.08.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 08:52:51 -0700 (PDT) Date: Thu, 31 Oct 2024 16:52:49 +0100 From: Guillaume Nault To: Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Simon Horman , David Ahern , Ido Schimmel , Eyal Birger Subject: [PATCH ipsec-next v2 3/4] xfrm: Convert xfrm_dst_lookup() to dscp_t. Message-ID: <59943ded04c396d73b926ea1544c8e051aebe364.1730387416.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Pass a dscp_t variable to xfrm_dst_lookup(), instead of an int, to prevent accidental setting of ECN bits in ->flowi4_tos. Only xfrm_bundle_create() actually calls xfrm_dst_lookup(). Since it already has a dscp_t variable to pass as parameter, we only need to remove the inet_dscp_to_dsfield() conversion. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/xfrm/xfrm_policy.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 222410fa43e7..9e231c1ece3f 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -289,7 +289,7 @@ struct dst_entry *__xfrm_dst_lookup(int family, EXPORT_SYMBOL(__xfrm_dst_lookup); static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x, - int tos, int oif, + dscp_t dscp, int oif, xfrm_address_t *prev_saddr, xfrm_address_t *prev_daddr, int family, u32 mark) @@ -312,7 +312,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x, params.net = net; params.saddr = saddr; params.daddr = daddr; - params.tos = tos; + params.tos = inet_dscp_to_dsfield(dscp); params.oif = oif; params.mark = mark; params.ipproto = x->id.proto; @@ -2721,9 +2721,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, family = xfrm[i]->props.family; oif = fl->flowi_oif ? : fl->flowi_l3mdev; - dst = xfrm_dst_lookup(xfrm[i], - inet_dscp_to_dsfield(dscp), oif, - &saddr, &daddr, family, mark); + dst = xfrm_dst_lookup(xfrm[i], dscp, oif, &saddr, + &daddr, family, mark); err = PTR_ERR(dst); if (IS_ERR(dst)) goto put_states; From patchwork Thu Oct 31 15:52:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13858132 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD2D9137905 for ; Thu, 31 Oct 2024 15:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389985; cv=none; b=h9aaPy1E0POiZxkUwfLrsygg7nh1itDfAqfX0EPNz4ou7arqRc8NcppU8mdjZjilc2AoCO8A+DDBBJr4vAKFzOLR9LA2JwdkOYR1ELLzk7lHgQQrkohCbCbH3xA6oigjwUXBWuyBs5HKqpJw2gPdxCUjHzmFRjlwoSs5ZLxRzIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730389985; c=relaxed/simple; bh=OAWs+LgzczxS6iySJUfz/vQZHxno4osYUha0mn37+6I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tAzanpRfFGa1iV3EgiWY4mozD1DDrXt+rX4KvPIfp17ND6vt8hSBaZMt3kyH16EbjY2BUeMmuTkK0sULT7/nk703Nsba6ae7PoUtPkc9cpoyRPzudp7KtZAsxfXPbYxElISo/8U3dJf+c/SGQ8Z94ntB82CrJvgsQJm13jsavxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hMXkEbGm; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hMXkEbGm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730389982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rllN4UI447JTGvoLW+1vTEHQ3gJbfCMqlBAQAvzlylI=; b=hMXkEbGmg976uPnVH5AzIwVu9ktKIU4o02YKv4nnbJLvG3+nUukF1HeRu3dD8ojS6PNqdX /ycM6jSCLXAZ5xdMnc8Sr/572x8cVf77hM39dJodkitjEA3sJ6la4emoa2MTRXS/FWwDel yMJHrEKlRxob+4UytAq+SJ1ZqheGXvk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-zGvF8GxxPpuXDIp-gXwVsA-1; Thu, 31 Oct 2024 11:53:01 -0400 X-MC-Unique: zGvF8GxxPpuXDIp-gXwVsA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-431ad45828aso7238985e9.3 for ; Thu, 31 Oct 2024 08:53:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730389980; x=1730994780; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rllN4UI447JTGvoLW+1vTEHQ3gJbfCMqlBAQAvzlylI=; b=kHPkgjnKEyPS0u31ihGWDy+a5ScPN6CY8eynSlzu+efCokiVLK/Oh7j/QlJfO5reDV lVEhKf+Zsj9Ey/LZbJqfVF1yctvac/lkKXgGeShE6rb0xJPfRk6jEo2lX9DxWgoKkn6t f1Wg3foLsgUdqtn/rRaHznmqwlvOcG68ZGFbL9JqGEkSwqynYqLHrlLsL75rcnptqyjc TC1yMmEjNQF2AxOLDDOMKbt0rCj/XthXzhc+fYGYovFKRu3ExtQaixcK7xzSlctau1NL dCyurrtLRLabZ9H5QPIOTbjhgBLPhQ+cpmk8dqgxfE35Qk54lIrcQZpFTVaHusggYFty BkiA== X-Gm-Message-State: AOJu0Yxho86sOgvQQ9i4zclG19DKFviAx4bAM9SHBvA5PiOUzXoxMPAs i0HAeBZv/Agh90mcQPTpwy6ybXag9i7xNJchTZza5vuB8qE6qTq+Gfaa6FeheiqkMsICFGq0ktq lxjca2Btsz9Ii+YJHRrG9GGdXSG+NPJdJKUVuVvp4ORs0kfX2mWRPS2oHs26jhg== X-Received: by 2002:a05:600c:3b9c:b0:42c:bb10:7292 with SMTP id 5b1f17b1804b1-4319ac70754mr191131025e9.1.1730389979860; Thu, 31 Oct 2024 08:52:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7aAFQyGb4fMINZILJtO4y97DAhF+BL+vxQo8NXrxLAJJf7/4i8eYbmfcy75lN0cDuK2D71Q== X-Received: by 2002:a05:600c:3b9c:b0:42c:bb10:7292 with SMTP id 5b1f17b1804b1-4319ac70754mr191130745e9.1.1730389979516; Thu, 31 Oct 2024 08:52:59 -0700 (PDT) Received: from debian (2a01cb058918ce002753490a7d66077e.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:2753:490a:7d66:77e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd8e7d23sm60349095e9.7.2024.10.31.08.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 08:52:59 -0700 (PDT) Date: Thu, 31 Oct 2024 16:52:57 +0100 From: Guillaume Nault To: Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Simon Horman , David Ahern , Ido Schimmel , Eyal Birger Subject: [PATCH ipsec-next v2 4/4] xfrm: Convert struct xfrm_dst_lookup_params -> tos to dscp_t. Message-ID: <8b7dbe727a3aae1d61a2a43ec4a7f932feed70a0.1730387416.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Add type annotation to the "tos" field of struct xfrm_dst_lookup_params, to ensure that the ECN bits aren't mistakenly taken into account when doing route lookups. Rename that field (tos -> dscp) to make that change explicit. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- include/net/xfrm.h | 3 ++- net/ipv4/xfrm4_policy.c | 3 ++- net/xfrm/xfrm_policy.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index a0bdd58f401c..48ec4c415e98 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -351,7 +352,7 @@ void xfrm_if_unregister_cb(void); struct xfrm_dst_lookup_params { struct net *net; - int tos; + dscp_t dscp; int oif; xfrm_address_t *saddr; xfrm_address_t *daddr; diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 7e1c2faed1ff..7fb6205619e7 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -24,7 +25,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct flowi4 *fl4, memset(fl4, 0, sizeof(*fl4)); fl4->daddr = params->daddr->a4; - fl4->flowi4_tos = params->tos; + fl4->flowi4_tos = inet_dscp_to_dsfield(params->dscp); fl4->flowi4_l3mdev = l3mdev_master_ifindex_by_index(params->net, params->oif); fl4->flowi4_mark = params->mark; diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 9e231c1ece3f..e91607fe45ba 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -312,7 +312,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x, params.net = net; params.saddr = saddr; params.daddr = daddr; - params.tos = inet_dscp_to_dsfield(dscp); + params.dscp = dscp; params.oif = oif; params.mark = mark; params.ipproto = x->id.proto;