lkml.org 
[lkml]   [2010]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: tproxy: added IPv6 support to the socket match
From
On Sat, Oct 23, 2010 at 21:23, Linux Kernel Mailing List
<linux-kernel@vger.kernel.org> wrote:
> Gitweb:     http://git.kernel.org/linus/b64c9256a9b76fc9f059f71bd08ba88fb0cbba2e
> Commit:     b64c9256a9b76fc9f059f71bd08ba88fb0cbba2e
> Parent:     6ad7889327a5ee6ab4220bd34e4428c7d0de0f32
> Author:     Balazs Scheidler <bazsi@balabit.hu>
> AuthorDate: Thu Oct 21 16:19:42 2010 +0200
> Committer:  Patrick McHardy <kaber@trash.net>
> CommitDate: Thu Oct 21 16:19:42 2010 +0200
>
>    tproxy: added IPv6 support to the socket match
>
>    The ICMP extraction bits were contributed by Harry Mason.
>
>    Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
>    Signed-off-by: KOVACS Krisztian <hidden@balabit.hu>
>    Signed-off-by: Patrick McHardy <kaber@trash.net>
> ---
>  net/netfilter/xt_socket.c |  165 ++++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 154 insertions(+), 11 deletions(-)
>
> diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c
> index 266faa0..2dbd4c8 100644
> --- a/net/netfilter/xt_socket.c
> +++ b/net/netfilter/xt_socket.c

> +static bool
> +socket_mt6_v1(const struct sk_buff *skb, struct xt_action_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;

tproto is unsigned...

> +       const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo;
> +
> +       tproto = ipv6_find_hdr(skb, &thoff, -1, NULL);

but ipv6_find_hdr() returns int, and negative values for errors...

> +       if (tproto < 0) {

which it can never catch.

> +               pr_debug("unable to find transport header in IPv6 packet, dropping\n");
> +               return NF_DROP;
> +       }

net/netfilter/xt_socket.c:256: warning: comparison is always false due
to limited range of data type

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-10-28 20:55    [W:0.046 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site