netfilter: add restrictions/validations for packet rewrite
Subsystems (2)
Florian Westphal
maintainerv2 cover netfilter: add restrictions/validations for packet rewrite
Changes since v1:
- add patch 3. Patches 1 and 2 are unchanged.
1) Restrict nfnetlink_queue writes to the network header. Validate IP/IPv6 headers and disable IPv6 extension header changes. Ensure total length matches skb length.
2) Restrict nft_payload writes to linklayer and network header data. Prevent linklayer writes from spilling into network headers. Validate network header updates to protect IP version and length fields.
3) add restrictions to the checksum offset, without this patch 2 isn't sufficient because an invalid checksum offset can e.g. overwrite iph header length field.
This doesn't remove the userns restriction, yet.
I would like to wait a bit before re-enabling this to make sure there are no other gaps (e.g. for encapsulated traffic).
Florian Westphal (3):
netfilter: nfnetlink_queue: restrict writes to network header
netfilter: nftables: restrict linklayer and network header writes
netfilter: nftables: restrict checkum update offset
net/netfilter/nfnetlink_queue.c | 192 +++++++++++++++++++++++ net/netfilter/nft_payload.c | 270 ++++++++++++++++++++++++++++++++ 2 files changed, 462 insertions(+)
Signature · 1 line
2.53.0
Florian Westphal
maintainerPATCH v2 1/3 netfilter: nfnetlink_queue: restrict writes to network header
nfnetlink_queue doesn't allow selective replacements of some part of the payload, only complete replacement.
If the new data is shorter, skb is trimmed, otherwise expanded.
Add minimal validation of the new ip/ipv6 header.
Check total len matches skb length. Disallow
ip option modifications after prerouting.
IPv6 extension headers are also disabled.
IP options and exthdrs could be allowed later after validation pass or ip option recompile.
Transport header is not checked.
Bridge gets no validation other than size isn't below ethernet header size.
--- net/netfilter/nfnetlink_queue.c | 192 ++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+)
net/netfilter/nfnetlink_queue.c +192 -0
@@ -1136,6 +1136,195 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)return err; } +static bool nfqnl_validate_ipopts (const struct iphdr *iph_new, +const struct nf_queue_entry *e) +{ +const struct iphdr *iph_orig =ip_hdr (e->skb); +unsigned int ihl = iph_new->ihl *4 ; + +if (iph_new->ihl != iph_orig->ihl) +return false; +if (ihl ==sizeof (*iph_orig)) +return true; + +return memcmp (iph_new +1 ,ip_hdr (e->skb) +1 , ihl -sizeof (*iph_orig)) ==0 ; +} + +static bool nfqnl_validate_ip4 (const struct iphdr *iph,unsigned int data_len, +const struct nf_queue_entry *e) +{ +unsigned int ihl; + +if (data_len <sizeof (*iph)) +return false; + + ihl = iph->ihl *4u ; +if (ihl <sizeof (*iph) || data_len < ihl) +return false; + +if (iph->version !=4 || + ((iph->frag_off ^ip_hdr (e->skb)->frag_off) & ~htons (IP_DF )) !=0 ) +return false; + +/* BIG TCP won't work; netlink attr len is u16 */ +if (ntohs (iph->tot_len) != data_len) +return false; + +/* support for ipopts mangling would require +* recompile + skb transport header update. +*/ +return nfqnl_validate_ipopts (iph, e); +} + +static bool nfqnl_validate_one_exthdr (const u8 *data, +unsigned int data_len, +const struct nf_queue_entry *e, +int start,int hdrlen) +{ +u16 octets; + +if (data_len < hdrlen || hdrlen <2 ) +return false; + +while (hdrlen >0 ) { +if (data_len <sizeof (octets)) +return false; + data_len -=sizeof (octets); + +if (skb_copy_bits (e->skb, start, &octets,sizeof (octets))) +return false; + +if (hdrlen <sizeof (octets)) +return false; + + hdrlen -=sizeof (octets); +if (memcmp (data, &octets,sizeof (octets))) +return false; + + start +=sizeof (octets); + data +=sizeof (octets); + } + +return true; +} + +static bool nfqnl_validate_exthdr (const struct ipv6hdr *ip6_new, +unsigned int data_len, +const struct nf_queue_entry *e) +{ +const struct ipv6hdr *ip6_orig =ipv6_hdr (e->skb); +int exthdr_cnt =0 , start =sizeof (*ip6_orig); +const u8 *data = (const u8 *)ip6_new; +u8 orig_nexthdr = ip6_orig->nexthdr; +u8 new_nexthdr = ip6_new->nexthdr; + +if (new_nexthdr != orig_nexthdr) +return false; + + data +=sizeof (*ip6_new); + data_len -=sizeof (*ip6_new); + +while (ipv6_ext_hdr (orig_nexthdr)) { +const struct ipv6_opt_hdr *hp; +struct ipv6_opt_hdr _hdr; +int hdrlen; + +if (orig_nexthdr ==NEXTHDR_NONE ) +return true; + +if (unlikely (exthdr_cnt++ >=IP6_MAX_EXT_HDRS_CNT )) +return false; + + hp =skb_header_pointer (e->skb, start,sizeof (_hdr), &_hdr); +if (!hp) +return false; + +switch (orig_nexthdr) { +case NEXTHDR_FRAGMENT : + hdrlen =sizeof (struct frag_hdr ); +break ; +case NEXTHDR_AUTH : + hdrlen =ipv6_authlen (hp); +break ; +default : + hdrlen =ipv6_optlen (hp); +break ; + } + +if (!nfqnl_validate_one_exthdr (data, data_len, e, + start, hdrlen)) +return false; + + orig_nexthdr = hp->nexthdr; + hp = (const void *)data; + new_nexthdr = hp->nexthdr; + +if (new_nexthdr != orig_nexthdr) +return false; + + data_len -= hdrlen; + start += hdrlen; + data += hdrlen; + } + +return true; +} + +static bool nfqnl_validate_ip6 (const struct ipv6hdr *ip6,unsigned int data_len, +const struct nf_queue_entry *e) +{ +if (data_len <sizeof (*ip6)) +return false; + +/* BIG TCP/jumbograms won't work; netlink attr len is u16 */ +if (ntohs (ip6->payload_len) != data_len -sizeof (*ip6)) +return false; + +if (ip6->version !=6 ) +return false; + +return nfqnl_validate_exthdr (ip6, data_len, e); +} + +static bool nfqnl_validate_arp (unsigned int data_len) +{ +const unsigned int minsz =8 +2 *ETH_ALEN +2 *sizeof (__be32); + +/* don't allow truncation below min size */ +return data_len >= minsz; +} + +static bool nfqnl_validate_br (const struct ethhdr *eth,unsigned int data_len) +{ +#ifdef CONFIG_NETFILTER_FAMILY_BRIDGE +/* disallow truncation below ethernet header size */ +if (data_len <sizeof (*eth)) +return false; + +return true; +#else +return false; +#endif +} + +static bool nfqnl_validate_write (const void *data,unsigned int data_len, +const struct nf_queue_entry *e) +{ +switch (e->state.pf) { +case NFPROTO_ARP : +return nfqnl_validate_arp (data_len); +case NFPROTO_IPV4 : +return nfqnl_validate_ip4 (data, data_len, e); +case NFPROTO_IPV6 : +return nfqnl_validate_ip6 (data, data_len, e) && + !(IP6CB (e->skb)->flags &IP6SKB_JUMBOGRAM ); +case NFPROTO_BRIDGE : +return nfqnl_validate_br (data, data_len); + } + +return false; +} +static int nfqnl_mangle (void *data,unsigned int data_len,struct nf_queue_entry *e,int diff) {
@@ -1144,6 +1333,9 @@ nfqnl_mangle(void *data, unsigned int data_len, struct nf_queue_entry *e, int diif (e->state.net->user_ns != &init_user_ns)return -EPERM ; +if (!nfqnl_validate_write (data, data_len, e)) +return -EINVAL ; +if (diff <0 ) {unsigned int min_len =skb_transport_offset (e->skb);
Signature · 1 line
2.53.0
Florian Westphal
maintainerPATCH 1/1 netfilter: x_tables: avoid leaking percpu counter pointers
In reply to Florian WestphalFrom: Kyle Zeng <[email protected]>
The native and compat get-entries paths copy the fixed rule entry header from the kernelized rule blob to userspace before overwriting the entry's counter fields with a sanitized counter snapshot.
On SMP kernels, entry->counters.pcnt contains the percpu allocation address used by x_tables rule counters. A caller can provide a userspace buffer that faults during the initial fixed-header copy after pcnt has been copied but before the later sanitized counter copy runs. The syscall then returns -EFAULT while leaving the raw percpu pointer in userspace.
Copy only the fixed entry prefix before counters from the kernelized rule blob, then copy the sanitized counter snapshot into the counter field. Apply this ordering to the IPv4, IPv6, and ARP native and compat get-entries implementations so a fault cannot expose the internal percpu counter pointer.
--- net/ipv4/netfilter/arp_tables.c | 15 ++++++--------- net/ipv4/netfilter/ip_tables.c | 15 ++++++--------- net/ipv6/netfilter/ip6_tables.c | 15 ++++++--------- 3 files changed, 18 insertions(+), 27 deletions(-)
net/ipv4/netfilter/arp_tables.c +6 -9
@@ -702,14 +702,12 @@ static int copy_entries_to_user(unsigned int total_size,const struct xt_entry_target *t; e = loc_cpu_entry + off; -if (copy_to_user (userptr + off, e,sizeof (*e))) { - ret = -EFAULT ; - goto free_counters; - } -if (copy_to_user (userptr + off +if (copy_to_user (userptr + off, e, + offsetof(struct arpt_entry , counters)) || +copy_to_user (userptr + off + offsetof(struct arpt_entry , counters), &counters[num], -sizeof (counters[num])) !=0 ) { +sizeof (counters[num]))) { ret = -EFAULT ; goto free_counters; }
@@ -1327,9 +1325,8 @@ static int compat_copy_entry_to_user(struct arpt_entry *e, void __user **dstptr, origsize = *size; ce = *dstptr; -if (copy_to_user (ce, e,sizeof (struct arpt_entry )) !=0 || -copy_to_user (&ce->counters, &counters[i], -sizeof (counters[i])) !=0 ) +if (copy_to_user (ce, e, offsetof(struct compat_arpt_entry , counters)) || +copy_to_user (&ce->counters, &counters[i],sizeof (counters[i])))return -EFAULT ; *dstptr +=sizeof (struct compat_arpt_entry );
net/ipv4/netfilter/ip_tables.c +6 -9
@@ -832,14 +832,12 @@ copy_entries_to_user(unsigned int total_size,const struct xt_entry_target *t; e = loc_cpu_entry + off; -if (copy_to_user (userptr + off, e,sizeof (*e))) { - ret = -EFAULT ; - goto free_counters; - } -if (copy_to_user (userptr + off +if (copy_to_user (userptr + off, e, + offsetof(struct ipt_entry , counters)) || +copy_to_user (userptr + off + offsetof(struct ipt_entry , counters), &counters[num], -sizeof (counters[num])) !=0 ) { +sizeof (counters[num]))) { ret = -EFAULT ; goto free_counters; }
@@ -1228,9 +1226,8 @@ compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr, origsize = *size; ce = *dstptr; -if (copy_to_user (ce, e,sizeof (struct ipt_entry )) !=0 || -copy_to_user (&ce->counters, &counters[i], -sizeof (counters[i])) !=0 ) +if (copy_to_user (ce, e, offsetof(struct compat_ipt_entry , counters)) || +copy_to_user (&ce->counters, &counters[i],sizeof (counters[i])))return -EFAULT ; *dstptr +=sizeof (struct compat_ipt_entry );
net/ipv6/netfilter/ip6_tables.c +6 -9
@@ -848,14 +848,12 @@ copy_entries_to_user(unsigned int total_size,const struct xt_entry_target *t; e = loc_cpu_entry + off; -if (copy_to_user (userptr + off, e,sizeof (*e))) { - ret = -EFAULT ; - goto free_counters; - } -if (copy_to_user (userptr + off +if (copy_to_user (userptr + off, e, + offsetof(struct ip6t_entry , counters)) || +copy_to_user (userptr + off + offsetof(struct ip6t_entry , counters), &counters[num], -sizeof (counters[num])) !=0 ) { +sizeof (counters[num]))) { ret = -EFAULT ; goto free_counters; }
@@ -1244,9 +1242,8 @@ compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr, origsize = *size; ce = *dstptr; -if (copy_to_user (ce, e,sizeof (struct ip6t_entry )) !=0 || -copy_to_user (&ce->counters, &counters[i], -sizeof (counters[i])) !=0 ) +if (copy_to_user (ce, e, offsetof(struct compat_ip6t_entry , counters)) || +copy_to_user (&ce->counters, &counters[i],sizeof (counters[i])))return -EFAULT ; *dstptr +=sizeof (struct compat_ip6t_entry );
Signature · 1 line
2.43.0
Florian Westphal
maintainerPATCH v2 2/3 netfilter: nftables: restrict linklayer and network header writes
In reply to Florian WestphalDon't permit arbitrary writes to linklayer and network header data. Several spots in network stack trust header validation performed in ipv4/ipv6 before PRE_ROUTING hook.
For linklayer, allow writes for netdev ingress. For other hooks, only allow link layer writes that do not spill into network header.
For network header, check the offset/length combinations:
- changing dscp requires store at offset 0 for checsum fixups, so make sure ip version + length field isn't altered.
- ip6 dscp starts directly after the version field, so make sure it remains 6.
Several of these checks could already be done at rule insertion time. Risk is that this might cause ruleset load failures for existing rulesets. With this change such writes are silently skipped and packet passes unchanged.
Transport and inner header bases are not checked / restricted.
--- net/netfilter/nft_payload.c | 170 ++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+)
net/netfilter/nft_payload.c +170 -0
@@ -824,6 +824,172 @@ nft_payload_set_vlan(const u32 *src, struct sk_buff *skb, u16 offset, u8 len,return true; } +/* Ingress is very early, before l3 protocol handlers. +* There should be no in-tree code that trusts l3/l4 headers +* between ingress and NF_INET_PRE_ROUTING hooks. +*/ +static bool nft_in_ingress (const struct nf_hook_state *s) +{ +return s->pf ==NFPROTO_NETDEV && s->hook ==NF_NETDEV_INGRESS ; +} + +static bool nft_nh_write_ok_ip4 (const struct nft_pktinfo *pkt, +const struct nft_payload_set *priv, +const u32 *src) +{ +unsigned int offset = priv->offset +skb_network_offset (pkt->skb); +const u8 *new_octets = (const u8 *)src; +u8 old_octet; + +switch (priv->offset) { +case 0 :/* csum fixups does expand dscp/tos store to 2 bytes. +* make sure ihl/version remain unchanged. +*/ +if (skb_copy_bits (pkt->skb, offset, &old_octet,sizeof (old_octet))) +return false; + +return priv->len ==2 && + *new_octets == old_octet; +case offsetof(struct iphdr , tos): +return priv->len ==1 ; +case offsetof(struct iphdr , id): +return priv->len ==2 ; +case offsetof(struct iphdr , ttl): +if (priv->len ==1 ) +return true; + +if (priv->len !=2 ) +return false; + +/* same, csum fixup does expand ttl store to two bytes. +* check protocol is not altered. +*/ +if (skb_copy_bits (pkt->skb, offset +1 , &old_octet,sizeof (old_octet))) +return false; + +return new_octets[1 ] == old_octet; +case offsetof(struct iphdr , check): +return priv->len <=2 +4 +4 ; +case offsetof(struct iphdr , saddr): +return priv->len <=4 +4 ; +case offsetof(struct iphdr , daddr): +return priv->len <=4 ; + } + +return false; +} + +static bool nft_nh_write_ok_ip6 (const struct nft_pktinfo *pkt, +const struct nft_payload_set *priv, +const u32 *src) +{ +const struct ipv6hdr *ih = (const void *)src; + +switch (priv->offset) { +case 0 :/* store to dscp must not alter ip6 version */ +return priv->len <=4 && ih->version ==6 ; +case 2 : +return priv->len <=2 ; +case offsetof(struct ipv6hdr , hop_limit): +return priv->len ==1 ; +case offsetof(struct ipv6hdr , saddr): +return priv->len <=16 +16 ; +case offsetof(struct ipv6hdr , daddr): +return priv->len <=16 ; + } + +return false; +} + +static bool nft_nh_write_ok_arp (const struct nft_payload_set *priv) +{ +/* Variable size for standard ethernet arp */ +const unsigned int eth_ip =2 * (ETH_ALEN +4 ); +unsigned int offset = priv->offset; + +switch (offset) { +case offsetof(struct arphdr , ar_op): +return priv->len ==2 ; +default : +break ; + } + +/* permit writes post fixed arp header size. offset + len are +* checked vs skb size via skb_ensure_writable. +*/ +return offset >=sizeof (struct arphdr ) && priv->len <= eth_ip; +} + +static bool nft_nh_write_ok_netdev (const struct nft_pktinfo *pkt, +const struct nft_payload_set *priv, +const u32 *src) +{ +#ifdef CONFIG_NF_TABLES_NETDEV +switch (pkt->skb->protocol) { +case htons (ETH_P_ARP ): +return nft_nh_write_ok_arp (priv); +case htons (ETH_P_IP ): +return nft_nh_write_ok_ip4 (pkt, priv, src); +case htons (ETH_P_IPV6 ): +return nft_nh_write_ok_ip6 (pkt, priv, src); + } +#endif +/* default to false for now, relax later in case we have +* use-cases that need inner header manipulation for +* encapsulated traffic like vlan or PPPoE. +*/ +return false; +} + +static bool nft_nh_write_ok_bridge (const struct nft_pktinfo *pkt, +const struct nft_payload_set *priv, +const u32 *src) +{ +#if IS_ENABLED (CONFIG_NF_TABLES_BRIDGE ) +switch (pkt->ethertype) { +case htons (ETH_P_ARP ): +return nft_nh_write_ok_arp (priv); +case htons (ETH_P_IP ): +return nft_nh_write_ok_ip4 (pkt, priv, src); +case htons (ETH_P_IPV6 ): +return nft_nh_write_ok_ip6 (pkt, priv, src); + } +#endif +/* see nft_nh_write_ok_netdev: default to false */ +return false; +} + +static bool nft_nh_write_ok (const struct nft_pktinfo *pkt, +const struct nft_payload_set *priv, +const u32 *src) +{ +switch (pkt->state->pf) { +case NFPROTO_ARP : +return nft_nh_write_ok_arp (priv); +case NFPROTO_BRIDGE : +return nft_nh_write_ok_bridge (pkt, priv, src); +case NFPROTO_IPV4 : +return nft_nh_write_ok_ip4 (pkt, priv, src); +case NFPROTO_IPV6 : +return nft_nh_write_ok_ip6 (pkt, priv, src); +case NFPROTO_NETDEV : +if (pkt->state->hook ==NF_NETDEV_INGRESS ) +return true; +return nft_nh_write_ok_netdev (pkt, priv, src); + } + +return false; +} + +/* check linklayer modifications don't spill into network header. */ +static bool nft_ll_write_ok (const struct nft_pktinfo *pkt,int offset) +{ +if (nft_in_ingress (pkt->state)) +return true; + +return offset <=skb_network_offset (pkt->skb); +} +static void nft_payload_set_eval (const struct nft_expr *expr,struct nft_regs *regs,const struct nft_pktinfo *pkt)
@@ -851,8 +1017,12 @@ static void nft_payload_set_eval(const struct nft_expr *expr, } offset =skb_mac_header (skb) - skb->data - vlan_hlen; +if (!nft_ll_write_ok (pkt, priv->len + priv->offset + offset)) + goto err;break ;case NFT_PAYLOAD_NETWORK_HEADER : +if (!nft_nh_write_ok (pkt, priv, src)) + goto err; offset =skb_network_offset (skb);break ;case NFT_PAYLOAD_TRANSPORT_HEADER :
Signature · 1 line
2.53.0
Florian Westphal
maintainerPATCH v2 3/3 netfilter: nftables: restrict checkum update offset
In reply to Florian WestphalAfter previous patch, writes to network header are restricted. However, there is another way to manipulate the l3 header: The checksum update function.
Restrict this for network header writes, only the ipv4 header is allowed. This needs run-time checks because BRIDGE, INET, NETDEV families can carry l3 headers other than IP.
checksum updates to the udp/tcp (l4) headers are not restricted.
--- net/netfilter/nft_payload.c | 100 ++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+)
net/netfilter/nft_payload.c +100 -0
@@ -990,6 +990,83 @@ static bool nft_ll_write_ok(const struct nft_pktinfo *pkt, int offset)return offset <=skb_network_offset (pkt->skb); } +static bool nft_payload_validate_inet_csum_offset (const struct nft_ctx *ctx, +const struct nft_payload_set *priv) +{ +switch (priv->base) { +case NFT_PAYLOAD_LL_HEADER : +break ; +case NFT_PAYLOAD_NETWORK_HEADER : +if (ctx->family ==NFPROTO_IPV4 ) { +if (offsetof(struct iphdr , check) == priv->csum_offset) +return true; + +return false; + } +return true;/* run time validation required */ +case NFT_PAYLOAD_TRANSPORT_HEADER : +if (priv->csum_flags)/* makes no sense, asks for "re-update" of L4 checksum */ +return false; + +/* no further check here; offset can't be negative so bogus +* offsets can corrupt L4 or payload but not l3 headers. +* We already allow arbitrary l4/inner payload writes. +*/ +return true; +case NFT_PAYLOAD_INNER_HEADER : +return true; +case NFT_PAYLOAD_TUN_HEADER : +break ; + } + +return false; +} + +/* do not allow arbitrary network header mangling via bogus csum_off. +* We only support ipv4. Only NFPROTO_IPV4 can be checked from control +* plane. +*/ +static bool nft_payload_csum_nh_write_ok (const struct nft_payload_set *priv, +const struct nft_pktinfo *pkt) +{ +switch (pkt->state->pf) { +case NFPROTO_IPV4 : +/* Warning: NFPROTO_INET was not checked; we can't return true here. */ +return priv->csum_offset == offsetof(struct iphdr , check); +case NFPROTO_IPV6 : +return false; +case NFPROTO_BRIDGE : +return pkt->ethertype ==htons (ETH_P_IP ) && + priv->csum_offset == offsetof(struct iphdr , check); +case NFPROTO_NETDEV : +return pkt->skb->protocol ==htons (ETH_P_IP ) && + priv->csum_offset == offsetof(struct iphdr , check); + } + +return false; +} + +static bool nft_payload_csum_write_ok (const struct nft_pktinfo *pkt, +const struct nft_payload_set *priv) +{ +switch (priv->base) { +case NFT_PAYLOAD_LL_HEADER : +break ; +case NFT_PAYLOAD_NETWORK_HEADER : +return nft_payload_csum_nh_write_ok (priv, pkt); +case NFT_PAYLOAD_TRANSPORT_HEADER : +case NFT_PAYLOAD_INNER_HEADER : +/* neither offsets are validated, offsets cannot be +* negative so real l3 headers cannot be mangled. +*/ +return true; +case NFT_PAYLOAD_TUN_HEADER : +break ; + } + +return false; +} +static void nft_payload_set_eval (const struct nft_expr *expr,struct nft_regs *regs,const struct nft_pktinfo *pkt)
@@ -1054,6 +1131,7 @@ static void nft_payload_set_eval(const struct nft_expr *expr, tsum =csum_partial (src, priv->len,0 );if (priv->csum_type ==NFT_PAYLOAD_CSUM_INET && +nft_payload_csum_write_ok (pkt, priv) &&nft_payload_csum_inet (skb, src, fsum, tsum, csum_offset)) goto err;
@@ -1120,7 +1198,26 @@ static int nft_payload_set_init(const struct nft_ctx *ctx,switch (csum_type) {case NFT_PAYLOAD_CSUM_NONE : +if (priv->csum_offset)/* nonsensical */ +return -EINVAL ; + +if (priv->csum_flags ==0 ) +break ; + +/* Userspace requests L4 checksum update, e.g.: +* - IPv6 stateless NAT (no l3 csum) +* - transport header mangling +* - inner data mangling +*/ +if (priv->base ==NFT_PAYLOAD_NETWORK_HEADER || + priv->base ==NFT_PAYLOAD_TRANSPORT_HEADER || + priv->base ==NFT_PAYLOAD_INNER_HEADER ) +break ; + +return -EINVAL ;case NFT_PAYLOAD_CSUM_INET : +if (!nft_payload_validate_inet_csum_offset (ctx, priv)) +return -EINVAL ;break ;case NFT_PAYLOAD_CSUM_SCTP :if (priv->base !=NFT_PAYLOAD_TRANSPORT_HEADER )
@@ -1128,6 +1225,9 @@ static int nft_payload_set_init(const struct nft_ctx *ctx,if (priv->csum_offset != offsetof(struct sctphdr , checksum))return -EINVAL ; + +if (priv->csum_flags) +return -EINVAL ;break ;default :return -EOPNOTSUPP ;
Signature · 1 line
2.53.0