-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netfilter: revert introduction of egress hook
This reverts the following commits: 8537f78 ("netfilter: Introduce egress hook") 5418d38 ("netfilter: Generalize ingress hook") b030f19 ("netfilter: Rename ingress hook include file") >From the discussion in [0], the author's main motivation to add a hook in fast path is for an out of tree kernel module, which is a red flag to begin with. Other mentioned potential use cases like NAT{64,46} is on future extensions w/o concrete code in the tree yet. Revert as suggested [1] given the weak justification to add more hooks to critical fast-path. [0] https://lore.kernel.org/netdev/cover.1583927267.git.lukas@wunner.de/ [1] https://lore.kernel.org/netdev/20200318.011152.72770718915606186.davem@davemloft.net/ Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: David Miller <davem@davemloft.net> Cc: Pablo Neira Ayuso <pablo@netfilter.org> Cc: Alexei Starovoitov <ast@kernel.org> Nacked-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Daniel Borkmann
authored and
David S. Miller
committed
Mar 18, 2020
1 parent
ce7964b
commit 357b6cc
Showing
8 changed files
with
68 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _NETFILTER_INGRESS_H_ | ||
#define _NETFILTER_INGRESS_H_ | ||
|
||
#include <linux/netfilter.h> | ||
#include <linux/netdevice.h> | ||
|
||
#ifdef CONFIG_NETFILTER_INGRESS | ||
static inline bool nf_hook_ingress_active(const struct sk_buff *skb) | ||
{ | ||
#ifdef CONFIG_JUMP_LABEL | ||
if (!static_key_false(&nf_hooks_needed[NFPROTO_NETDEV][NF_NETDEV_INGRESS])) | ||
return false; | ||
#endif | ||
return rcu_access_pointer(skb->dev->nf_hooks_ingress); | ||
} | ||
|
||
/* caller must hold rcu_read_lock */ | ||
static inline int nf_hook_ingress(struct sk_buff *skb) | ||
{ | ||
struct nf_hook_entries *e = rcu_dereference(skb->dev->nf_hooks_ingress); | ||
struct nf_hook_state state; | ||
int ret; | ||
|
||
/* Must recheck the ingress hook head, in the event it became NULL | ||
* after the check in nf_hook_ingress_active evaluated to true. | ||
*/ | ||
if (unlikely(!e)) | ||
return 0; | ||
|
||
nf_hook_state_init(&state, NF_NETDEV_INGRESS, | ||
NFPROTO_NETDEV, skb->dev, NULL, NULL, | ||
dev_net(skb->dev), NULL); | ||
ret = nf_hook_slow(skb, &state, e, 0); | ||
if (ret == 0) | ||
return -1; | ||
|
||
return ret; | ||
} | ||
|
||
static inline void nf_hook_ingress_init(struct net_device *dev) | ||
{ | ||
RCU_INIT_POINTER(dev->nf_hooks_ingress, NULL); | ||
} | ||
#else /* CONFIG_NETFILTER_INGRESS */ | ||
static inline int nf_hook_ingress_active(struct sk_buff *skb) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline int nf_hook_ingress(struct sk_buff *skb) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline void nf_hook_ingress_init(struct net_device *dev) {} | ||
#endif /* CONFIG_NETFILTER_INGRESS */ | ||
#endif /* _NETFILTER_INGRESS_H_ */ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,6 @@ enum nf_inet_hooks { | |
|
||
enum nf_dev_hooks { | ||
NF_NETDEV_INGRESS, | ||
NF_NETDEV_EGRESS, | ||
NF_NETDEV_NUMHOOKS | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters