Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Browse files Browse the repository at this point in the history
Pablo Neira Ayuso says:

====================
Netfilter fixes for net

1) Module autoload for masquerade and redirection does not work.

2) Leak in unqueued packets in nf_ct_frag6_queue(). Ignore duplicated
   fragments, pretend they are placed into the queue. Patches from
   Guillaume Nault.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Jun 19, 2019
2 parents cb359b6 + 8a3dca6 commit d470e72
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
22 changes: 12 additions & 10 deletions net/ipv6/netfilter/nf_conntrack_reasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,14 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,

prev = fq->q.fragments_tail;
err = inet_frag_queue_insert(&fq->q, skb, offset, end);
if (err)
if (err) {
if (err == IPFRAG_DUP) {
/* No error for duplicates, pretend they got queued. */
kfree_skb(skb);
return -EINPROGRESS;
}
goto insert_error;
}

if (dev)
fq->iif = dev->ifindex;
Expand All @@ -289,15 +295,17 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
skb->_skb_refdst = 0UL;
err = nf_ct_frag6_reasm(fq, skb, prev, dev);
skb->_skb_refdst = orefdst;
return err;

/* After queue has assumed skb ownership, only 0 or
* -EINPROGRESS must be returned.
*/
return err ? -EINPROGRESS : 0;
}

skb_dst_drop(skb);
return -EINPROGRESS;

insert_error:
if (err == IPFRAG_DUP)
goto err;
inet_frag_kill(&fq->q);
err:
skb_dst_drop(skb);
Expand Down Expand Up @@ -476,12 +484,6 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
ret = 0;
}

/* after queue has assumed skb ownership, only 0 or -EINPROGRESS
* must be returned.
*/
if (ret)
ret = -EINPROGRESS;

spin_unlock_bh(&fq->q.lock);
inet_frag_put(&fq->q);
return ret;
Expand Down
3 changes: 1 addition & 2 deletions net/netfilter/nft_masq.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,4 @@ module_exit(nft_masq_module_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arturo Borrero Gonzalez <[email protected]>");
MODULE_ALIAS_NFT_AF_EXPR(AF_INET6, "masq");
MODULE_ALIAS_NFT_AF_EXPR(AF_INET, "masq");
MODULE_ALIAS_NFT_EXPR("masq");
3 changes: 1 addition & 2 deletions net/netfilter/nft_redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,5 +294,4 @@ module_exit(nft_redir_module_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arturo Borrero Gonzalez <[email protected]>");
MODULE_ALIAS_NFT_AF_EXPR(AF_INET, "redir");
MODULE_ALIAS_NFT_AF_EXPR(AF_INET6, "redir");
MODULE_ALIAS_NFT_EXPR("nat");

0 comments on commit d470e72

Please sign in to comment.