From owner-freebsd-net@freebsd.org Tue Jan 23 16:17:10 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4209FEB5D2C for ; Tue, 23 Jan 2018 16:17:10 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8A0784443; Tue, 23 Jan 2018 16:17:09 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id t79so1324123lfe.3; Tue, 23 Jan 2018 08:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wPe4AB+jmOqhbwAxrw0/EZZzVhOv3wLZeMVsBerzbbo=; b=sARyWiTojWN7IaAYjIkdq/LxhS67OuqXE524PwUM3wvQbwmq4t7Hbgv2fZ996mNtN7 S43+t6UDL0a9pyOhXCj+qZ1x9EDsbASEa2RVY8+rDdQT6LBn+165xywxwZ5tQ8f+lO+c BMs6qKl3RQkkgB0fO2qYERYB3NCb9EM73chCY5sTEvDnqQM0JtIO/D8Xl1vlWMxKKogT R5w2htoaFJpnjZUG1MdLGxdErK/5j3e8JY4JHxNRVPg6dL6zJx5h/Mu02smPe1U4h8p7 Az1m9noFVYmLucxJYtsni9uI4M1VyIjQ7Quy2YvXmYhVUrBWEyxZ31C1Yus7O9yq+hs1 KVNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wPe4AB+jmOqhbwAxrw0/EZZzVhOv3wLZeMVsBerzbbo=; b=JrHdcnzcIdwuXOJJxk8TqTbpPWl+SdEvdh/Iv62jU8UVAasr6VFdt0XoRKcAepZmGU 3w08QOrbJn6oJymUX6Si/PI9HoFvAimQoRs3uZCaWtCb2W0Y6rF+Z+1l03dSGoT8n07A BP0c05sK4Cc0wCyWKocfx55PIB9gwjn+gylYBTsRiFlffZWR0b+GRdpXJD39gGyk3XtD 72n7YfvHiTpslxp6aWoTpc2q0Ef6WYqIjIIQJC5ejqiUQcVQbRRkPR6UOeNFMkZ3NxXA kmWk5Oi+0o0kQwb5yf2Pcyr64SirSYVm6iX8BNBYT49W9Ndz65egxb/kbTytREw+ubTw HwbA== X-Gm-Message-State: AKwxytfL4M8/EWJTdMNZXox2dgGdBVgTeJrUs6vjYWxt1TAyx/pSVY6+ KEYFqd0omVxkL4cxlh5LO1SO7xSZGsqrudfrzNw= X-Google-Smtp-Source: AH8x227dVo6zl/0uGssVvCCGaThtSXErbHAnm3Jpn3R8alN96QbkQbU/8VW981tvydHy7DSwxvwEe3OgJb0+lr3Pymk= X-Received: by 10.46.115.22 with SMTP id o22mr1636099ljc.89.1516724227759; Tue, 23 Jan 2018 08:17:07 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.87.131 with HTTP; Tue, 23 Jan 2018 08:17:07 -0800 (PST) In-Reply-To: References: From: Alan Somers Date: Tue, 23 Jan 2018 09:17:07 -0700 X-Google-Sender-Auth: d_0sJ_kZFYTYlJ2zGccluXHHHFI Message-ID: Subject: Re: pf: redirect a packet's port but not its address? To: "Andrey V. Elsukov" Cc: FreeBSD Net , Kristof Provost Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 16:17:10 -0000 On Tue, Jan 23, 2018 at 7:16 AM, Andrey V. Elsukov wrote: > On 23.01.2018 03:35, Alan Somers wrote: > > All of these problems could be solved if pf were able to redirect a > > packet's destination port but not its address. You could bind the daemon > > to INADDR_ANY instead of localhost, and the packet it receives would be > > destined to the same address that the sender intended. > > > > Unfortunately, pf currently lacks this capability. But it looks like it > > could be added without breaking existing pf.conf syntax. Would this be a > > good idea? > > > > I don't use ipfw, but from reading the man page I believe that it has the > > same problem. > > I think ipfw should work with such configuration using "fwd" action, > since TCP/UDP has special handling for this. The man page says that the fwd directive always takes an IP address. What I need is a way to forward the port without changing the IP address. Is that possible in ipfw?