From owner-freebsd-net@FreeBSD.ORG Mon Sep 23 04:10:14 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 7AD9F6E1 for ; Mon, 23 Sep 2013 04:10:14 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4CF842A1E for ; Mon, 23 Sep 2013 04:10:14 +0000 (UTC) Received: from jre-mbp.elischer.org (ppp121-45-245-177.lns20.per2.internode.on.net [121.45.245.177]) (authenticated bits=0) by vps1.elischer.org (8.14.6/8.14.6) with ESMTP id r8N4AATO023018 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 22 Sep 2013 21:10:12 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <523FBF24.50004@freebsd.org> Date: Mon, 23 Sep 2013 12:10:12 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Ihsan Junaidi Ibrahim Subject: Re: Programmatically forwarding packets to outgoing interface References: <4DC4F001-D430-4110-81DA-279F3D01AD33@grep.my> In-Reply-To: <4DC4F001-D430-4110-81DA-279F3D01AD33@grep.my> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-net@freebsd.org" 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 04:10:14 -0000 On 9/23/13 11:55 AM, Ihsan Junaidi Ibrahim wrote: > 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. > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > > you can try use ipfw and its 'fwd' option to reroute packets not sure if fwd works with ipv6.. I've never tried..