From patchwork Tue Apr 5 14:43:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KOVACS Krisztian X-Patchwork-Id: 89878 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 25161B6F12 for ; Wed, 6 Apr 2011 00:44:12 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753442Ab1DEOnu (ORCPT ); Tue, 5 Apr 2011 10:43:50 -0400 Received: from brother.balabit.com ([195.70.62.219]:40891 "EHLO lists.balabit.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753014Ab1DEOnt (ORCPT ); Tue, 5 Apr 2011 10:43:49 -0400 Received: from balabit.hu (unknown [10.80.0.254]) by lists.balabit.hu (Postfix) with ESMTP id 091C239DC44; Tue, 5 Apr 2011 16:44:25 +0200 (CEST) Subject: Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in From: KOVACS Krisztian To: Patrick McHardy Cc: David Miller , rostedt@goodmis.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org In-Reply-To: <4D99CDA0.3030305@trash.net> References: <1301451199.14261.327.camel@gandalf.stny.rr.com> <20110329.223536.245392030.davem@davemloft.net> <4D99CDA0.3030305@trash.net> Date: Tue, 05 Apr 2011 16:43:46 +0200 Message-ID: <1302014626.67568.1.camel@nienna.balabit> Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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? --- KOVACS Krisztian -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }