From patchwork Mon Sep 16 13:04:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3834 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c41d:b0:5b9:581e:f939 with SMTP id jt29csp1191626mab; Mon, 16 Sep 2024 06:04:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVVQdCVxBzZ9m7hnZRzN3w1JlYeg0dI1lOZSc9uaNLejPZRVWfvvNYU7PCHsL1/1CpQPfYkZVjxduU=@openvpn.net X-Google-Smtp-Source: AGHT+IFotNYGsGkppZHhnF07Nnxxw3LeKdbrEuHCGe1qrkwvy99/Ph/pCAmpqrnj1gAG51v3/D2K X-Received: by 2002:a05:6602:6b0b:b0:82a:4163:838 with SMTP id ca18e2360f4ac-82d1f8c37b6mr1886282939f.6.1726491873312; Mon, 16 Sep 2024 06:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726491873; cv=none; d=google.com; s=arc-20240605; b=O3NDxCGz850Olu7OPiVAJuwrxVcJGZM9tkEoRxn8PbqxoNQegZlmw2sxss2puGTipz Jq817yUBz0DXOaIsMA7cep9Xs6l7SqVihow1kXpn0zCIjvfF/6mroMy4oNp+zkzcEha8 Z/7e/hOcFprVOMmM4H9q9aUcEN8tl5mfyfsFdbE0lcEJuWtKz3ysELTi+1BFmekuyNPL qIujGXii9usiCVl3/JBF7NA9b+ZKgxSsdbf6tkg6RR6/af3lJWAU7I60WAsjkM0XJIHz V51yOL/WlCIYIbrdYuLwKu1eD1HvZ6Yj2SemVvZ8QLW9V2OxTdQLTaPL8SQAns1bOEz8 MOLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=jVU+R5h4mUKIBmTqINI3rLAXxl6V6XsSrAIG5DIOJwk=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=DOztU6WiiXsTp/WCdPIwYK02M9jMSXGfiZCcdFg7loum8nZvY1B1vbq/tEhopXAq/E 6O5KE/D5/B+DajZnlDKJlFxQvx0E+BP0XuhXUO6l/Vol9MlALKizLKcissQ0ycaZCMZh KK5l0bfFCsPoEPsWBa69lL8/FyX1g02i1I/ZmBb2VU7Yaan7HQMRad97jVWzO11l5kcw 1NVf1uDysZQCwmFdFGCEcLT8NqnjT3p1fuvxkbOaTydD9M5QwnrKU3fYCu6klM3EhSAH HSCK8cre/W9FPP53ni7NXnaoLECiH9h1RbNUVfZFbANt/7Cvd2c93MuWhQnQQvrgUdIO d8Rw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="O69SZ/e9"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="SLpAffY/"; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=H+VhxzZs; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id ca18e2360f4ac-82d493655basi219802739f.146.2024.09.16.06.04.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Sep 2024 06:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="O69SZ/e9"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="SLpAffY/"; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=H+VhxzZs; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net; dara=fail header.i=@openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sqBOv-0005mc-Sd; Mon, 16 Sep 2024 13:04:22 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sqBOu-0005mW-Ay for openvpn-devel@lists.sourceforge.net; Mon, 16 Sep 2024 13:04:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2rxadbsp0yRqeu1xq/H1ROJ0Oxd4jJYcjtpqAchwYFA=; b=O69SZ/e9U7WrL0/gQFSZZDMVMR vTRyAi4ZD8Ds/Fj4/JQKwv9/2SMsaUjBm45cBk/ivPVzYvCE+usOy4yb0bT7rxkyu+VDlHFj37SWR PGo+monh8jx255EXla4mtjv4TUDneNfKkG/NzlF9YiwMsBXHuYkVzuf7+jcPtGY7nc9A=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=2rxadbsp0yRqeu1xq/H1ROJ0Oxd4jJYcjtpqAchwYFA=; b=S LpAffY/b2clOXZtzPZzrfMJ9QnLv/8DY6NT0Q+kUlvJT39FKhtNribA3XjdOBF9TradlVUn2vHNsU V0hmnuOiQ9pr144codfy8lbPvtVLhHZ4HPtJATXPog5Gzly8xVDjnpiykQ52FCNBdm23j8+x/kfqb XKMWCwTQ3ZbND/Go=; Received: from mail-wr1-f45.google.com ([209.85.221.45]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1sqBOt-0000xT-9u for openvpn-devel@lists.sourceforge.net; Mon, 16 Sep 2024 13:04:21 +0000 Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-374c962e5adso2790807f8f.1 for ; Mon, 16 Sep 2024 06:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1726491847; x=1727096647; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=2rxadbsp0yRqeu1xq/H1ROJ0Oxd4jJYcjtpqAchwYFA=; b=H+VhxzZsPzlkxdTFLABRopildN/6Hc8w4sc5V+uHDiEvrc0qAVez+P9mWk2//1ANBr +4nundCDuriDiPuHysVybjsKRrOnl1S4EwYlhmKHwB1d/sCI/gtMxAgf8s02si76SSLv oHoR60ULpuQVgljyPHK3JMHoQjii30OtoIpK2dJG+pJLxr0H151UGBPmV6+SUuq8/Ukf KEHfCIy8wIEfsx5qTVQkNfeOSnRFRsLDFM9d27WS8eDiU3NU3koQP76psjA1Z7sYrhrt POkvNZ48bYLdAhtWByBCDlIa75zT81dDciynPt4iQ9GOAgk65QVCiwAdzR5Hd3nkt5cW Je1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726491847; x=1727096647; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2rxadbsp0yRqeu1xq/H1ROJ0Oxd4jJYcjtpqAchwYFA=; b=pIOjXw98Wo0GM4ktKIB4/yYex+J6dGnqKsuKEz263MBPt10GReUE549IjzVLJoDLCS f+oqFcPRPwRq+eVATDajZZ37oJPyQM8/bnsyogK2fv7rn/xWSnz3r5WmLUgV2oc+/44r 1gg0GTdqL+C4hHOZQuX3Kffn8Da55bDgsdSmirdgiqGMRPrnmYEgV2yp4U0XwZw6qQao VtjOCD/DfIbAUBNVqLtPpOYQF/B3feKXwqA0R+nal2Hv4QCO84ru3jwK0qHm6TkKMg3V 3l4JdPXdUHtwydeaH5poaGbmmJYX4EGm+4CfpWT/IuFKNjZ0tbpOqwirGTZMEP/jZIRo MPrQ== X-Gm-Message-State: AOJu0YyZwNbhxUorP7ujL49ye/5gjwC27vNmbyQRzssmeKScgLYg6iIC 6jC3rrwHwL01JEtCu+5qJyop869x6O7PFqS/+cnsSoPga8a2Q4Yhv7PeDsVLdOFBduFM1yEkjcc A X-Received: by 2002:a05:6000:20c3:b0:378:c6d5:e2b3 with SMTP id ffacd0b85a97d-378c6d5e608mr9433439f8f.23.1726491847244; Mon, 16 Sep 2024 06:04:07 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42d9b194c57sm110514795e9.48.2024.09.16.06.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 06:04:06 -0700 (PDT) From: "plaisthos (Code Review)" X-Google-Original-From: "plaisthos (Code Review)" X-Gerrit-PatchSet: 1 Date: Mon, 16 Sep 2024 13:04:06 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I5987ebb7c38ab176eed7efc004ea54f606a77a12 X-Gerrit-Change-Number: 748 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: a60e2eadd4bfd064fd8a60c1b84f46c0b02da65c References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-1.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.45 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -1.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.45 listed in wl.mailspike.net] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1sqBOt-0000xT-9u Subject: [Openvpn-devel] [M] Change in openvpn[master]: Change dev null to be a driver type instead of a special mode of tun/tap 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: , Reply-To: arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1810357942557571566?= X-GMAIL-MSGID: =?utf-8?q?1810357942557571566?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/748?usp=email to review the following change. Change subject: Change dev null to be a driver type instead of a special mode of tun/tap ...................................................................... Change dev null to be a driver type instead of a special mode of tun/tap Change-Id: I5987ebb7c38ab176eed7efc004ea54f606a77a12 Signed-off-by: Arne Schwabe --- M src/openvpn/init.c M src/openvpn/proto.h M src/openvpn/tun.c M src/openvpn/tun.h 4 files changed, 78 insertions(+), 111 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/748/1 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 35ee0fc..30ebf28 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1764,6 +1764,10 @@ /* Using AF_UNIX trumps using DCO */ c->c1.tuntap->backend_driver = DRIVER_AFUNIX; } + else if (is_dev_type(c->options.dev, c->options.dev_type, "null")) + { + c->c1.tuntap->backend_driver = DRIVER_NULL; + } #ifdef _WIN32 else { @@ -1858,7 +1862,12 @@ open_tun_backend(struct context *c) { struct tuntap *tt = c->c1.tuntap; - if (tt->backend_driver == DRIVER_AFUNIX) + + if (tt->backend_driver == DRIVER_NULL) + { + open_tun_null(c->c1.tuntap); + } + else if (tt->backend_driver == DRIVER_AFUNIX) { open_tun_afunix(&c->options, c->c2.frame.tun_mtu, tt, c->c2.es); } diff --git a/src/openvpn/proto.h b/src/openvpn/proto.h index 4b6d6d6..a160fb6 100644 --- a/src/openvpn/proto.h +++ b/src/openvpn/proto.h @@ -33,7 +33,6 @@ * Tunnel types */ #define DEV_TYPE_UNDEF 0 -#define DEV_TYPE_NULL 1 #define DEV_TYPE_TUN 2 /* point-to-point IP tunnel */ #define DEV_TYPE_TAP 3 /* ethernet (802.3) tunnel */ diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 3f5f450..8f30c41 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -78,6 +78,9 @@ case DRIVER_AFUNIX: return "unix"; + case DRIVER_NULL: + return "null"; + #ifdef HAVE_NET_IF_UTUN_H case DRIVER_UTUN: return "utun"; @@ -476,10 +479,6 @@ { return DEV_TYPE_TAP; } - else if (is_dev_type(dev, dev_type, "null")) - { - return DEV_TYPE_NULL; - } else { return DEV_TYPE_UNDEF; @@ -497,9 +496,6 @@ case DEV_TYPE_TAP: return "tap"; - case DEV_TYPE_NULL: - return "null"; - default: return "[unknown-dev-type]"; } @@ -773,8 +769,7 @@ bool tun_p2p = false; if (tt->type == DEV_TYPE_TAP - || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET) - || tt->type == DEV_TYPE_NULL) + || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET)) { tun_p2p = false; } @@ -1751,7 +1746,7 @@ void undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx) { - if (tt->type != DEV_TYPE_NULL) + if (tt->backend_driver != DRIVER_AFUNIX && tt->backend_driver != DRIVER_NULL) { if (tt->did_ifconfig_setup) { @@ -1782,13 +1777,6 @@ #endif } -static void -open_null(struct tuntap *tt) -{ - tt->actual_name = string_alloc("null", NULL); -} - - #if defined (TARGET_OPENBSD) || (defined(TARGET_DARWIN) && HAVE_NET_IF_UTUN_H) /* @@ -1904,78 +1892,72 @@ char dynamic_name[256]; bool dynamic_opened = false; - if (tt->type == DEV_TYPE_NULL) + /* + * --dev-node specified, so open an explicit device node + */ + if (dev_node) { - open_null(tt); + snprintf(tunname, sizeof(tunname), "%s", dev_node); } else { /* - * --dev-node specified, so open an explicit device node + * dynamic open is indicated by --dev specified without + * explicit unit number. Try opening /dev/[dev]n + * where n = [0, 255]. */ - if (dev_node) + + if (!tun_name_is_fixed(dev)) { - snprintf(tunname, sizeof(tunname), "%s", dev_node); + for (int i = 0; i < 256; ++i) + { + snprintf(tunname, sizeof(tunname), + "/dev/%s%d", dev, i); + snprintf(dynamic_name, sizeof(dynamic_name), + "%s%d", dev, i); + if ((tt->fd = open(tunname, O_RDWR)) > 0) + { + dynamic_opened = true; + break; + } + msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)", tunname); + } + if (!dynamic_opened) + { + msg(M_FATAL, "Cannot allocate TUN/TAP dev dynamically"); + } } + /* + * explicit unit number specified + */ else { - /* - * dynamic open is indicated by --dev specified without - * explicit unit number. Try opening /dev/[dev]n - * where n = [0, 255]. - */ - - if (!tun_name_is_fixed(dev)) - { - for (int i = 0; i < 256; ++i) - { - snprintf(tunname, sizeof(tunname), - "/dev/%s%d", dev, i); - snprintf(dynamic_name, sizeof(dynamic_name), - "%s%d", dev, i); - if ((tt->fd = open(tunname, O_RDWR)) > 0) - { - dynamic_opened = true; - break; - } - msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)", tunname); - } - if (!dynamic_opened) - { - msg(M_FATAL, "Cannot allocate TUN/TAP dev dynamically"); - } - } - /* - * explicit unit number specified - */ - else - { - snprintf(tunname, sizeof(tunname), "/dev/%s", dev); - } + snprintf(tunname, sizeof(tunname), "/dev/%s", dev); } - - if (!dynamic_opened) - { - /* has named device existed before? if so, don't destroy at end */ - if (if_nametoindex( dev ) > 0) - { - msg(M_INFO, "TUN/TAP device %s exists previously, keep at program end", dev ); - tt->persistent_if = true; - } - - if ((tt->fd = open(tunname, O_RDWR)) < 0) - { - msg(M_ERR, "Cannot open TUN/TAP dev %s", tunname); - } - } - - set_nonblock(tt->fd); - set_cloexec(tt->fd); /* don't pass fd to scripts */ - msg(M_INFO, "TUN/TAP device %s opened", tunname); - - /* tt->actual_name is passed to up and down scripts and used as the ifconfig dev name */ - tt->actual_name = string_alloc(dynamic_opened ? dynamic_name : dev, NULL); } + + if (!dynamic_opened) + { + /* has named device existed before? if so, don't destroy at end */ + if (if_nametoindex( dev ) > 0) + { + msg(M_INFO, "TUN/TAP device %s exists previously, keep at program end", dev ); + tt->persistent_if = true; + } + + if ((tt->fd = open(tunname, O_RDWR)) < 0) + { + msg(M_ERR, "Cannot open TUN/TAP dev %s", tunname); + } + } + + set_nonblock(tt->fd); + set_cloexec(tt->fd); /* don't pass fd to scripts */ + msg(M_INFO, "TUN/TAP device %s opened", tunname); + + /* tt->actual_name is passed to up and down scripts and used as the ifconfig dev name */ + tt->actual_name = string_alloc(dynamic_opened ? dynamic_name : dev, NULL); + } #endif /* !_WIN32 && !TARGET_LINUX && !TARGET_FREEBSD*/ @@ -1987,12 +1969,6 @@ char dynamic_name[256]; bool dynamic_opened = false; - if (tt->type == DEV_TYPE_NULL) - { - open_null(tt); - return; - } - /* * unlike "open_tun_generic()", DCO on Linux and FreeBSD follows * the device naming model of "non-DCO linux", that is: @@ -2175,14 +2151,7 @@ { struct ifreq ifr; - /* - * We handle --dev null specially, we do not open /dev/null for this. - */ - if (tt->type == DEV_TYPE_NULL) - { - open_null(tt); - } - else if (tun_dco_enabled(tt)) + if (tun_dco_enabled(tt)) { open_tun_dco_generic(dev, dev_type, tt, ctx); } @@ -2407,12 +2376,6 @@ */ CLEAR(ifr); - if (tt->type == DEV_TYPE_NULL) - { - open_null(tt); - return; - } - if (tt->type == DEV_TYPE_TUN) { ip_node = "/dev/udp"; @@ -3491,12 +3454,6 @@ char dynamic_name[20]; const char *p; - if (tt->type == DEV_TYPE_NULL) - { - open_null(tt); - return; - } - if (tt->type == DEV_TYPE_TUN) { msg(M_FATAL, "no support for 'tun' devices on AIX" ); @@ -6838,12 +6795,7 @@ msg( M_INFO, "open_tun"); - if (tt->type == DEV_TYPE_NULL) - { - open_null(tt); - return; - } - else if (tt->type != DEV_TYPE_TAP && tt->type != DEV_TYPE_TUN) + if (tt->type != DEV_TYPE_TAP && tt->type != DEV_TYPE_TUN) { msg(M_FATAL|M_NOPREFIX, "Unknown virtual device type: '%s'", dev); } diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 75a4218..5287e0c 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -54,6 +54,7 @@ * this is always defined. We error out if a user tries to open this type * on unsupported platforms*/ DRIVER_AFUNIX, + DRIVER_NULL, DRIVER_DCO, #ifdef HAVE_NET_IF_UTUN_H DRIVER_UTUN @@ -790,4 +791,10 @@ { return tt && tt->type != DEV_TYPE_UNDEF; } + +static inline void +open_tun_null(struct tuntap *tt) +{ + tt->actual_name = string_alloc("null", NULL); +} #endif /* TUN_H */