From owner-freebsd-net@FreeBSD.ORG Mon Sep 23 03:56:03 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 632615A8 for ; Mon, 23 Sep 2013 03:56:03 +0000 (UTC) (envelope-from ihsan@grep.my) Received: from svc02-kul.b.n3labs.my (svc02-kul.b.n3labs.my [IPv6:2400:3700:10::61]) by mx1.freebsd.org (Postfix) with ESMTP id 24F4129A5 for ; Mon, 23 Sep 2013 03:56:02 +0000 (UTC) Received: from [IPv6:2400:3700:49::ddbd:7810:1737:c59b] (unknown [IPv6:2400:3700:49:0:ddbd:7810:1737:c59b]) by svc02-kul.b.n3labs.my (Postfix) with ESMTPSA id F1540C60235 for ; Mon, 23 Sep 2013 11:55:57 +0800 (MYT) From: Ihsan Junaidi Ibrahim Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Programmatically forwarding packets to outgoing interface Message-Id: <4DC4F001-D430-4110-81DA-279F3D01AD33@grep.my> Date: Mon, 23 Sep 2013 11:55:56 +0800 To: "freebsd-net@freebsd.org" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 03:56:03 -0000 Hi folks, I'm trying to learn building a VPN-type application on FreeBSD and I'm = currently stuck at trying to route packets to outgoing interface. I've managed to push/pop IP packets in a tun(4) interface but now that I = can read the inner packet header, I need to route the payload out of the = box. I'm not quite sure which API I need to use to achieve this. The inner packets can be of either IPv4 or IPv6. Thanks.=