From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: Natted packets Date: Tue, 09 Jan 2007 11:13:51 +0100 Message-ID: <45A36ADF.1090506@netfilter.org> References: <45A2BB09.90405@eternet.cc> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-bounces@lists.netfilter.org Errors-To: netfilter-bounces@lists.netfilter.org Content-Type: text/plain; charset="us-ascii" To: Jan Engelhardt Cc: netfilter@lists.netfilter.org Jan Engelhardt wrote: >> Is it possible to know if a packet passing through my router is (s)natted? > > I think `-m conntrack --ctstate SNAT` should do that. > >> And the original (s)natted IP? > > For userspace there's a getsockopt() call that you can use to find out. That getsockopt() interface is deprecated. If you're in userspace, better use the libnetfilter_conntrack library. It has a function to check if a conntrack has been snatted. -- The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris