Skip to content

Commit f8de49e

Browse files
Florian Westphalcschaufler
authored andcommitted
smack: remove duplicated hook function
ipv4 and ipv6 hook functions are identical, remove one. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Casey Schaufler <[email protected]>
1 parent 387ef96 commit f8de49e

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

security/smack/smack_netfilter.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,7 @@
1818
#include <net/net_namespace.h>
1919
#include "smack.h"
2020

21-
#if IS_ENABLED(CONFIG_IPV6)
22-
23-
static unsigned int smack_ipv6_output(void *priv,
24-
struct sk_buff *skb,
25-
const struct nf_hook_state *state)
26-
{
27-
struct sock *sk = skb_to_full_sk(skb);
28-
struct socket_smack *ssp;
29-
struct smack_known *skp;
30-
31-
if (sk && sk->sk_security) {
32-
ssp = sk->sk_security;
33-
skp = ssp->smk_out;
34-
skb->secmark = skp->smk_secid;
35-
}
36-
37-
return NF_ACCEPT;
38-
}
39-
#endif /* IPV6 */
40-
41-
static unsigned int smack_ipv4_output(void *priv,
21+
static unsigned int smack_ip_output(void *priv,
4222
struct sk_buff *skb,
4323
const struct nf_hook_state *state)
4424
{
@@ -57,14 +37,14 @@ static unsigned int smack_ipv4_output(void *priv,
5737

5838
static const struct nf_hook_ops smack_nf_ops[] = {
5939
{
60-
.hook = smack_ipv4_output,
40+
.hook = smack_ip_output,
6141
.pf = NFPROTO_IPV4,
6242
.hooknum = NF_INET_LOCAL_OUT,
6343
.priority = NF_IP_PRI_SELINUX_FIRST,
6444
},
6545
#if IS_ENABLED(CONFIG_IPV6)
6646
{
67-
.hook = smack_ipv6_output,
47+
.hook = smack_ip_output,
6848
.pf = NFPROTO_IPV6,
6949
.hooknum = NF_INET_LOCAL_OUT,
7050
.priority = NF_IP6_PRI_SELINUX_FIRST,

0 commit comments

Comments
 (0)