Re: problem: [PATCH] iptable_REJECT doesn't constructs the tcpreset packet cleanly

From: Pablo Neira Ayuso
Date: Sun Dec 16 2012 - 17:32:02 EST


On Tue, Dec 11, 2012 at 01:58:02AM +0100, Pablo Neira Ayuso wrote:
[...]
> On Mon, Dec 10, 2012 at 12:48:49PM -0800, Mukund Jampala wrote:
> > problem description:
> > The problem occurs when iptables constructs the tcp reset packet.
> > It doesn't initialize the pointer to the tcp header within the skb.
> > When the skb is passed to the ixgbe driver for transmit, the ixgbe
> > driver attempts to access the tcp header and crashes.
> > Currently, other drivers (such as our 1G e1000e or igb drivers) don't
> > access the tcp header on transmit unless the TSO option is turned on.
[...]
> > Solution: set the skb->trasport_header to a valid data offset in ipt
> > reject module
> >
> > diff -up net/ipv4/netfilter/ipt_REJECT.c{.orig,}
> > --- net/ipv4/netfilter/ipt_REJECT.c.orig 2012-12-10 12:08:37.000000000 -0800
> > +++ net/ipv4/netfilter/ipt_REJECT.c 2012-12-10 12:10:08.000000000 -0800
> > @@ -79,6 +79,8 @@ static void send_reset(struct sk_buff *o
> > niph->saddr = oiph->daddr;
> > niph->daddr = oiph->saddr;
> >
> > +
> > + skb_reset_transport_header(nskb);
> > tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr));
> > memset(tcph, 0, sizeof(*tcph));
> > tcph->source = oth->dest;
> >
> > Please let me know if you have any concerns with the patch.
>
> This is a good and extensive diagnosing, thanks a lot.
>
> Regarding your patch format, please, use git format-patch for your
> upcoming contributions and add the Signed-off-by tag to your patches.
> It makes
>
> But for this time, I'll do the formatting myself and will take this
> into the nf tree.

I have also made the same change for ip6t_REJECT.

Applied, thanks Mukund.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/