From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH -next v3] netfilter: reject: don't send icmp error if csum is invalid
Date: Mon, 2 Mar 2015 13:09:34 +0100 [thread overview]
Message-ID: <20150302120934.GA16605@salvia> (raw)
In-Reply-To: <20150302113347.GC23622@breakpoint.cc>
On Mon, Mar 02, 2015 at 12:33:47PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Mon, Feb 16, 2015 at 06:54:04PM +0100, Florian Westphal wrote:
> > > diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
> > > index d05b364..68e0bb4 100644
> > > --- a/net/ipv6/netfilter/nf_reject_ipv6.c
> > > +++ b/net/ipv6/netfilter/nf_reject_ipv6.c
> > > @@ -208,4 +208,39 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
> > > }
> > > EXPORT_SYMBOL_GPL(nf_send_reset6);
> > >
> > > +static bool reject6_csum_ok(struct sk_buff *skb, int hook)
> > > +{
> > > + const struct ipv6hdr *ip6h = ipv6_hdr(skb);
> > > + int thoff;
> > > + __be16 fo;
> > > + u8 proto;
> > > +
> > > + if (skb->csum_bad)
> > > + return false;
> > > +
> > > + if (skb_csum_unnecessary(skb))
> > > + return true;
> > > +
> > > + proto = ip6h->nexthdr;
> > > + thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
> > > +
> > > + if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
> > > + return false;
> >
> > I think you can use thoff and fragoff from struct xt_action_param, so
> > we can save some cycles here.
>
> No, I don't think so. Seems its onl set for rules that use "-p" option,
> see f.e.
>
> net/ipv6/netfilter/ip6_tables.c which fill this only in case we have
>
> /* look for the desired protocol header */
> if((ip6info->flags & IP6T_F_PROTO)) {
>
> in ip6_packet_match().
Right, I'll enqueue this for the next pull request, sorry.
next prev parent reply other threads:[~2015-03-02 12:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-16 17:54 [PATCH -next v3] netfilter: reject: don't send icmp error if csum is invalid Florian Westphal
2015-03-02 11:18 ` Pablo Neira Ayuso
2015-03-02 11:33 ` Florian Westphal
2015-03-02 12:09 ` Pablo Neira Ayuso [this message]
2015-03-03 1:12 ` 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=20150302120934.GA16605@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.