--- zzzz-none-000/linux-5.4.213/net/netfilter/nf_tables_api.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/net/netfilter/nf_tables_api.c 2024-05-29 11:20:02.000000000 +0000 @@ -5758,6 +5758,13 @@ if (err < 0) return err; + for (i = 0; i < n; i++) { + if (flowtable->data.flags & NF_FLOWTABLE_F_HW && + !dev_array[i]->netdev_ops->ndo_flow_offload) { + return -EOPNOTSUPP; + } + } + ops = kcalloc(n, sizeof(struct nf_hook_ops), GFP_KERNEL); if (!ops) return -ENOMEM; @@ -5888,10 +5895,19 @@ } flowtable->data.type = type; + write_pnet(&flowtable->data.ft_net, net); + err = type->init(&flowtable->data); if (err < 0) goto err3; + if (nla[NFTA_FLOWTABLE_FLAGS]) { + flowtable->data.flags = + ntohl(nla_get_be32(nla[NFTA_FLOWTABLE_FLAGS])); + if (flowtable->data.flags & ~NF_FLOWTABLE_F_HW) + goto err4; + } + err = nf_tables_flowtable_parse_hook(&ctx, nla[NFTA_FLOWTABLE_HOOK], flowtable); if (err < 0) @@ -6017,7 +6033,8 @@ nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || nla_put_be32(skb, NFTA_FLOWTABLE_USE, htonl(flowtable->use)) || nla_put_be64(skb, NFTA_FLOWTABLE_HANDLE, cpu_to_be64(flowtable->handle), - NFTA_FLOWTABLE_PAD)) + NFTA_FLOWTABLE_PAD) || + nla_put_be32(skb, NFTA_FLOWTABLE_FLAGS, htonl(flowtable->data.flags))) goto nla_put_failure; nest = nla_nest_start_noflag(skb, NFTA_FLOWTABLE_HOOK);