netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
       [not found] <1301451199.14261.327.camel@gandalf.stny.rr.com>
@ 2011-03-30  5:35 ` David Miller
  2011-03-30 10:18   ` Steven Rostedt
  2011-04-04 13:54   ` Patrick McHardy
  0 siblings, 2 replies; 6+ messages in thread
From: David Miller @ 2011-03-30  5:35 UTC (permalink / raw)
  To: rostedt; +Cc: linux-kernel, hidden, akpm, netfilter-devel, kaber, netdev

From: Steven Rostedt <rostedt@goodmis.org>
Date: Tue, 29 Mar 2011 22:13:19 -0400

> While running ktest.pl doing ranconfigs, the following build error
> occurred:

Is sending netfilter patches to the explicitly listed maintainer in
MAINTAINERS too much to ask Stephen? :-/

CC:'d

> 
> net/built-in.o: In function `tproxy_tg6_v1':
> /home/rostedt/work/autotest/nobackup/linux-test.git/net/netfilter/xt_TPROXY.c:288: undefined reference to `ipv6_find_hdr'
> 
> This happened because the xt_TPROXY code was compiled into the kernel
> proper, but the ipv6 netfilter was compiled as a module. The fix is to
> only enter the code that calls ipv6_find_hdr if ipv6 netfilter is
> compiled into the kernel, or if it is a module, so is the xt_TPROXY
> code.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> 
> diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
> index dcfd57e..5915f94 100644
> --- a/net/netfilter/xt_TPROXY.c
> +++ b/net/netfilter/xt_TPROXY.c
> @@ -22,7 +22,13 @@
>  
>  #include <net/netfilter/ipv4/nf_defrag_ipv4.h>
>  
> -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
> +/*
> + * Only include the following if ip6 tables is compiled in
> + * the kernel, or it is a module and this code is also a module.
> + */
> +#if defined(CONFIG_IP6_NF_IPTABLES) || \
> +	(defined(CONFIG_IP6_NF_IPTABLES_MODULE) && \
> +	 defined(CONFIG_NETFILTER_XT_TARGET_TPROXY_MODULE))
>  #define XT_TPROXY_HAVE_IPV6 1
>  #include <net/if_inet6.h>
>  #include <net/addrconf.h>
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
  2011-03-30  5:35 ` [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in David Miller
@ 2011-03-30 10:18   ` Steven Rostedt
  2011-04-04 13:54   ` Patrick McHardy
  1 sibling, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2011-03-30 10:18 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, hidden, akpm, netfilter-devel, kaber, netdev

On Tue, 2011-03-29 at 22:35 -0700, David Miller wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> Date: Tue, 29 Mar 2011 22:13:19 -0400
> 
> > While running ktest.pl doing ranconfigs, the following build error
> > occurred:
> 
> Is sending netfilter patches to the explicitly listed maintainer in
> MAINTAINERS too much to ask Stephen? :-/
> 
> CC:'d
> 

Sorry David, I just did a git blame and Cc'd the ones that did the
original change. I'll do better next time.

-- Steve



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
  2011-03-30  5:35 ` [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in David Miller
  2011-03-30 10:18   ` Steven Rostedt
@ 2011-04-04 13:54   ` Patrick McHardy
  2011-04-05 14:43     ` KOVACS Krisztian
  1 sibling, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2011-04-04 13:54 UTC (permalink / raw)
  To: David Miller; +Cc: rostedt, linux-kernel, hidden, akpm, netfilter-devel, netdev

On 30.03.2011 07:35, David Miller wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> Date: Tue, 29 Mar 2011 22:13:19 -0400
> 
>> While running ktest.pl doing ranconfigs, the following build error
>> occurred:
> 
> Is sending netfilter patches to the explicitly listed maintainer in
> MAINTAINERS too much to ask Stephen? :-/
> 
> CC:'d
> 
>>
>> net/built-in.o: In function `tproxy_tg6_v1':
>> /home/rostedt/work/autotest/nobackup/linux-test.git/net/netfilter/xt_TPROXY.c:288: undefined reference to `ipv6_find_hdr'
>>
>> This happened because the xt_TPROXY code was compiled into the kernel
>> proper, but the ipv6 netfilter was compiled as a module. The fix is to
>> only enter the code that calls ipv6_find_hdr if ipv6 netfilter is
>> compiled into the kernel, or if it is a module, so is the xt_TPROXY
>> code.

I don't think this is a good fix for the problem since it may lead to
the confusing situation that both TPROXY and ip6tables are enabled,
but TPROXY has no IPv6 support.

I think we should solve this by either adding a Kconfig dependency
on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) or using ipv6_skip_exthdr()
instead of ipv6_find_hdr().

Krisztian, what do you think?

>>
>> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
>>
>> diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
>> index dcfd57e..5915f94 100644
>> --- a/net/netfilter/xt_TPROXY.c
>> +++ b/net/netfilter/xt_TPROXY.c
>> @@ -22,7 +22,13 @@
>>  
>>  #include <net/netfilter/ipv4/nf_defrag_ipv4.h>
>>  
>> -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
>> +/*
>> + * Only include the following if ip6 tables is compiled in
>> + * the kernel, or it is a module and this code is also a module.
>> + */
>> +#if defined(CONFIG_IP6_NF_IPTABLES) || \
>> +	(defined(CONFIG_IP6_NF_IPTABLES_MODULE) && \
>> +	 defined(CONFIG_NETFILTER_XT_TARGET_TPROXY_MODULE))
>>  #define XT_TPROXY_HAVE_IPV6 1
>>  #include <net/if_inet6.h>
>>  #include <net/addrconf.h>
>>
>>
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
  2011-04-04 13:54   ` Patrick McHardy
@ 2011-04-05 14:43     ` KOVACS Krisztian
  2011-04-05 14:49       ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: KOVACS Krisztian @ 2011-04-05 14:43 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: David Miller, rostedt, linux-kernel, akpm, netfilter-devel,
	netdev

Hi,

On Mon, 2011-04-04 at 15:54 +0200, Patrick McHardy wrote:
> >> net/built-in.o: In function `tproxy_tg6_v1':
> >> /home/rostedt/work/autotest/nobackup/linux-test.git/net/netfilter/xt_TPROXY.c:288: undefined reference to `ipv6_find_hdr'
> >>
> >> This happened because the xt_TPROXY code was compiled into the kernel
> >> proper, but the ipv6 netfilter was compiled as a module. The fix is to
> >> only enter the code that calls ipv6_find_hdr if ipv6 netfilter is
> >> compiled into the kernel, or if it is a module, so is the xt_TPROXY
> >> code.
> 
> I don't think this is a good fix for the problem since it may lead to
> the confusing situation that both TPROXY and ip6tables are enabled,
> but TPROXY has no IPv6 support.
> 
> I think we should solve this by either adding a Kconfig dependency
> on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) or using ipv6_skip_exthdr()
> instead of ipv6_find_hdr().
> 
> Krisztian, what do you think?

I'd definitely prefer using ipv6_skip_exthdr() instead of playing
various tricks with the config preprocessor macros.

What about something like this?

diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
index dcfd57e..1ef0e56 100644
--- a/net/netfilter/xt_TPROXY.c
+++ b/net/netfilter/xt_TPROXY.c
@@ -283,10 +283,10 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par)
        const struct in6_addr *laddr;
        __be16 lport;
        int thoff;
-       int tproto;
+       u8 tproto = iph->nexthdr;
 
-       tproto = ipv6_find_hdr(skb, &thoff, -1, NULL);
-       if (tproto < 0) {
+       thoff = ipv6_skip_exthdr(skb, sizeof(*iph), &tproto);
+       if (thoff < 0) {
                pr_debug("unable to find transport header in IPv6 packet, dropping\n");
                return NF_DROP;
        }

--
KOVACS Krisztian

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
  2011-04-05 14:43     ` KOVACS Krisztian
@ 2011-04-05 14:49       ` Patrick McHardy
  2011-04-06 12:08         ` KOVACS Krisztian
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2011-04-05 14:49 UTC (permalink / raw)
  To: KOVACS Krisztian
  Cc: David Miller, rostedt, linux-kernel, akpm, netfilter-devel,
	netdev

Am 05.04.2011 16:43, schrieb KOVACS Krisztian:
> Hi,
> 
> On Mon, 2011-04-04 at 15:54 +0200, Patrick McHardy wrote:
>>>> net/built-in.o: In function `tproxy_tg6_v1':
>>>> /home/rostedt/work/autotest/nobackup/linux-test.git/net/netfilter/xt_TPROXY.c:288: undefined reference to `ipv6_find_hdr'
>>>>
>>>> This happened because the xt_TPROXY code was compiled into the kernel
>>>> proper, but the ipv6 netfilter was compiled as a module. The fix is to
>>>> only enter the code that calls ipv6_find_hdr if ipv6 netfilter is
>>>> compiled into the kernel, or if it is a module, so is the xt_TPROXY
>>>> code.
>>
>> I don't think this is a good fix for the problem since it may lead to
>> the confusing situation that both TPROXY and ip6tables are enabled,
>> but TPROXY has no IPv6 support.
>>
>> I think we should solve this by either adding a Kconfig dependency
>> on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) or using ipv6_skip_exthdr()
>> instead of ipv6_find_hdr().
>>
>> Krisztian, what do you think?
> 
> I'd definitely prefer using ipv6_skip_exthdr() instead of playing
> various tricks with the config preprocessor macros.
> 
> What about something like this?
> 
> diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
> index dcfd57e..1ef0e56 100644
> --- a/net/netfilter/xt_TPROXY.c
> +++ b/net/netfilter/xt_TPROXY.c
> @@ -283,10 +283,10 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par)
>         const struct in6_addr *laddr;
>         __be16 lport;
>         int thoff;
> -       int tproto;
> +       u8 tproto = iph->nexthdr;
>  
> -       tproto = ipv6_find_hdr(skb, &thoff, -1, NULL);
> -       if (tproto < 0) {
> +       thoff = ipv6_skip_exthdr(skb, sizeof(*iph), &tproto);
> +       if (thoff < 0) {
>                 pr_debug("unable to find transport header in IPv6 packet, dropping\n");
>                 return NF_DROP;
>         }

Looks good to me. Please formally submit this including a Signed-off-by:
line and I'll push it upstream.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
  2011-04-05 14:49       ` Patrick McHardy
@ 2011-04-06 12:08         ` KOVACS Krisztian
  0 siblings, 0 replies; 6+ messages in thread
From: KOVACS Krisztian @ 2011-04-06 12:08 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: David Miller, rostedt, linux-kernel, akpm, netfilter-devel,
	netdev

Hi,

On 04/05/2011 04:49 PM, Patrick McHardy wrote:
>> What about something like this?
>>
>> diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
>> index dcfd57e..1ef0e56 100644
>> --- a/net/netfilter/xt_TPROXY.c
>> +++ b/net/netfilter/xt_TPROXY.c
>> @@ -283,10 +283,10 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par)
>>         const struct in6_addr *laddr;
>>         __be16 lport;
>>         int thoff;
>> -       int tproto;
>> +       u8 tproto = iph->nexthdr;
>>  
>> -       tproto = ipv6_find_hdr(skb, &thoff, -1, NULL);
>> -       if (tproto < 0) {
>> +       thoff = ipv6_skip_exthdr(skb, sizeof(*iph), &tproto);
>> +       if (thoff < 0) {
>>                 pr_debug("unable to find transport header in IPv6 packet, dropping\n");
>>                 return NF_DROP;
>>         }
> 
> Looks good to me. Please formally submit this including a Signed-off-by:
> line and I'll push it upstream.

Will do, as soon as I have a chance to run the test suite. Thanks Patrick.

-- 
KOVACS Krisztian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-06 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1301451199.14261.327.camel@gandalf.stny.rr.com>
2011-03-30  5:35 ` [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in David Miller
2011-03-30 10:18   ` Steven Rostedt
2011-04-04 13:54   ` Patrick McHardy
2011-04-05 14:43     ` KOVACS Krisztian
2011-04-05 14:49       ` Patrick McHardy
2011-04-06 12:08         ` KOVACS Krisztian

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).