Netdev List
 help / color / mirror / Atom feed
From: Balazs Scheidler <bazsi@balabit.hu>
To: Brian Haley <brian.haley@hp.com>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 12/13] TProxy: added IPv6 support to the socket match
Date: Tue, 22 Sep 2009 08:33:51 +0200	[thread overview]
Message-ID: <1253601231.6883.1.camel@bzorp.balabit> (raw)
In-Reply-To: <4AB7BEF8.5050800@hp.com>

On Mon, 2009-09-21 at 13:59 -0400, Brian Haley wrote:
> Balazs Scheidler wrote:
> > +static bool
> > +socket_mt6_v1(const struct sk_buff *skb, const struct xt_match_param *par)
> > +{
> > +	struct ipv6hdr *iph = ipv6_hdr(skb);
> > +	struct udphdr _hdr, *hp = NULL;
> > +	struct sock *sk;
> > +	struct in6_addr *daddr, *saddr;
> > +	__be16 dport, sport;
> > +        int thoff;
> > +	u8 tproto;
> > +        const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo;
> > +        
> > +        tproto = ipv6_find_hdr(skb, &thoff, -1, NULL);
> > +        if (tproto < 0) {
> > +		pr_debug("socket match: Unable to find transport header in IPv6 packet, dropping\n");
> > +		return NF_DROP;
> > +        }
> > +
> > +	if (tproto == IPPROTO_UDP || tproto == IPPROTO_TCP) {
> > +		hp = skb_header_pointer(skb, thoff,
> > +					sizeof(_hdr), &_hdr);
> > +		if (hp == NULL)
> > +			return false;
> > +
> > +		saddr = &iph->saddr;
> > +		sport = hp->source;
> > +		daddr = &iph->daddr;
> > +		dport = hp->dest;
> > +
> > +	} else if (tproto == IPPROTO_ICMP) {
> > +		if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr,
> > +					 &sport, &dport))
> > +			return false;
> > +	} else {
> > +		return false;
> > +	}
> 
> Shouldn't this be IPPROTO_ICMPV6?

Yeah, thanks for spotting this. I'm going to have to add ICMP checks to
my test program, or at least retest that functionality manually.

-- 
Bazsi


  reply	other threads:[~2009-09-22  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 12:52 [PATCH 12/13] TProxy: added IPv6 support to the socket match Balazs Scheidler
2009-09-21 17:59 ` Brian Haley
2009-09-22  6:33   ` Balazs Scheidler [this message]
2009-09-22  8:33 ` Jan Engelhardt

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=1253601231.6883.1.camel@bzorp.balabit \
    --to=bazsi@balabit.hu \
    --cc=brian.haley@hp.com \
    --cc=netdev@vger.kernel.org \
    --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