From patchwork Tue Nov 26 14:26:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander von Gluck X-Patchwork-Id: 3962 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:8712:b0:5db:5963:ef83 with SMTP id bv18csp91836mab; Tue, 26 Nov 2024 06:27:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXwxlz2djnQ/UWXw6bdKgTl5gJjLFlP4pcU0wXQSAYNb6iqyqyYclzIOXJOFZejxE31YWu6FwyCpe4=@openvpn.net X-Google-Smtp-Source: AGHT+IFYPFW9AlIKh8InE67tHlb2xspRD86wvA4CsDvhL43u1A1W2/z4Ly1lVUSnVmyz9HKCGCz6 X-Received: by 2002:a05:6602:150e:b0:843:ea73:134a with SMTP id ca18e2360f4ac-843ea731849mr58056839f.15.1732631246077; Tue, 26 Nov 2024 06:27:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732631246; cv=none; d=google.com; s=arc-20240605; b=ZsK4+0zvcqJKp5O4KCMhysMmD6qFE++FMVunUIgkgp3Bq8m6Aj/sY5WikaoNUEVLwQ hwEkvXMaitu5EWdCdbSDiFiw/8MOXLA8V9bu5AVQJ/OdZQA8MUwnMpAuXhbXpe5jvRgb PkWwpN0cEQge2FCzeyEsbZMnTB9XuSi8f9cEEbH+kHlHD2qCprgO7CyGLeuZnKsOtu2f tkeJ84hy0uGjpOuf+1byh4s1UD5YJ4fY+KD2ce44SfxuBTMqd0Ucp80t3jspIAFMvnLZ J4I8CejdO46nxfZFC9MH7tRDy18e2BZdN7HQOZ5fjlNfjCu0HqEuQlgV0hjDvpeDRoop IWbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:cc:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:feedback-id:message-id:to:date:dkim-signature :dkim-signature:dkim-signature; bh=FofDWftHkePi3LtKQTHdzGXiAS4UBYDeEHRysFFhiZA=; fh=Lax8FLCU6g10Y/m0qvv2Y0VsQFNWipWiwwrtnzp74qE=; b=TZyXdi+nRMobp45PxpLU1K7IUHKSFHhqMvSRigG4ZfwB0updF3W0wvMBEYRWJ31gSN Pu40UMjeCjWOQ0caT5PVssBvqRCIwtK4Ugb47F3+j8E2ez+9iPwcf8DVBBDAjMvmmIjQ hCD1h2huy46MW89eKdVqpe6Ud0w1HSwutccj6dlKNdbXS2OaBGGQbrxcargrtQydbIsX MFI/Eo1AL1Qa2ckDEe7btz7NneRr9Sg+gJTyIrN7+lKsVdXe61fHvdHVWTtxfLPyF9z1 kzIoAKc4dDiJvJnfCQWBM0k2u+gakia5QQB1PD1EcXQ/BNR2wCdiXJc6fn+Ka6Vl5HGK BHLw==; 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=O+C8A5Js; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AZTukemO; dkim=neutral (body hash did not verify) header.i=@terarocket.io header.s=protonmail2 header.b=EgBFNMW6; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id ca18e2360f4ac-8419f4709e8si246538539f.94.2024.11.26.06.27.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2024 06:27:26 -0800 (PST) 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=O+C8A5Js; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AZTukemO; dkim=neutral (body hash did not verify) header.i=@terarocket.io header.s=protonmail2 header.b=EgBFNMW6; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tFwX2-0001UZ-Ea; Tue, 26 Nov 2024 14:27:11 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tFwX0-0001UR-Nz for openvpn-devel@lists.sourceforge.net; Tue, 26 Nov 2024 14:27:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:Message-ID:Subject:Cc: From:To:Date:Sender:Reply-To:Content-Transfer-Encoding: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=1gyvbDsQoiT8r8wDpuaWXj2mariBTUrfcwfB9LEzKNs=; b=O+C8A5JszCCrIV1Q/zJ0gzxwP7 yytIk3UHO/N2GUWs11yf6Yg8Z2rp+WiHeurrvrARAPvA2+311J5nQGKf0LCo9DME8NT3y2BMn9d8y PCs48iEktt3LlKAz8mTMfeg65xOWn7NEYmFMaquTqr481PDyr8cXRFOdv17DqaqLUSq8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:Message-ID:Subject:Cc:From:To:Date:Sender: Reply-To:Content-Transfer-Encoding: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=1gyvbDsQoiT8r8wDpuaWXj2mariBTUrfcwfB9LEzKNs=; b=A ZTukemOXsHXuqfNJRh/9leAWpi6k3DD0ucc78y+lclPg3jhdncNHiws2PzfE309lhnrx/XKeQbq/c Oz/CKyyfJK2WCfXlvoNQCppUuS+Pp6ne0qg9mEPdPpq7HoelZt6OPjdAxQ+05B40vOgw6dqCDNw+v AKJFtI3y50PVHBDg=; Received: from mail-4323.proton.ch ([185.70.43.23]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tFwWy-0008Go-ES for openvpn-devel@lists.sourceforge.net; Tue, 26 Nov 2024 14:27:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=terarocket.io; s=protonmail2; t=1732631220; x=1732890420; bh=1gyvbDsQoiT8r8wDpuaWXj2mariBTUrfcwfB9LEzKNs=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=EgBFNMW6Rv4lyetK8iyzhE0dzId1XGCC8DsRLXRASByFC7u9mdSYOAmDtyQ4Wt1A8 1rWc9y/WJePa4TzBj8+7aM/IIZPuW7LcaaA05rHhMnnRWVVb3Brd3boNNew1P4As69 uzjWRpoAapFHpTPF609pi9YU2oe3pRjk25KE1/oW6Ii3gGiP+mPqK3al48bO2b/US2 MD+LiL1qgX4k/2Yg1vkS4xoId/Kwz/LJHCPZvsZBGPh1PcsiSYfUP2X7QcKpDx2qpE nbs5oP1UMle+FksZ8DVMfh7Laab6oXUHCgWQ5preUa11O7v4zCvUeWXDIwOgqRgV5D Zs8QsZHXR8ORg== Date: Tue, 26 Nov 2024 14:26:52 +0000 To: openvpn-devel@lists.sourceforge.net Message-ID: <20241126142639.67446-1-alex@terarocket.io> Feedback-ID: 105812837:user:proton X-Pm-Message-ID: 6acd46ecb3f976fec9917bc3b3ed114e8194db1a MIME-Version: 1.0 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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: From: Alexander von Gluck IV --- configure.ac | 5 +++++ src/openvpn/route.c | 15 +++++++++++++++ src/openvpn/tun.c | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/configure.ac b/configure.ac index 0876a6a5..7f6e43dd 100644 --- a/configure.ac +++ b/configure.ac @@ -368, 6 +368, 11 @@ case "$host" in have_tap_header="yes" ac_cv_header_net_if_h="no" # e [...] Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [185.70.43.23 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [185.70.43.23 listed in bl.score.senderscore.com] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [185.70.43.23 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Headers-End: 1tFwWy-0008Go-ES Subject: [Openvpn-devel] [PATCH 1/2] Haiku: Introduce basic platform support 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: , X-Patchwork-Original-From: Alexander von Gluck via Openvpn-devel From: Alexander von Gluck Reply-To: Alexander von Gluck Cc: Alexander von Gluck IV Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1816795541620684149?= X-GMAIL-MSGID: =?utf-8?q?1816795541620684149?= From: Alexander von Gluck IV --- configure.ac | 5 +++++ src/openvpn/route.c | 15 +++++++++++++++ src/openvpn/tun.c | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) #endif /* if defined(TARGET_LINUX) */ @@ -1909,10 +1919,17 @@ open_tun_generic(const char *dev, const char *dev_type, const char *dev_node, { for (int i = 0; i < 256; ++i) { +#if defined(TARGET_H AIKU) + snprintf(tunname, sizeof(tunname), + "/dev/%s/%d", dev, i); + snprintf(dynamic_name, sizeof(dynamic_name), + "%s/%d", dev, i); +#else snprintf(tunname, sizeof(tunname), "/dev/%s%d", dev, i); snprintf(dynamic_name, sizeof(dynamic_name), "%s%d", dev, i); +#endif if ((tt->fd = open(tunname, O_RDWR)) > 0) { dynamic_opened = true; diff --git a/configure.ac b/configure.ac index 0876a6a5..7f6e43dd 100644 --- a/configure.ac +++ b/configure.ac @@ -368,6 +368,11 @@ case "$host" in have_tap_header="yes" ac_cv_header_net_if_h="no" # exists, but breaks things ;; + *-*-haiku*) + AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?]) + AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix]) + LIBS="${LIBS} -lnetwork" + ;; *) AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix]) have_tap_header="yes" diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 2e584c71..fa20d08f 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1853,6 +1853,21 @@ add_route(struct route_ipv4 *r, status = ret ? RTA_SUCCESS : RTA_ERROR; } +#el if defined(TARGET_HAIKU) + + { + /* ex: route add /dev/net/ipro1000/0 default gw 192.168.1.1 netmask 255.255.255.0 */ + argv_printf(&argv, "route add %s inet default gw %s netmask %s", + rgi->iface, + gateway, + netmask); + + argv_msg(D_ROUTE, &argv); + bool ret = openvpn_execve_check(&argv, es, 0, + "ERROR: Haiku route add command failed"); + status = ret ? RTA_SUCCESS : RTA_ERROR; + } + #else /* if defined(TARGET_LINUX) */ msg(M_FATAL, "Sorry, but I don't know how to do 'route' commands on this operating system. Try putting your routes in a --route-up script"); #endif /* if defined(TARGET_LINUX) */ diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 85fe01af..65e3b5ba 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1631,6 +1631,16 @@ do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu, { windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu); } +#elif defined(TARGET_HAIKU) + { + /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */ + // Need to add ifconfig_remote_netmask since right now it is just NULL + argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH, + ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu); + + argv_msg(M_INFO, &argv); + openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed"); + } #else /* if defined(TARGET_LINUX) */ msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system. You should ifconfig your TUN/TAP device manually or use an --up script.");