From owner-freebsd-net@FreeBSD.ORG Fri Oct 31 10:49:05 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8088FA31 for ; Fri, 31 Oct 2014 10:49:05 +0000 (UTC) Received: from forward6l.mail.yandex.net (forward6l.mail.yandex.net [IPv6:2a02:6b8:0:1819::6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A682DC1 for ; Fri, 31 Oct 2014 10:49:05 +0000 (UTC) Received: from smtp12.mail.yandex.net (smtp12.mail.yandex.net [95.108.131.191]) by forward6l.mail.yandex.net (Yandex) with ESMTP id 6EDF414E12F8; Fri, 31 Oct 2014 13:48:49 +0300 (MSK) Received: from smtp12.mail.yandex.net (localhost [127.0.0.1]) by smtp12.mail.yandex.net (Yandex) with ESMTP id E280516A00D0; Fri, 31 Oct 2014 13:48:48 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:40c:120b:a9ff:fe93:c998]) by smtp12.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id FEfdVniakq-mmlOXNH8; Fri, 31 Oct 2014 13:48:48 +0300 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: f9273d5b-222e-45d9-ad46-fe7e405cc787 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1414752528; bh=B0rRXmgNkgqTpn+NfmjfNbOpg7DOpQm4PMKNPoXz5X4=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=XkhXBluw01eW3xBV9qprBSaE84QBtFXX/9pshUG+OYpWMMAQSDKan8gNjQ0IA33gw PHBXnpFPP0LiiY7gDLqyrx7FoPLOmEYvnl4FIJFvmrDPbd0822w+B4qC6YBucjYzDm l2sp5sf/D7RSIekdN40SMPbKXTSytDGu88pRVmfg= Authentication-Results: smtp12.mail.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <54536909.3030507@yandex.ru> Date: Fri, 31 Oct 2014 13:48:41 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Hooman Fazaeli , "freebsd-net@freebsd.org" Subject: Re: transparent udp proxy References: <54535B82.405@gmail.com> In-Reply-To: <54535B82.405@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 10:49:05 -0000 On 31.10.2014 12:50, Hooman Fazaeli wrote: > Hi, > > I my setup, I use a fwd rule to forward all udp traffic to my local proxy: > > ipfw add 10 fwd localhost,7000 udp from any to any recv em1 > > The proxy needs to know the original destination address of forwarded > datagrams, but > there seems to be no way to obtain that address. > > Using recvmsg with IP_RECVDSTADDR does not help because it returns > next-hop address > instead of original destination. This is because udp_input() overwrites > packet's destination > with next-hop address before doing ip_savecontrol. Hi, udp_input() doesn't overwrite destination address. Probably you have NAT that does this. -- WBR, Andrey V. Elsukov