Skip to content

Commit 044c8bf

Browse files
author
Paolo Abeni
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pablo Neira Ayuso says: ==================== Netfilter fixes for net The following patchset contains Netfilter fixes for net: 1) Fix bogus error report in selftests/netfilter/nft_nat.sh, from Hangbin Liu. 2) Initialize last and quota expressions from template when expr_ops::clone is called, otherwise, states are not restored accordingly when loading a dynamic set with elements using these two expressions. * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf: netfilter: nft_quota: copy content when cloning expression netfilter: nft_last: copy content when cloning expression selftests: nft_nat: ensuring the listening side is up before starting the client ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents f322136 + aabef97 commit 044c8bf

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

net/netfilter/nft_last.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ static void nft_last_destroy(const struct nft_ctx *ctx,
105105
static int nft_last_clone(struct nft_expr *dst, const struct nft_expr *src)
106106
{
107107
struct nft_last_priv *priv_dst = nft_expr_priv(dst);
108+
struct nft_last_priv *priv_src = nft_expr_priv(src);
108109

109110
priv_dst->last = kzalloc(sizeof(*priv_dst->last), GFP_ATOMIC);
110111
if (!priv_dst->last)
111112
return -ENOMEM;
112113

114+
priv_dst->last->set = priv_src->last->set;
115+
priv_dst->last->jiffies = priv_src->last->jiffies;
116+
113117
return 0;
114118
}
115119

net/netfilter/nft_quota.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,16 @@ static void nft_quota_destroy(const struct nft_ctx *ctx,
236236
static int nft_quota_clone(struct nft_expr *dst, const struct nft_expr *src)
237237
{
238238
struct nft_quota *priv_dst = nft_expr_priv(dst);
239+
struct nft_quota *priv_src = nft_expr_priv(src);
240+
241+
priv_dst->quota = priv_src->quota;
242+
priv_dst->flags = priv_src->flags;
239243

240244
priv_dst->consumed = kmalloc(sizeof(*priv_dst->consumed), GFP_ATOMIC);
241245
if (!priv_dst->consumed)
242246
return -ENOMEM;
243247

244-
atomic64_set(priv_dst->consumed, 0);
248+
*priv_dst->consumed = *priv_src->consumed;
245249

246250
return 0;
247251
}

tools/testing/selftests/netfilter/nft_nat.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ EOF
404404
echo SERVER-$family | ip netns exec "$ns1" timeout 5 socat -u STDIN TCP-LISTEN:2000 &
405405
sc_s=$!
406406

407+
sleep 1
408+
407409
result=$(ip netns exec "$ns0" timeout 1 socat TCP:$daddr:2000 STDOUT)
408410

409411
if [ "$result" = "SERVER-inet" ];then

0 commit comments

Comments
 (0)