Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2488021pxb; Tue, 12 Oct 2021 07:39:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8A9MZtA9xGe/bin/RmRgAMEvCZjzkaYq89uoxqIyQz5apmz8pzj9/h/vwl59dxDJCsrsO X-Received: by 2002:a17:90b:1c81:: with SMTP id oo1mr6369296pjb.97.1634049578709; Tue, 12 Oct 2021 07:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634049578; cv=none; d=google.com; s=arc-20160816; b=y77GB1z03jMwxGuAzwHI3zeEP0K10pUO3sul5+ltwu83RGjoXYs5pfXeYDyLiTWMS/ AUUp9ZCPXRqq5VRCspuQTmS5hRLlK/DZ0Ko4oE+9dfyZti72l9Z+F1h75B5P/zb005tW m1jECAUhNf1IhyftDnQk7b7UqlC9q63Leq35K7tT6DUaMvES2NJr2auK7ddaAjuqFsu7 kr5Fdr5/lcSlckmP1Pw/QutlMYPNBm8QMDzZA0CvVxzUUA+GFBy/GVOT8JEsSJ3iUoUa gOI934FkgElIZn+RxbqFaEmgNSEuaU/z8CTfB8AWnxgiGa8L7tWGz+RFqfUPiKNccuHO uhKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ajkQCqh8R1xj55HNYjqmZNpAqZT9WiN/huGWLcAi0EA=; b=uiwcQMJLYOOY71HAVhfengyil2UkC58BICw5Xv6HKKJwPIbGrHMzCfw6eFrcwHElAU sYBUlpatBW45xZQIYS8ZFZFqwxXUivmkK28d+A0Pc7cR34oIv9AxzrrVOtRL5QxDDFss ++h2s+s8E6xfXdyMyVP6ePdRU3vD1mTXVafpwXuaEgsYaR+HJKQCJWwdcbqvscVH8mBe A66HWNWXYyF7Sb/Z/fv4SGSfYiPo7mnHelrhgJWfOdXG/4LrIy3p4YTeCmvv72F6H2xT GKbXMV5AJut/u/+cZu7mVW7JwLIbIlPLMax496cyO5gBVkBF6Kobdie9YPXNxJYPjO3t Jl0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=NFswxsXd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si18125544pgk.256.2021.10.12.07.39.25; Tue, 12 Oct 2021 07:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=NFswxsXd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237266AbhJLOk1 (ORCPT + 99 others); Tue, 12 Oct 2021 10:40:27 -0400 Received: from sonic309-26.consmr.mail.ne1.yahoo.com ([66.163.184.152]:44784 "EHLO sonic309-26.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235294AbhJLOkX (ORCPT ); Tue, 12 Oct 2021 10:40:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1634049502; bh=ajkQCqh8R1xj55HNYjqmZNpAqZT9WiN/huGWLcAi0EA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject:Reply-To; b=NFswxsXdo7VvZgO3ofi3rZeWtmRj+yu/b9tGsHWwD2MdERSziXiI63t9yQ68qApmpSMXNSw0fmu+HFAJH26b/WdsjDDPJjvTrIaJ0DPiMpq7qzj6z6IJA+RzS6wuvFioUVIT99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drEQlD0TGZ28YYERmWg3Dxy5x0E7zBd S_qhPLBP9zSlbV8soO1jWGDK4j2dSlveTJTP2TQ5ee.alh4Nv7_PDj_lA77kAAfrueBhCfbkauMI PLs_RUPFpMFPkuJxso.w070Mfltt4Z9bw2q3MAqoPk7vWOnboNg6Yt4Ih5ANFunXBFDgW_wJF7uY FbzihtQeHLjtNmPhSDSOy50Q6Nf4VZDkOezIGxp5Rt12aCcdwlgCpPBTgXGjEzz9EQciP1F8PcYO j84VDa.sbKE2ab4arRvEHLXrxTgqRQMFA4AAzyrWgTlfldUMv6VjF9kYfwhaz0TlXeFhpOMZmgPq HJVtypOQqhrYBsqyj3tGguxMBwQdrHprqa6IuafcmQccTwl6GaP9zWj6Ie_taVeLs.96nHrfzZS3 2mvPwuarsOZx.FIN_oMmi1Oz9fV4HaYhkWaQxCkMs.LOOxEIMYn6CrlReJ9JA1gkR_4vHzeD4HaU GjtMczsPD2yVWX5xd7sjHF5rhzGrFFanUfEc7NEJaycn4SZOT8d.VyWzJu5wS3rB3bVdSYB2pG.Z 0zHU5mzwivITwVQBttZL6.MvLGL0OCB3FMZkDu2tzpJTCImE28Ur4s4I3pWBLeNjLl39Yp0H.XHB IYK1.79GL0rGSNGKjqXYeUst8JM90lZbngBZj.m2yVE9em.ZAsoNVKNv.IVBQq_Vw4.bcpEX25TQ yKca7FylN3odAsZOWrFgRWFbAVk2Yq6PfHJgYlGYsz93GG0zcYWnXIqo_oaWH5UPJnZblp.YQdZ0 O9yVgnmLvplXsqCmmFmLht9PWl.kUtKVw1DeJ7bgMpmotq2E3dGk95qqqEQqx.jONsoGzarzsLEF d6UaC9GmLejCmk__PhCCiqRvPIqsfUDHD_rzqLIlqYL_TcxYVfw53YEcpPB7B4PzPxuFptHxxUQ0 GnsBOE2BCvaY- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ne1.yahoo.com with HTTP; Tue, 12 Oct 2021 14:38:22 +0000 Received: by kubenode534.mail-prod1.omega.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 694b85d7ad037a75725227ef66182e7a; Tue, 12 Oct 2021 14:38:16 +0000 (UTC) Subject: Re: [PATCH smack] smack: remove duplicated hook function To: Florian Westphal , linux-security-module@vger.kernel.org Cc: jmorris@namei.org, serge@hallyn.com, linux-kernel@vger.kernel.org, Casey Schaufler References: <20211011143309.17203-1-fw@strlen.de> From: Casey Schaufler Message-ID: <700b26f3-a8ef-969b-dd3c-4ad849d8c4ab@schaufler-ca.com> Date: Tue, 12 Oct 2021 07:38:14 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211011143309.17203-1-fw@strlen.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Mailer: WebService/1.1.19116 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 1977 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11/2021 7:33 AM, Florian Westphal wrote: > ipv4 and ipv6 hook functions are identical, remove one. > > Signed-off-by: Florian Westphal Looks fine, with the one change I've noted below. If you're OK with that change I can take it for smack-next. > --- > patch targets next branch of > git://github.com/cschaufler/smack-next. > > security/smack/smack_netfilter.c | 26 +++----------------------- > 1 file changed, 3 insertions(+), 23 deletions(-) > > diff --git a/security/smack/smack_netfilter.c b/security/smack/smack_netfilter.c > index fc7399b45373..a7ef2e2abc8a 100644 > --- a/security/smack/smack_netfilter.c > +++ b/security/smack/smack_netfilter.c > @@ -18,27 +18,7 @@ > #include > #include "smack.h" > > -#if IS_ENABLED(CONFIG_IPV6) > - > -static unsigned int smack_ipv6_output(void *priv, > - struct sk_buff *skb, > - const struct nf_hook_state *state) > -{ > - struct sock *sk = skb_to_full_sk(skb); > - struct socket_smack *ssp; > - struct smack_known *skp; > - > - if (sk && sk->sk_security) { > - ssp = sk->sk_security; > - skp = ssp->smk_out; > - skb->secmark = skp->smk_secid; > - } > - > - return NF_ACCEPT; > -} > -#endif /* IPV6 */ > - > -static unsigned int smack_ipv4_output(void *priv, > +static unsigned int smack_hook_output(void *priv, I would prefer smack_ip_output() to smack_hook_output(). > struct sk_buff *skb, > const struct nf_hook_state *state) > { > @@ -57,14 +37,14 @@ static unsigned int smack_ipv4_output(void *priv, > > static const struct nf_hook_ops smack_nf_ops[] = { > { > - .hook = smack_ipv4_output, > + .hook = smack_hook_output, > .pf = NFPROTO_IPV4, > .hooknum = NF_INET_LOCAL_OUT, > .priority = NF_IP_PRI_SELINUX_FIRST, > }, > #if IS_ENABLED(CONFIG_IPV6) > { > - .hook = smack_ipv6_output, > + .hook = smack_hook_output, > .pf = NFPROTO_IPV6, > .hooknum = NF_INET_LOCAL_OUT, > .priority = NF_IP6_PRI_SELINUX_FIRST,