Skip to content

Commit 602ae00

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next
Pablo Neira Ayuso says: ==================== Netfilter/IPVS updates for net-next The following patchset contains Netfilter/IPVS updates for net-next: 1) Simplify nf_ct_get_tuple(), from Jackie Liu. 2) Add format to request_module() call, from Bill Wendling. 3) Add /proc/net/stats/nf_flowtable to monitor in-flight pending hardware offload objects to be processed, from Vlad Buslov. 4) Missing rcu annotation and accessors in the netfilter tree, from Florian Westphal. 5) Merge h323 conntrack helper nat hooks into single object, also from Florian. 6) A batch of update to fix sparse warnings treewide, from Florian Westphal. 7) Move nft_cmp_fast_mask() where it used, from Florian. 8) Missing const in nf_nat_initialized(), from James Yonan. 9) Use bitmap API for Maglev IPVS scheduler, from Christophe Jaillet. 10) Use refcount_inc instead of _inc_not_zero in flowtable, from Florian Westphal. 11) Remove pr_debug in xt_TPROXY, from Nathan Cancellor. * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next: netfilter: xt_TPROXY: remove pr_debug invocations netfilter: flowtable: prefer refcount_inc netfilter: ipvs: Use the bitmap API to allocate bitmaps netfilter: nf_nat: in nf_nat_initialized(), use const struct nf_conn * netfilter: nf_tables: move nft_cmp_fast_mask to where its used netfilter: nf_tables: use correct integer types netfilter: nf_tables: add and use BE register load-store helpers netfilter: nf_tables: use the correct get/put helpers netfilter: x_tables: use correct integer types netfilter: nfnetlink: add missing __be16 cast netfilter: nft_set_bitmap: Fix spelling mistake netfilter: h323: merge nat hook pointers into one netfilter: nf_conntrack: use rcu accessors where needed netfilter: nf_conntrack: add missing __rcu annotations netfilter: nf_flow_table: count pending offload workqueue tasks net/sched: act_ct: set 'net' pointer when creating new nf_flow_table netfilter: conntrack: use correct format characters netfilter: conntrack: use fallthrough to cleanup ==================== Link: https://lore.kernel.org/r/20220720230754.209053-1-pablo@netfilter.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 47f058c + aa8c7cd commit 602ae00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+518
-357
lines changed

include/linux/netfilter/nf_conntrack_h323.h

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -38,60 +38,63 @@ void nf_conntrack_h245_expect(struct nf_conn *new,
3838
struct nf_conntrack_expect *this);
3939
void nf_conntrack_q931_expect(struct nf_conn *new,
4040
struct nf_conntrack_expect *this);
41-
extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
42-
unsigned char **data, int dataoff,
43-
H245_TransportAddress *taddr,
44-
union nf_inet_addr *addr,
45-
__be16 port);
46-
extern int (*set_h225_addr_hook) (struct sk_buff *skb, unsigned int protoff,
47-
unsigned char **data, int dataoff,
48-
TransportAddress *taddr,
49-
union nf_inet_addr *addr,
50-
__be16 port);
51-
extern int (*set_sig_addr_hook) (struct sk_buff *skb,
52-
struct nf_conn *ct,
53-
enum ip_conntrack_info ctinfo,
54-
unsigned int protoff, unsigned char **data,
55-
TransportAddress *taddr, int count);
56-
extern int (*set_ras_addr_hook) (struct sk_buff *skb,
57-
struct nf_conn *ct,
58-
enum ip_conntrack_info ctinfo,
59-
unsigned int protoff, unsigned char **data,
60-
TransportAddress *taddr, int count);
61-
extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
62-
struct nf_conn *ct,
63-
enum ip_conntrack_info ctinfo,
64-
unsigned int protoff, unsigned char **data,
65-
int dataoff,
66-
H245_TransportAddress *taddr,
67-
__be16 port, __be16 rtp_port,
68-
struct nf_conntrack_expect *rtp_exp,
69-
struct nf_conntrack_expect *rtcp_exp);
70-
extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct,
71-
enum ip_conntrack_info ctinfo,
72-
unsigned int protoff,
41+
42+
struct nfct_h323_nat_hooks {
43+
int (*set_h245_addr)(struct sk_buff *skb, unsigned int protoff,
7344
unsigned char **data, int dataoff,
74-
H245_TransportAddress *taddr, __be16 port,
75-
struct nf_conntrack_expect *exp);
76-
extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct,
77-
enum ip_conntrack_info ctinfo,
78-
unsigned int protoff,
45+
H245_TransportAddress *taddr,
46+
union nf_inet_addr *addr, __be16 port);
47+
int (*set_h225_addr)(struct sk_buff *skb, unsigned int protoff,
7948
unsigned char **data, int dataoff,
80-
TransportAddress *taddr, __be16 port,
81-
struct nf_conntrack_expect *exp);
82-
extern int (*nat_callforwarding_hook) (struct sk_buff *skb,
83-
struct nf_conn *ct,
84-
enum ip_conntrack_info ctinfo,
85-
unsigned int protoff,
86-
unsigned char **data, int dataoff,
87-
TransportAddress *taddr,
88-
__be16 port,
89-
struct nf_conntrack_expect *exp);
90-
extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct,
91-
enum ip_conntrack_info ctinfo,
92-
unsigned int protoff,
93-
unsigned char **data, TransportAddress *taddr,
94-
int idx, __be16 port,
95-
struct nf_conntrack_expect *exp);
49+
TransportAddress *taddr,
50+
union nf_inet_addr *addr, __be16 port);
51+
int (*set_sig_addr)(struct sk_buff *skb,
52+
struct nf_conn *ct,
53+
enum ip_conntrack_info ctinfo,
54+
unsigned int protoff, unsigned char **data,
55+
TransportAddress *taddr, int count);
56+
int (*set_ras_addr)(struct sk_buff *skb,
57+
struct nf_conn *ct,
58+
enum ip_conntrack_info ctinfo,
59+
unsigned int protoff, unsigned char **data,
60+
TransportAddress *taddr, int count);
61+
int (*nat_rtp_rtcp)(struct sk_buff *skb,
62+
struct nf_conn *ct,
63+
enum ip_conntrack_info ctinfo,
64+
unsigned int protoff,
65+
unsigned char **data, int dataoff,
66+
H245_TransportAddress *taddr,
67+
__be16 port, __be16 rtp_port,
68+
struct nf_conntrack_expect *rtp_exp,
69+
struct nf_conntrack_expect *rtcp_exp);
70+
int (*nat_t120)(struct sk_buff *skb,
71+
struct nf_conn *ct,
72+
enum ip_conntrack_info ctinfo,
73+
unsigned int protoff,
74+
unsigned char **data, int dataoff,
75+
H245_TransportAddress *taddr, __be16 port,
76+
struct nf_conntrack_expect *exp);
77+
int (*nat_h245)(struct sk_buff *skb,
78+
struct nf_conn *ct,
79+
enum ip_conntrack_info ctinfo,
80+
unsigned int protoff,
81+
unsigned char **data, int dataoff,
82+
TransportAddress *taddr, __be16 port,
83+
struct nf_conntrack_expect *exp);
84+
int (*nat_callforwarding)(struct sk_buff *skb,
85+
struct nf_conn *ct,
86+
enum ip_conntrack_info ctinfo,
87+
unsigned int protoff,
88+
unsigned char **data, int dataoff,
89+
TransportAddress *taddr, __be16 port,
90+
struct nf_conntrack_expect *exp);
91+
int (*nat_q931)(struct sk_buff *skb,
92+
struct nf_conn *ct,
93+
enum ip_conntrack_info ctinfo,
94+
unsigned int protoff,
95+
unsigned char **data, TransportAddress *taddr, int idx,
96+
__be16 port, struct nf_conntrack_expect *exp);
97+
};
98+
extern const struct nfct_h323_nat_hooks __rcu *nfct_h323_nat_hook;
9699

97100
#endif

include/linux/netfilter/nf_conntrack_sip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct nf_nat_sip_hooks {
164164
unsigned int medialen,
165165
union nf_inet_addr *rtp_addr);
166166
};
167-
extern const struct nf_nat_sip_hooks *nf_nat_sip_hooks;
167+
extern const struct nf_nat_sip_hooks __rcu *nf_nat_sip_hooks;
168168

169169
int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr,
170170
unsigned int datalen, unsigned int *matchoff,

include/net/net_namespace.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2727
#include <net/netns/conntrack.h>
2828
#endif
29+
#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
30+
#include <net/netns/flow_table.h>
31+
#endif
2932
#include <net/netns/nftables.h>
3033
#include <net/netns/xfrm.h>
3134
#include <net/netns/mpls.h>
@@ -142,6 +145,9 @@ struct net {
142145
#if defined(CONFIG_NF_TABLES) || defined(CONFIG_NF_TABLES_MODULE)
143146
struct netns_nftables nft;
144147
#endif
148+
#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
149+
struct netns_ft ft;
150+
#endif
145151
#endif
146152
#ifdef CONFIG_WEXT_CORE
147153
struct sk_buff_head wext_nlevents;

include/net/netfilter/nf_conntrack_timeout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct nf_ct_timeout_hooks {
105105
void (*timeout_put)(struct nf_ct_timeout *timeout);
106106
};
107107

108-
extern const struct nf_ct_timeout_hooks *nf_ct_timeout_hook;
108+
extern const struct nf_ct_timeout_hooks __rcu *nf_ct_timeout_hook;
109109
#endif
110110

111111
#endif /* _NF_CONNTRACK_TIMEOUT_H */

include/net/netfilter/nf_flow_table.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,25 @@ static inline __be16 nf_flow_pppoe_proto(const struct sk_buff *skb)
335335
return 0;
336336
}
337337

338+
#define NF_FLOW_TABLE_STAT_INC(net, count) __this_cpu_inc((net)->ft.stat->count)
339+
#define NF_FLOW_TABLE_STAT_DEC(net, count) __this_cpu_dec((net)->ft.stat->count)
340+
#define NF_FLOW_TABLE_STAT_INC_ATOMIC(net, count) \
341+
this_cpu_inc((net)->ft.stat->count)
342+
#define NF_FLOW_TABLE_STAT_DEC_ATOMIC(net, count) \
343+
this_cpu_dec((net)->ft.stat->count)
344+
345+
#ifdef CONFIG_NF_FLOW_TABLE_PROCFS
346+
int nf_flow_table_init_proc(struct net *net);
347+
void nf_flow_table_fini_proc(struct net *net);
348+
#else
349+
static inline int nf_flow_table_init_proc(struct net *net)
350+
{
351+
return 0;
352+
}
353+
354+
static inline void nf_flow_table_fini_proc(struct net *net)
355+
{
356+
}
357+
#endif /* CONFIG_NF_FLOW_TABLE_PROCFS */
358+
338359
#endif /* _NF_FLOW_TABLE_H */

include/net/netfilter/nf_nat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ unsigned int
104104
nf_nat_inet_fn(void *priv, struct sk_buff *skb,
105105
const struct nf_hook_state *state);
106106

107-
static inline int nf_nat_initialized(struct nf_conn *ct,
107+
static inline int nf_nat_initialized(const struct nf_conn *ct,
108108
enum nf_nat_manip_type manip)
109109
{
110110
if (manip == NF_NAT_MANIP_SRC)

include/net/netfilter/nf_tables.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,26 @@ static inline void nft_reg_store16(u32 *dreg, u16 val)
157157
*(u16 *)dreg = val;
158158
}
159159

160+
static inline void nft_reg_store_be16(u32 *dreg, __be16 val)
161+
{
162+
nft_reg_store16(dreg, (__force __u16)val);
163+
}
164+
160165
static inline u16 nft_reg_load16(const u32 *sreg)
161166
{
162167
return *(u16 *)sreg;
163168
}
164169

170+
static inline __be16 nft_reg_load_be16(const u32 *sreg)
171+
{
172+
return (__force __be16)nft_reg_load16(sreg);
173+
}
174+
175+
static inline __be32 nft_reg_load_be32(const u32 *sreg)
176+
{
177+
return *(__force __be32 *)sreg;
178+
}
179+
165180
static inline void nft_reg_store64(u32 *dreg, u64 val)
166181
{
167182
put_unaligned(val, (u64 *)dreg);

include/net/netfilter/nf_tables_core.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ struct nft_immediate_expr {
5656
u8 dlen;
5757
};
5858

59-
/* Calculate the mask for the nft_cmp_fast expression. On big endian the
60-
* mask needs to include the *upper* bytes when interpreting that data as
61-
* something smaller than the full u32, therefore a cpu_to_le32 is done.
62-
*/
63-
static inline u32 nft_cmp_fast_mask(unsigned int len)
64-
{
65-
return cpu_to_le32(~0U >> (sizeof_field(struct nft_cmp_fast_expr,
66-
data) * BITS_PER_BYTE - len));
67-
}
68-
6959
extern const struct nft_expr_ops nft_cmp_fast_ops;
7060
extern const struct nft_expr_ops nft_cmp16_fast_ops;
7161

include/net/netns/flow_table.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __NETNS_FLOW_TABLE_H
3+
#define __NETNS_FLOW_TABLE_H
4+
5+
struct nf_flow_table_stat {
6+
unsigned int count_wq_add;
7+
unsigned int count_wq_del;
8+
unsigned int count_wq_stats;
9+
};
10+
11+
struct netns_ft {
12+
struct nf_flow_table_stat __percpu *stat;
13+
};
14+
#endif

net/bridge/netfilter/nft_meta_bridge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void nft_meta_bridge_get_eval(const struct nft_expr *expr,
5353
goto err;
5454

5555
br_vlan_get_proto(br_dev, &p_proto);
56-
nft_reg_store16(dest, htons(p_proto));
56+
nft_reg_store_be16(dest, htons(p_proto));
5757
return;
5858
}
5959
default:

0 commit comments

Comments
 (0)