From patchwork Tue Mar 12 06:11:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 226782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BD4E62C0297 for ; Tue, 12 Mar 2013 17:11:07 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754951Ab3CLGLE (ORCPT ); Tue, 12 Mar 2013 02:11:04 -0400 Received: from Chamillionaire.breakpoint.cc ([80.244.247.6]:33981 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754860Ab3CLGLE (ORCPT ); Tue, 12 Mar 2013 02:11:04 -0400 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.72) (envelope-from ) id 1UFIQP-0006UY-Rx; Tue, 12 Mar 2013 07:11:01 +0100 Date: Tue, 12 Mar 2013 07:11:01 +0100 From: Florian Westphal To: Matthias Schiffer Cc: Netfilter Developer Mailing List Subject: Re: Unable to get NPTv6 to work with kernel 3.8.2 Message-ID: <20130312061101.GB7938@breakpoint.cc> References: <513DE42B.5070702@universe-factory.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <513DE42B.5070702@universe-factory.net> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Matthias Schiffer wrote: > ip6tables -t nat -A OUTPUT -d fd00:0:0:3::/64 -j DNPT --src-pfx > fd00:0:0:3::/64 --dst-pfx fd00:0:0:1::/64 [..] This won't work, DNPT is stateless, the nat table is only consulted for the first packet of a connection. Use mangle instead, this should also take care of possible new route due to changed dst address. Any objections wrt. restricting NPT to mangle? From: Florian Westphal Subject: [PATCH] netfilter: ip6t_NPT: restrict to mangle table As the translation is stateless, using it in nat table doesn't work (only initial packet is translated). filter table OUTPUT works but won't re-route the packet after translation. Signed-off-by: Florian Westphal --- not even compile tested. diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c index 83acc14..33608c6 100644 --- a/net/ipv6/netfilter/ip6t_NPT.c +++ b/net/ipv6/netfilter/ip6t_NPT.c @@ -114,6 +114,7 @@ ip6t_dnpt_tg(struct sk_buff *skb, const struct xt_action_param *par) static struct xt_target ip6t_npt_target_reg[] __read_mostly = { { .name = "SNPT", + .table = "mangle", .target = ip6t_snpt_tg, .targetsize = sizeof(struct ip6t_npt_tginfo), .checkentry = ip6t_npt_checkentry, @@ -124,6 +125,7 @@ static struct xt_target ip6t_npt_target_reg[] __read_mostly = { }, { .name = "DNPT", + .table = "mangle", .target = ip6t_dnpt_tg, .targetsize = sizeof(struct ip6t_npt_tginfo), .checkentry = ip6t_npt_checkentry,