diff options
author | Pavel Tikhomirov <ptikhomirov@virtuozzo.com> | 2024-05-22 19:54:22 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@netfilter.org> | 2024-05-22 19:54:22 +0200 |
commit | f0905d2f1507c8678eab0197f21396376c3e0f51 (patch) | |
tree | 2bca559d6e980140d67678ac57fdd4f5813234d4 /kernel/net | |
parent | 618d2d66657eef7e33a474046dfafeb2ede866b3 (diff) |
netfilter: propagate net to nf_bridge_get_physindev
This is a preparation patch for replacing physindev with physinif on
nf_bridge_info structure. We will use dev_get_by_index_rcu to resolve
device, when needed, and it requires net to be available.
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Diffstat (limited to 'kernel/net')
-rw-r--r-- | kernel/net/netfilter/ipset/ip_set_hash_netiface.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/net/netfilter/ipset/ip_set_hash_netiface.c b/kernel/net/netfilter/ipset/ip_set_hash_netiface.c index 5baa852..293d095 100644 --- a/kernel/net/netfilter/ipset/ip_set_hash_netiface.c +++ b/kernel/net/netfilter/ipset/ip_set_hash_netiface.c @@ -139,10 +139,15 @@ hash_netiface4_data_next(struct hash_netiface4_elem *next, #include "ip_set_hash_gen.h" #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) +#ifdef HAVE_NF_BRIDGE_GET_PYSINDEV_NET +static const char *get_physindev_name(const struct sk_buff *skb, struct net *net) +{ + struct net_device *dev = nf_bridge_get_physindev(skb, net); +#else static const char *get_physindev_name(const struct sk_buff *skb) { struct net_device *dev = nf_bridge_get_physindev(skb); - +#endif return dev ? dev->name : NULL; } @@ -178,8 +183,13 @@ hash_netiface4_kadt(struct ip_set *set, const struct sk_buff *skb, if (opt->cmdflags & IPSET_FLAG_PHYSDEV) { #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) +#ifdef HAVE_NF_BRIDGE_GET_PYSINDEV_NET + const char *eiface = SRCDIR ? get_physindev_name(skb, xt_net(par)) : + get_physoutdev_name(skb); +#else const char *eiface = SRCDIR ? get_physindev_name(skb) : get_physoutdev_name(skb); +#endif if (!eiface) return -EINVAL; @@ -396,8 +406,13 @@ hash_netiface6_kadt(struct ip_set *set, const struct sk_buff *skb, if (opt->cmdflags & IPSET_FLAG_PHYSDEV) { #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) +#ifdef HAVE_NF_BRIDGE_GET_PYSINDEV_NET + const char *eiface = SRCDIR ? get_physindev_name(skb, xt_net(par)) : + get_physoutdev_name(skb); +#else const char *eiface = SRCDIR ? get_physindev_name(skb) : get_physoutdev_name(skb); +#endif if (!eiface) return -EINVAL; |