netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next] netfilter: x_tables: add context to know if extension runs from nft_compat
Date: Mon, 2 Mar 2015 14:58:23 +0100	[thread overview]
Message-ID: <20150302135823.GB21965@salvia> (raw)
In-Reply-To: <20150302132657.GR6142@acer.localdomain>

On Mon, Mar 02, 2015 at 01:27:05PM +0000, Patrick McHardy wrote:
> On 02.03, Florian Westphal wrote:
> > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > 2) TCPMSS. Relax the checking when used from nft_compat and make sure
> > >    that we skip !syn packets in case userspace provides a wrong
> > >    configuration.
> > > diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
> > > index e762de5..3b9761f 100644
> > > --- a/net/netfilter/xt_TCPMSS.c
> > > +++ b/net/netfilter/xt_TCPMSS.c
> > > @@ -97,6 +97,9 @@ tcpmss_mangle_packet(struct sk_buff *skb,
> > >  	if (!skb_make_writable(skb, skb->len))
> > >  		return -1;
> > >  
> > > +	if (unlikely(!tcph->syn))
> > > +		return 0;
> > > +
> > >  	len = skb->len - tcphoff;
> > 
> > Applying this to my copy of nf-next would insert this test before
> > tcph is set up.
> 
> I actually don't think the test is necessary at all. Since we
> don't check the protocol with nft, any packet with that bit set
> will pass. It will most likely fail or corrupt the packet, but
> why should we care? It won't crash and with nft its the
> responsibility of userspace to take care of using the extension
> correctly.

According to what I can read from the code, it will corrupt the
packet since we will get a MSS option in non-syn TCP packet.

I thought we could crash, but looking at it again you seem to be
right, I'm going to undo this change and send a v2.

  reply	other threads:[~2015-03-02 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 13:11 [PATCH nf-next] netfilter: x_tables: add context to know if extension runs from nft_compat Pablo Neira Ayuso
2015-03-02 13:19 ` Patrick McHardy
2015-03-02 14:03   ` Pablo Neira Ayuso
2015-03-02 14:19     ` Patrick McHardy
2015-03-02 14:30       ` Pablo Neira Ayuso
2015-03-02 14:36         ` Patrick McHardy
2015-03-02 15:21           ` Pablo Neira Ayuso
2015-03-02 15:30             ` Patrick McHardy
2015-03-02 13:19 ` Florian Westphal
2015-03-02 13:27   ` Patrick McHardy
2015-03-02 13:58     ` Pablo Neira Ayuso [this message]
2015-03-02 13:50   ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302135823.GB21965@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).