Received: by 2002:a05:6520:1682:b0:147:d1a0:b502 with SMTP id ck2csp5598602lkb; Mon, 11 Oct 2021 09:41:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye9FgE2ZwCTnRfTxGJk2xutfeEiagltD8SQUwf2XZGlpTUacvDGLirh9YdgImvrFqDKihe X-Received: by 2002:a05:6402:1e8e:: with SMTP id f14mr6083786edf.27.1633970470290; Mon, 11 Oct 2021 09:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633970470; cv=none; d=google.com; s=arc-20160816; b=FpyRLHn1Ha4r8UmLkmC01BO5bTB43KXPI9vlyVeH1VK+szmw54h3L1dQX0/EVCl/D8 cZWomGaPt4PUeNlAESKzch4hBRt9c5RvxeVgnDz+mrV/QTOACptf3K/clLmFcviUT+kF kJL/qhrJWCkB8C5iF5cNLkllih7e42XjkJsZa+ZfrDud+jJo3adxbieTueDrUaTebgqQ vFdskxHVcOk/LrrR597ut93ZjiMHfeiSJnPJSYpgYTCM+LnmugDoeVhBRHKXRiBHbkE8 yL7TjZtUsorFfDWBz6OaCKKOGaGPTNXyeaqbQaszr25VYXFMhNAgLxR5ldyzYDy+PBGK +oTA== 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; bh=0LvGZ3NB7yMvfE1bN6pfweUGQcyy7VwS4QA7HL8Xpz4=; b=mPHgsbaHeN45EVkkN+3/lqwKHxdSyR4aXhEYQ7zsrX0l6apL1qT2a/3KoLxads0dwz wb699BqfSa7OW4vNDCn7iDNsa/GUmlT0EbGxNWw32oJnOZRICGbQgZzQ49imMDGt5lBG 0y2HJiXkcxOPMSuVSeFsS5D1u5Ylc3BEc6rrdReoDTc+I8PXE7KPfr6XRWB8TFMKoB0V 7g/85XdCgvY/K5y9DWDVOSeH/UcNRmrP/SHMQDKECoJq/0xGhJQZ888QY6BbnJPm+OwK SB7KRW/RQkDUWWLOp5cHdAB0SVLs97JW+HGugQ4qXXhu6SbtNADLrBWLZTlavQWLI/p4 ZgEg== ARC-Authentication-Results: i=1; mx.google.com; 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 md3si11289871ejb.732.2021.10.11.09.40.46; Mon, 11 Oct 2021 09:41:10 -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; 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 S238579AbhJKOfd (ORCPT + 99 others); Mon, 11 Oct 2021 10:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238419AbhJKOf3 (ORCPT ); Mon, 11 Oct 2021 10:35:29 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35228C061570; Mon, 11 Oct 2021 07:33:29 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1mZwMm-0001Z7-Ci; Mon, 11 Oct 2021 16:33:24 +0200 From: Florian Westphal To: linux-security-module@vger.kernel.org Cc: casey@schaufler-ca.com, jmorris@namei.org, serge@hallyn.com, linux-kernel@vger.kernel.org, Florian Westphal Subject: [PATCH smack] smack: remove duplicated hook function Date: Mon, 11 Oct 2021 16:33:09 +0200 Message-Id: <20211011143309.17203-1-fw@strlen.de> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ipv4 and ipv6 hook functions are identical, remove one. Signed-off-by: Florian Westphal --- 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, 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, -- 2.32.0