From owner-freebsd-net@FreeBSD.ORG Fri Oct 31 12:04:16 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 402E4230 for ; Fri, 31 Oct 2014 12:04:16 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCAD9870 for ; Fri, 31 Oct 2014 12:04:15 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id bs8so1097775wib.17 for ; Fri, 31 Oct 2014 05:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=9u7ssuaYQ3JmZUUWyvDyUsFeaPmJAe0sq2W6+qJriYY=; b=rNAogTuesZle73iZRD7MKgFFaSSH6KmO9QGN+KoFRtXxZniUxzAdQ5g5GmUoFqPL4d wlkLkqyAha4QqIw5XoONWHWdOxieNwJcEG9yjmifwRo7xHtQHlNE7AUW/10Pi0YGxZz9 Wrn+RjjQJmuMM1b5S3WDNBvoblYUxIo8POd+V4zAE81pkZQj6xv5lqvKFOQlNR0/JX4d zIFekRlbJRPxW6Pb7fK3b4Ro6tXeG5T7cq+ThgDEygLNIzyc+EHBqafqwIFy7z2d05gr SwpJl3jpbcQGH8BQ6kB7u8TwiXqcvyLBXPeueWolG30+KPRji56ZafHU7JNkqkY6YPWk tGtw== X-Received: by 10.180.210.167 with SMTP id mv7mr3481456wic.15.1414757054014; Fri, 31 Oct 2014 05:04:14 -0700 (PDT) Received: from [192.168.2.30] ([2.176.150.113]) by mx.google.com with ESMTPSA id hu3sm11867481wjb.17.2014.10.31.05.04.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 05:04:13 -0700 (PDT) Message-ID: <54537AB7.5030906@gmail.com> Date: Fri, 31 Oct 2014 15:34:07 +0330 From: Hooman Fazaeli User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: "Andrey V. Elsukov" Subject: Re: transparent udp proxy References: <54535B82.405@gmail.com> <54536909.3030507@yandex.ru> In-Reply-To: <54536909.3030507@yandex.ru> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-net@freebsd.org" 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 12:04:16 -0000 On 10/31/2014 2:18 PM, Andrey V. Elsukov wrote: > 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. > There is no NAT stuff. I checked that on 8.4 source: http://fxr.watson.org/fxr/source/netinet/udp_usrreq.c?v=FREEBSD8#L461 -- Best regards. Hooman Fazaeli