From patchwork Thu Oct 11 07:41:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 546 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id MEnKJR6av1sOMAAAIUCqbw for ; Thu, 11 Oct 2018 14:44:46 -0400 Received: from proxy16.mail.ord1d.rsapps.net ([172.30.191.6]) by director12.mail.ord1d.rsapps.net with LMTP id gMasJR6av1uEFwAAIasKDg ; Thu, 11 Oct 2018 14:44:46 -0400 Received: from smtp9.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy16.mail.ord1d.rsapps.net with LMTP id OEFcJR6av1tjYwAAetu3IA ; Thu, 11 Oct 2018 14:44:46 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp9.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: b918be28-cd85-11e8-bcf7-0026b95bddb7-1-1 Received: from [216.105.38.7] ([216.105.38.7:4241] helo=lists.sourceforge.net) by smtp9.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id A6/95-28307-D1A9FBB5; Thu, 11 Oct 2018 14:44:46 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gAfwL-0005k8-EO; Thu, 11 Oct 2018 18:44:05 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gAfwK-0005k2-JV for openvpn-devel@lists.sourceforge.net; Thu, 11 Oct 2018 18:44:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cWJFGJKgrh1kw0s03+BRPPU/WaclbkA01NfEL3C1xcA=; b=gKJZRcoqKmFUUAlEe9reCE5lmL HMyf8v6YH+UuRl0I5p1VWnBDV43wCfy70tlv0uSWW2e6I7SZYhDHFXRvz+/wd0Dh/rfexaa0u1g5e 59RU+EXgbBlpk7W7Da0zYp/zcQUjstKvxiyAyHfSqzBbKCZZ3QvXD+Q+CwPl5CJ5Hcbk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=cWJFGJKgrh1kw0s03+BRPPU/WaclbkA01NfEL3C1xcA=; b=a nICwgN19OSg0wpJvPp/VSUC92aYLZJOhLrBC+yXo56D1izG07tYVXEfpEvxKxCuGE+pFIWRFf8qqJ CjHz3kFoO2lkUEMa3zy5hK/NGuCYWHgq/ZU8eWmV6bkN33WyE6u++XrWbX64yBfBtzurwuL7+ooPC stES6y8XBlCnFzXU=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1gAfwG-000R6D-P8 for openvpn-devel@lists.sourceforge.net; Thu, 11 Oct 2018 18:44:04 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 12 Oct 2018 02:41:53 +0800 Message-Id: <20181011184200.22175-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1gAfwG-000R6D-P8 Subject: [Openvpn-devel] [PATCH v2 0/7] introduce networking API and add netlink support for Linux X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From a high level description of this patchset, please refer to "[PATCH 0/4] add netlink support for Linux" sent to the mailing list on Apr, 20th 2018. Changes from v1: - introduced opaque context object containing implementation specific state; - fixed env passed to ip command (thanks to opaque context); - rebased on to pof latest master (00d78cd5) Regards, Antonio Quartulli (7): implement platform generic networking API implement networking API for iproute2 introduce sitnl: Simplified Interface To NetLink tun.c: use new networking API to handle tun interface on Linux route.c: use new networking API to handle routing table on Linux route.c: use sitnl to implement get_default_gateway_ipv6() unit tests: implement test for sitnl configure.ac | 15 +- src/openvpn/Makefile.am | 3 + src/openvpn/errlevel.h | 1 + src/openvpn/forward.c | 2 +- src/openvpn/init.c | 55 +- src/openvpn/init.h | 5 +- src/openvpn/networking.h | 272 +++++ src/openvpn/networking_ip.c | 385 ++++++ src/openvpn/networking_ip.h | 36 + src/openvpn/networking_sitnl.c | 1227 ++++++++++++++++++++ src/openvpn/networking_sitnl.h | 28 + src/openvpn/openvpn.c | 4 +- src/openvpn/openvpn.h | 2 + src/openvpn/options.c | 10 +- src/openvpn/options.h | 1 + src/openvpn/route.c | 497 +++----- src/openvpn/route.h | 26 +- src/openvpn/sitnl.h | 217 ++++ src/openvpn/ssl.c | 2 +- src/openvpn/ssl_common.h | 1 + src/openvpn/tun.c | 233 ++-- src/openvpn/tun.h | 14 +- tests/Makefile.am | 3 +- tests/t_net.sh | 180 +++ tests/unit_tests/openvpn/Makefile.am | 28 +- tests/unit_tests/openvpn/test_networking.c | 229 ++++ 26 files changed, 2974 insertions(+), 502 deletions(-) create mode 100644 src/openvpn/networking.h create mode 100644 src/openvpn/networking_ip.c create mode 100644 src/openvpn/networking_ip.h create mode 100644 src/openvpn/networking_sitnl.c create mode 100644 src/openvpn/networking_sitnl.h create mode 100644 src/openvpn/sitnl.h create mode 100755 tests/t_net.sh create mode 100644 tests/unit_tests/openvpn/test_networking.c