Netfilter/IPVS updates for net-next
Subsystems (4)
Pablo Neira Ayuso
maintainercover Netfilter/IPVS updates for net-next
Hi,
The following patchset contains Netfilter/IPVS updates for net-next:
1) Allow slightly larger IPVS connection table size from Kconfig for 64-bit arch, from Abhijeet Rastogi.
2) Since IPVS connection table might be larger than 2^20 after previous patch, allow to limit it depending on the available memory. Moreover, use kvmalloc. From Julian Anastasov.
3) Do not rebuild VLAN header in nft_payload when matching source and destination MAC address.
4) Remove nested rcu read lock side in ip_set_test(), from Florian Westphal.
5) Allow to update set size, also from Florian.
6) Improve NAT tuple selection when connection is closing, from Florian Westphal.
7) Support for resetting set element stateful expression, from Phil Sutter.
8) Use NLA_POLICY_MAX to narrow down maximum attribute value in nf_tables, from Florian Westphal.
Please, pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git nf-next-23-06-26
Thanks.
----------------------------------------------------------------
The following changes since commit 4ff3dfc91c8458f65366f283167d1cd6f16be06f:
Merge branch 'splice-net-handle-msg_splice_pages-in-chelsio-tls' (2023-06-01 13:41:40 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git nf-next-23-06-26
for you to fetch changes up to a412dbf40ff37515acca4bba666f5386aa37246e:
netfilter: nf_tables: limit allowed range via nla_policy (2023-06-26 08:05:57 +0200)
----------------------------------------------------------------
netfilter pull request 23-06-26
----------------------------------------------------------------
Abhijeet Rastogi (1):
ipvs: increase ip_vs_conn_tab_bits range for 64BIT
Florian Westphal (4):
netfilter: ipset: remove rcu_read_lock_bh pair from ip_set_test
netfilter: nf_tables: permit update of set size
netfilter: snat: evict closing tcp entries on reply tuple collision
netfilter: nf_tables: limit allowed range via nla_policy
Julian Anastasov (1):
ipvs: dynamically limit the connection hash table
Pablo Neira Ayuso (1):
netfilter: nft_payload: rebuild vlan header when needed
Phil Sutter (1):
netfilter: nf_tables: Introduce NFT_MSG_GETSETELEM_RESET
include/net/netfilter/nf_tables.h | 3 ++ include/uapi/linux/netfilter/nf_tables.h | 2 + net/netfilter/ipset/ip_set_core.c | 2 - net/netfilter/ipvs/Kconfig | 27 +++++----- net/netfilter/ipvs/ip_vs_conn.c | 26 +++++---- net/netfilter/nf_nat_core.c | 92 ++++++++++++++++++++++++++++++-- net/netfilter/nf_tables_api.c | 72 ++++++++++++++++++------- net/netfilter/nft_bitwise.c | 2 +- net/netfilter/nft_byteorder.c | 6 +-- net/netfilter/nft_ct.c | 2 +- net/netfilter/nft_dynset.c | 2 +- net/netfilter/nft_exthdr.c | 4 +- net/netfilter/nft_fwd_netdev.c | 2 +- net/netfilter/nft_hash.c | 2 +- net/netfilter/nft_meta.c | 2 +- net/netfilter/nft_payload.c | 3 +- net/netfilter/nft_range.c | 2 +- net/netfilter/nft_reject.c | 2 +- net/netfilter/nft_rt.c | 2 +- net/netfilter/nft_socket.c | 4 +- net/netfilter/nft_tproxy.c | 2 +- net/netfilter/nft_tunnel.c | 4 +- net/netfilter/nft_xfrm.c | 4 +- 23 files changed, 199 insertions(+), 70 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/8 ipvs: increase ip_vs_conn_tab_bits range for 64BIT
From: Abhijeet Rastogi <[email protected]>
Current range [8, 20] is set purely due to historical reasons because at the time, ~1M (2^20) was considered sufficient. With this change, 27 is the upper limit for 64-bit, 20 otherwise.
Previous change regarding this limit is here.
--- net/netfilter/ipvs/Kconfig | 27 ++++++++++++++------------- net/netfilter/ipvs/ip_vs_conn.c | 4 ++-- 2 files changed, 16 insertions(+), 15 deletions(-)
net/netfilter/ipvs/Kconfig +14 -13
@@ -44,7 +44,8 @@ config IP_VS_DEBUG config IP_VS_TAB_BITS int "IPVS connection table size (the Nth power of 2)" - range 8 20 + range 8 20 if !64BIT + range 8 27 if 64BIT default 12 help The IPVS connection hash table uses the chaining scheme to handle
@@ -54,24 +55,24 @@ config IP_VS_TAB_BITS Note the table size must be power of 2. The table size will be the value of 2 to the your input number power. The number to choose is - from 8 to 20, the default number is 12, which means the table size - is 4096. Don't input the number too small, otherwise you will lose - performance on it. You can adapt the table size yourself, according - to your virtual server application. It is good to set the table size - not far less than the number of connections per second multiplying - average lasting time of connection in the table. For example, your - virtual server gets 200 connections per second, the connection lasts - for 200 seconds in average in the connection table, the table size - should be not far less than 200x200, it is good to set the table - size 32768 (2**15). + from 8 to 27 for 64BIT(20 otherwise), the default number is 12, + which means the table size is 4096. Don't input the number too + small, otherwise you will lose performance on it. You can adapt the + table size yourself, according to your virtual server application. + It is good to set the table size not far less than the number of + connections per second multiplying average lasting time of + connection in the table. For example, your virtual server gets 200 + connections per second, the connection lasts for 200 seconds in + average in the connection table, the table size should be not far + less than 200x200, it is good to set the table size 32768 (2**15). Another note that each connection occupies 128 bytes effectively and each hash entry uses 8 bytes, so you can estimate how much memory is needed for your box. You can overwrite this number setting conn_tab_bits module parameter - or by appending ip_vs.conn_tab_bits=? to the kernel command line - if IP VS was compiled built-in. + or by appending ip_vs.conn_tab_bits=? to the kernel command line if + IP VS was compiled built-in. comment "IPVS transport protocol load balancing support"
net/netfilter/ipvs/ip_vs_conn.c +2 -2
@@ -1485,8 +1485,8 @@ int __init ip_vs_conn_init(void)int idx;/* Compute size and mask */ -if (ip_vs_conn_tab_bits <8 || ip_vs_conn_tab_bits >20 ) { -pr_info ("conn_tab_bits not in [8, 20]. Using default value\n" ); +if (ip_vs_conn_tab_bits <8 || ip_vs_conn_tab_bits >27 ) { +pr_info ("conn_tab_bits not in [8, 27]. Using default value\n" ); ip_vs_conn_tab_bits =CONFIG_IP_VS_TAB_BITS ; } ip_vs_conn_tab_size =1 << ip_vs_conn_tab_bits;
Signature · 1 line
2.30.2
Re: [PATCH net-next 1/8] ipvs: increase ip_vs_conn_tab_bits range for 64BIT
This series was applied to netdev/net-next.git (main) by Pablo Neira Ayuso <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Pablo Neira Ayuso <[email protected]>:
Quoted 9 lines · On Mon, 26 Jun 2023 08:47:42 +0200 you wrote:
From: Abhijeet Rastogi <[email protected]>
Current range [8, 20] is set purely due to historical reasons because at the time, ~1M (2^20) was considered sufficient. With this change, 27 is the upper limit for 64-bit, 20 otherwise.
Previous change regarding this limit is here.
[...]
Here is the summary with links:
- [net-next,1/8] ipvs: increase ip_vs_conn_tab_bits range for 64BIT
https://git.kernel.org/netdev/net-next/c/04292c695f82 - [net-next,2/8] ipvs: dynamically limit the connection hash table https://git.kernel.org/netdev/net-next/c/4f325e26277b - [net-next,3/8] netfilter: nft_payload: rebuild vlan header when needed https://git.kernel.org/netdev/net-next/c/de6843be3082 - [net-next,4/8] netfilter: ipset: remove rcu_read_lock_bh pair from ip_set_test https://git.kernel.org/netdev/net-next/c/78aa23d0081b - [net-next,5/8] netfilter: nf_tables: permit update of set size https://git.kernel.org/netdev/net-next/c/96b2ef9b16cb - [net-next,6/8] netfilter: snat: evict closing tcp entries on reply tuple collision https://git.kernel.org/netdev/net-next/c/458972550287 - [net-next,7/8] netfilter: nf_tables: Introduce NFT_MSG_GETSETELEM_RESET https://git.kernel.org/netdev/net-next/c/079cd633219d - [net-next,8/8] netfilter: nf_tables: limit allowed range via nla_policy https://git.kernel.org/netdev/net-next/c/a412dbf40ff3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Pablo Neira Ayuso
maintainerPATCH 2/8 ipvs: dynamically limit the connection hash table
In reply to Pablo Neira AyusoFrom: Julian Anastasov <[email protected]>
As we allow the hash table to be configured to rows above 2^20, we should limit it depending on the available memory to some sane values. Switch to kvmalloc allocation to better select the needed allocation type.
--- net/netfilter/ipvs/ip_vs_conn.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +17 -9
@@ -26,7 +26,6 @@#include <linux/net.h> #include <linux/kernel.h> #include <linux/module.h> -#include <linux/vmalloc.h> #include <linux/proc_fs.h> /* for proc_net_* */ #include <linux/slab.h> #include <linux/seq_file.h>
@@ -1482,13 +1481,21 @@ void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs)int __init ip_vs_conn_init (void ) {size_t tab_array_size; +int max_avail; +#if BITS_PER_LONG >32 +int max =27 ; +#else +int max =20 ; +#endif +int min =8 ;int idx; -/* Compute size and mask */ -if (ip_vs_conn_tab_bits <8 || ip_vs_conn_tab_bits >27 ) { -pr_info ("conn_tab_bits not in [8, 27]. Using default value\n" ); - ip_vs_conn_tab_bits =CONFIG_IP_VS_TAB_BITS ; - } + max_avail =order_base_2 (totalram_pages ()) +PAGE_SHIFT ; + max_avail -=2 ;/* ~4 in hash row */ + max_avail -=1 ;/* IPVS up to 1/2 of mem */ + max_avail -=order_base_2 (sizeof (struct ip_vs_conn )); + max =clamp (max, min, max_avail); + ip_vs_conn_tab_bits =clamp_val (ip_vs_conn_tab_bits, min, max); ip_vs_conn_tab_size =1 << ip_vs_conn_tab_bits; ip_vs_conn_tab_mask = ip_vs_conn_tab_size -1 ;
@@ -1497,7 +1504,8 @@ int __init ip_vs_conn_init(void)*/ tab_array_size =array_size (ip_vs_conn_tab_size,sizeof (*ip_vs_conn_tab)); - ip_vs_conn_tab =vmalloc (tab_array_size); + ip_vs_conn_tab =kvmalloc_array (ip_vs_conn_tab_size, +sizeof (*ip_vs_conn_tab),GFP_KERNEL );if (!ip_vs_conn_tab)return -ENOMEM ;
@@ -1506,7 +1514,7 @@ int __init ip_vs_conn_init(void)sizeof (struct ip_vs_conn ),0 , SLAB_HWCACHE_ALIGN, NULL);if (!ip_vs_conn_cachep) { -vfree (ip_vs_conn_tab); +kvfree (ip_vs_conn_tab);return -ENOMEM ; }
@@ -1534,5 +1542,5 @@ void ip_vs_conn_cleanup(void)rcu_barrier ();/* Release the empty cache */ kmem_cache_destroy (ip_vs_conn_cachep); -vfree (ip_vs_conn_tab); +kvfree (ip_vs_conn_tab); }
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 3/8 netfilter: nft_payload: rebuild vlan header when needed
In reply to Pablo Neira AyusoSkip rebuilding the vlan header when accessing destination and source mac address.
--- net/netfilter/nft_payload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nft_payload.c +2 -1
@@ -171,7 +171,8 @@ void nft_payload_eval(const struct nft_expr *expr,if (!skb_mac_header_was_set (skb)) goto err; -if (skb_vlan_tag_present (skb)) { +if (skb_vlan_tag_present (skb) && + priv->offset >= offsetof(struct ethhdr , h_proto)) {if (!nft_payload_copy_vlan (dest, skb, priv->offset, priv->len)) goto err;
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 4/8 netfilter: ipset: remove rcu_read_lock_bh pair from ip_set_test
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
Callers already hold rcu_read_lock.
Prior to RCU conversion this used to be a read_lock_bh(), but now the bh-disable isn't needed anymore.
--- net/netfilter/ipset/ip_set_core.c | 2 -- 1 file changed, 2 deletions(-)
net/netfilter/ipset/ip_set_core.c +0 -2
@@ -739,9 +739,7 @@ ip_set_test(ip_set_id_t index, const struct sk_buff *skb, !(opt->family == set->family || set->family == NFPROTO_UNSPEC))return 0 ; -rcu_read_lock_bh (); ret = set->variant->kadt (set, skb, par,IPSET_TEST , opt); -rcu_read_unlock_bh ();if (ret == -EAGAIN ) {/* Type requests element to be completed */
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 5/8 netfilter: nf_tables: permit update of set size
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
Now that set->nelems is always updated permit update of the sets max size.
--- include/net/netfilter/nf_tables.h | 3 +++ net/netfilter/nf_tables_api.c | 4 ++++ 2 files changed, 7 insertions(+)
include/net/netfilter/nf_tables.h +3 -0
@@ -1589,6 +1589,7 @@ struct nft_trans_set {u64 timeout;bool update;bool bound; +u32 size; };#define nft_trans_set (trans) \
@@ -1603,6 +1604,8 @@ struct nft_trans_set { (((struct nft_trans_set *)trans->data)->timeout)#define nft_trans_set_gc_int (trans) \ (((struct nft_trans_set *)trans->data)->gc_int) +#define nft_trans_set_size (trans) \ + (((struct nft_trans_set *)trans->data)->size)struct nft_trans_chain {bool update;
net/netfilter/nf_tables_api.c +4 -0
@@ -483,6 +483,7 @@ static int __nft_trans_set_add(const struct nft_ctx *ctx, int msg_type,nft_trans_set_update (trans) = true;nft_trans_set_gc_int (trans) = desc->gc_int;nft_trans_set_timeout (trans) = desc->timeout; +nft_trans_set_size (trans) = desc->size; }nft_trans_commit_list_add_tail (ctx->net, trans);
@@ -9428,6 +9429,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)WRITE_ONCE (set->timeout,nft_trans_set_timeout (trans));WRITE_ONCE (set->gc_int,nft_trans_set_gc_int (trans)); + +if (nft_trans_set_size (trans)) +WRITE_ONCE (set->size,nft_trans_set_size (trans)); }else {nft_clear (net,nft_trans_set (trans));/* This avoids hitting -EBUSY when deleting the table
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 6/8 netfilter: snat: evict closing tcp entries on reply tuple collision
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
When all tried source tuples are in use, the connection request (skb) and the new conntrack will be dropped in nf_confirm() due to the non-recoverable clash.
Make it so that the last 32 attempts are allowed to evict a colliding entry if this connection is already closing and the new sequence number has advanced past the old one.
Such "all tuples taken" secenario can happen with tcp-rpc workloads where same dst:dport gets queried repeatedly.
--- net/netfilter/nf_nat_core.c | 92 +++++++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-)
net/netfilter/nf_nat_core.c +88 -4
@@ -27,6 +27,9 @@#include "nf_internals.h" +#define NF_NAT_MAX_ATTEMPTS 128 +#define NF_NAT_HARDER_THRESH (NF_NAT_MAX_ATTEMPTS / 4) +static spinlock_t nf_nat_locks[CONNTRACK_LOCKS ];static DEFINE_MUTEX (nf_nat_proto_mutex);
@@ -197,6 +200,88 @@ nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,return nf_conntrack_tuple_taken (&reply, ignored_conntrack); } +static bool nf_nat_may_kill (struct nf_conn *ct,unsigned long flags) +{ +static const unsigned long flags_refuse =IPS_FIXED_TIMEOUT | +IPS_DYING ; +static const unsigned long flags_needed =IPS_SRC_NAT ; +enum tcp_conntrack old_state; + + old_state =READ_ONCE (ct->proto.tcp.state); +if (old_state <TCP_CONNTRACK_TIME_WAIT ) +return false; + +if (flags & flags_refuse) +return false; + +return (flags & flags_needed) == flags_needed; +} + +/* reverse direction will send packets to new source, so +* make sure such packets are invalid. +*/ +static bool nf_seq_has_advanced (const struct nf_conn *old,const struct nf_conn *new) +{ +return (__s32)(new->proto.tcp.seen[0 ].td_end - + old->proto.tcp.seen[0 ].td_end) >0 ; +} + +static int +nf_nat_used_tuple_harder (const struct nf_conntrack_tuple *tuple, +const struct nf_conn *ignored_conntrack, +unsigned int attempts_left) +{ +static const unsigned long flags_offload =IPS_OFFLOAD |IPS_HW_OFFLOAD ; +struct nf_conntrack_tuple_hash *thash; +const struct nf_conntrack_zone *zone; +struct nf_conntrack_tuple reply; +unsigned long flags; +struct nf_conn *ct; +bool taken = true; +struct net *net; + +nf_ct_invert_tuple (&reply, tuple); + +if (attempts_left >NF_NAT_HARDER_THRESH || + tuple->dst.protonum !=IPPROTO_TCP || + ignored_conntrack->proto.tcp.state !=TCP_CONNTRACK_SYN_SENT ) +return nf_conntrack_tuple_taken (&reply, ignored_conntrack); + +/* :ast few attempts to find a free tcp port. Destructive +* action: evict colliding if its in timewait state and the +* tcp sequence number has advanced past the one used by the +* old entry. +*/ + net =nf_ct_net (ignored_conntrack); + zone =nf_ct_zone (ignored_conntrack); + + thash =nf_conntrack_find_get (net, zone, &reply); +if (!thash) +return false; + + ct =nf_ct_tuplehash_to_ctrack (thash); + +if (thash->tuple.dst.dir ==IP_CT_DIR_ORIGINAL ) + goto out; + +if (WARN_ON_ONCE (ct == ignored_conntrack)) + goto out; + + flags =READ_ONCE (ct->status); +if (!nf_nat_may_kill (ct, flags)) + goto out; + +if (!nf_seq_has_advanced (ct, ignored_conntrack)) + goto out; + +/* Even if we can evict do not reuse if entry is offloaded. */ +if (nf_ct_kill (ct)) + taken = flags & flags_offload; +out: +nf_ct_put (ct); +return taken; +} +static bool nf_nat_inet_in_range (const struct nf_conntrack_tuple *t,const struct nf_nat_range2 *range) {
@@ -385,7 +470,6 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,unsigned int range_size, min, max, i, attempts;__be16 *keyptr;u16 off; -static const unsigned int max_attempts =128 ;switch (tuple->dst.protonum) {case IPPROTO_ICMP :
@@ -471,8 +555,8 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, off =get_random_u16 (); attempts = range_size; -if (attempts > max_attempts) - attempts = max_attempts; +if (attempts >NF_NAT_MAX_ATTEMPTS ) + attempts =NF_NAT_MAX_ATTEMPTS ;/* We are in softirq; doing a search of the entire range risks * soft lockup when all tuples are already used.
@@ -483,7 +567,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, another_round:for (i =0 ; i < attempts; i++, off++) { *keyptr =htons (min + off % range_size); -if (!nf_nat_used_tuple (tuple, ct)) +if (!nf_nat_used_tuple_harder (tuple, ct, attempts - i))return ; }
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 7/8 netfilter: nf_tables: Introduce NFT_MSG_GETSETELEM_RESET
In reply to Pablo Neira AyusoFrom: Phil Sutter <[email protected]>
Analogous to NFT_MSG_GETOBJ_RESET, but for set elements with a timeout or attached stateful expressions like counters or quotas - reset them all at once. Respect a per element timeout value if present to reset the 'expires' value to.
--- include/uapi/linux/netfilter/nf_tables.h | 2 + net/netfilter/nf_tables_api.c | 68 +++++++++++++++++------- 2 files changed, 50 insertions(+), 20 deletions(-)
include/uapi/linux/netfilter/nf_tables.h +2 -0
@@ -105,6 +105,7 @@ enum nft_verdicts {* @NFT_MSG_DESTROYSETELEM: destroy a set element (enum nft_set_elem_attributes) * @NFT_MSG_DESTROYOBJ: destroy a stateful object (enum nft_object_attributes) * @NFT_MSG_DESTROYFLOWTABLE: destroy flow table (enum nft_flowtable_attributes) +* @NFT_MSG_GETSETELEM_RESET: get set elements and reset attached stateful expressions (enum nft_set_elem_attributes) */ enum nf_tables_msg_types {NFT_MSG_NEWTABLE ,
@@ -140,6 +141,7 @@ enum nf_tables_msg_types {NFT_MSG_DESTROYSETELEM ,NFT_MSG_DESTROYOBJ ,NFT_MSG_DESTROYFLOWTABLE , +NFT_MSG_GETSETELEM_RESET , NFT_MSG_MAX, };
net/netfilter/nf_tables_api.c +48 -20
207 lines not on this page · raw message
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 8/8 netfilter: nf_tables: limit allowed range via nla_policy
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
These NLA_U32 types get stored in u8 fields, reject invalid values instead of silently casting to u8.
--- net/netfilter/nft_bitwise.c | 2 +- net/netfilter/nft_byteorder.c | 6 +++--- net/netfilter/nft_ct.c | 2 +- net/netfilter/nft_dynset.c | 2 +- net/netfilter/nft_exthdr.c | 4 ++-- net/netfilter/nft_fwd_netdev.c | 2 +- net/netfilter/nft_hash.c | 2 +- net/netfilter/nft_meta.c | 2 +- net/netfilter/nft_range.c | 2 +- net/netfilter/nft_reject.c | 2 +- net/netfilter/nft_rt.c | 2 +- net/netfilter/nft_socket.c | 4 ++-- net/netfilter/nft_tproxy.c | 2 +- net/netfilter/nft_tunnel.c | 4 ++-- net/netfilter/nft_xfrm.c | 4 ++-- 15 files changed, 21 insertions(+), 21 deletions(-)
net/netfilter/nft_bitwise.c +1 -1
@@ -86,7 +86,7 @@ static const struct nla_policy nft_bitwise_policy[NFTA_BITWISE_MAX + 1] = { [NFTA_BITWISE_LEN] = { .type = NLA_U32 }, [NFTA_BITWISE_MASK] = { .type = NLA_NESTED }, [NFTA_BITWISE_XOR] = { .type = NLA_NESTED }, - [NFTA_BITWISE_OP] = { .type = NLA_U32 }, + [NFTA_BITWISE_OP] = NLA_POLICY_MAX(NLA_BE32, 255), [NFTA_BITWISE_DATA] = { .type = NLA_NESTED }, };
net/netfilter/nft_byteorder.c +3 -3
@@ -88,9 +88,9 @@ void nft_byteorder_eval(const struct nft_expr *expr,static const struct nla_policy nft_byteorder_policy[NFTA_BYTEORDER_MAX +1 ] = { [NFTA_BYTEORDER_SREG ] = { .type =NLA_U32 }, [NFTA_BYTEORDER_DREG ] = { .type =NLA_U32 }, - [NFTA_BYTEORDER_OP ] = { .type =NLA_U32 }, - [NFTA_BYTEORDER_LEN ] = { .type =NLA_U32 }, - [NFTA_BYTEORDER_SIZE ] = { .type =NLA_U32 }, + [NFTA_BYTEORDER_OP ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), + [NFTA_BYTEORDER_LEN ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), + [NFTA_BYTEORDER_SIZE ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), }; static int nft_byteorder_init(const struct nft_ctx *ctx,
net/netfilter/nft_ct.c +1 -1
@@ -332,7 +332,7 @@ static void nft_ct_set_eval(const struct nft_expr *expr,static const struct nla_policy nft_ct_policy[NFTA_CT_MAX +1 ] = { [NFTA_CT_DREG ] = { .type =NLA_U32 }, - [NFTA_CT_KEY ] = { .type =NLA_U32 }, + [NFTA_CT_KEY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_CT_DIRECTION ] = { .type =NLA_U8 }, [NFTA_CT_SREG ] = { .type =NLA_U32 }, };
net/netfilter/nft_dynset.c +1 -1
@@ -148,7 +148,7 @@ static const struct nla_policy nft_dynset_policy[NFTA_DYNSET_MAX + 1] = { [NFTA_DYNSET_SET_NAME] = { .type = NLA_STRING, .len = NFT_SET_MAXNAMELEN - 1 }, [NFTA_DYNSET_SET_ID] = { .type = NLA_U32 }, - [NFTA_DYNSET_OP] = { .type = NLA_U32 }, + [NFTA_DYNSET_OP] = NLA_POLICY_MAX(NLA_BE32, 255), [NFTA_DYNSET_SREG_KEY] = { .type = NLA_U32 }, [NFTA_DYNSET_SREG_DATA] = { .type = NLA_U32 }, [NFTA_DYNSET_TIMEOUT] = { .type = NLA_U64 },
net/netfilter/nft_exthdr.c +2 -2
@@ -487,9 +487,9 @@ static const struct nla_policy nft_exthdr_policy[NFTA_EXTHDR_MAX + 1] = { [NFTA_EXTHDR_DREG] = { .type = NLA_U32 }, [NFTA_EXTHDR_TYPE] = { .type = NLA_U8 }, [NFTA_EXTHDR_OFFSET] = { .type = NLA_U32 }, - [NFTA_EXTHDR_LEN] = { .type = NLA_U32 }, + [NFTA_EXTHDR_LEN] = NLA_POLICY_MAX(NLA_BE32, 255), [NFTA_EXTHDR_FLAGS] = { .type = NLA_U32 }, - [NFTA_EXTHDR_OP] = { .type = NLA_U32 }, + [NFTA_EXTHDR_OP] = NLA_POLICY_MAX(NLA_BE32, 255), [NFTA_EXTHDR_SREG] = { .type = NLA_U32 }, };
net/netfilter/nft_fwd_netdev.c +1 -1
@@ -40,7 +40,7 @@ static void nft_fwd_netdev_eval(const struct nft_expr *expr,static const struct nla_policy nft_fwd_netdev_policy[NFTA_FWD_MAX +1 ] = { [NFTA_FWD_SREG_DEV ] = { .type =NLA_U32 }, [NFTA_FWD_SREG_ADDR ] = { .type =NLA_U32 }, - [NFTA_FWD_NFPROTO ] = { .type =NLA_U32 }, + [NFTA_FWD_NFPROTO ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), }; static int nft_fwd_netdev_init(const struct nft_ctx *ctx,
net/netfilter/nft_hash.c +1 -1
@@ -59,7 +59,7 @@ static void nft_symhash_eval(const struct nft_expr *expr,static const struct nla_policy nft_hash_policy[NFTA_HASH_MAX +1 ] = { [NFTA_HASH_SREG ] = { .type =NLA_U32 }, [NFTA_HASH_DREG ] = { .type =NLA_U32 }, - [NFTA_HASH_LEN ] = { .type =NLA_U32 }, + [NFTA_HASH_LEN ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_HASH_MODULUS ] = { .type =NLA_U32 }, [NFTA_HASH_SEED ] = { .type =NLA_U32 }, [NFTA_HASH_OFFSET ] = { .type =NLA_U32 },
net/netfilter/nft_meta.c +1 -1
@@ -458,7 +458,7 @@ EXPORT_SYMBOL_GPL(nft_meta_set_eval);const struct nla_policy nft_meta_policy[NFTA_META_MAX +1 ] = { [NFTA_META_DREG ] = { .type =NLA_U32 }, - [NFTA_META_KEY ] = { .type =NLA_U32 }, + [NFTA_META_KEY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_META_SREG ] = { .type =NLA_U32 }, };EXPORT_SYMBOL_GPL (nft_meta_policy);
net/netfilter/nft_range.c +1 -1
@@ -42,7 +42,7 @@ void nft_range_eval(const struct nft_expr *expr,static const struct nla_policy nft_range_policy[NFTA_RANGE_MAX +1 ] = { [NFTA_RANGE_SREG ] = { .type =NLA_U32 }, - [NFTA_RANGE_OP ] = { .type =NLA_U32 }, + [NFTA_RANGE_OP ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_RANGE_FROM_DATA ] = { .type =NLA_NESTED }, [NFTA_RANGE_TO_DATA ] = { .type =NLA_NESTED }, };
net/netfilter/nft_reject.c +1 -1
@@ -18,7 +18,7 @@#include <linux/icmpv6.h> const struct nla_policy nft_reject_policy[NFTA_REJECT_MAX +1 ] = { - [NFTA_REJECT_TYPE ] = { .type =NLA_U32 }, + [NFTA_REJECT_TYPE ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_REJECT_ICMP_CODE ] = { .type =NLA_U8 }, };EXPORT_SYMBOL_GPL (nft_reject_policy);
net/netfilter/nft_rt.c +1 -1
@@ -104,7 +104,7 @@ void nft_rt_get_eval(const struct nft_expr *expr,static const struct nla_policy nft_rt_policy[NFTA_RT_MAX +1 ] = { [NFTA_RT_DREG ] = { .type =NLA_U32 }, - [NFTA_RT_KEY ] = { .type =NLA_U32 }, + [NFTA_RT_KEY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), }; static int nft_rt_get_init(const struct nft_ctx *ctx,
net/netfilter/nft_socket.c +2 -2
@@ -138,9 +138,9 @@ static void nft_socket_eval(const struct nft_expr *expr, }static const struct nla_policy nft_socket_policy[NFTA_SOCKET_MAX +1 ] = { - [NFTA_SOCKET_KEY ] = { .type =NLA_U32 }, + [NFTA_SOCKET_KEY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_SOCKET_DREG ] = { .type =NLA_U32 }, - [NFTA_SOCKET_LEVEL ] = { .type =NLA_U32 }, + [NFTA_SOCKET_LEVEL ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), }; static int nft_socket_init(const struct nft_ctx *ctx,
net/netfilter/nft_tproxy.c +1 -1
@@ -183,7 +183,7 @@ static void nft_tproxy_eval(const struct nft_expr *expr, }static const struct nla_policy nft_tproxy_policy[NFTA_TPROXY_MAX +1 ] = { - [NFTA_TPROXY_FAMILY ] = { .type =NLA_U32 }, + [NFTA_TPROXY_FAMILY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_TPROXY_REG_ADDR ] = { .type =NLA_U32 }, [NFTA_TPROXY_REG_PORT ] = { .type =NLA_U32 }, };
net/netfilter/nft_tunnel.c +2 -2
@@ -66,9 +66,9 @@ static void nft_tunnel_get_eval(const struct nft_expr *expr, }static const struct nla_policy nft_tunnel_policy[NFTA_TUNNEL_MAX +1 ] = { - [NFTA_TUNNEL_KEY ] = { .type =NLA_U32 }, + [NFTA_TUNNEL_KEY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_TUNNEL_DREG ] = { .type =NLA_U32 }, - [NFTA_TUNNEL_MODE ] = { .type =NLA_U32 }, + [NFTA_TUNNEL_MODE ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), }; static int nft_tunnel_get_init(const struct nft_ctx *ctx,
net/netfilter/nft_xfrm.c +2 -2
@@ -16,9 +16,9 @@#include <net/xfrm.h> static const struct nla_policy nft_xfrm_policy[NFTA_XFRM_MAX +1 ] = { - [NFTA_XFRM_KEY ] = { .type =NLA_U32 }, + [NFTA_XFRM_KEY ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_XFRM_DIR ] = { .type =NLA_U8 }, - [NFTA_XFRM_SPNUM ] = { .type =NLA_U32 }, + [NFTA_XFRM_SPNUM ] =NLA_POLICY_MAX (NLA_BE32 ,255 ), [NFTA_XFRM_DREG ] = { .type =NLA_U32 }, };
Signature · 1 line
2.30.2