From patchwork Thu Jul 23 10:55:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Just X-Patchwork-Id: 5123 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6384:b0:87d:a69c:34be with SMTP id i4csp724125mag; Thu, 23 Jul 2026 04:12:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AHgh+Rq3qFWFr1WnKd9xo0XCQctiUQpW+SXcg3flp9Dgnwts49gNQcUMER7jJlx3VHFBfAZvd2ZSMz4bzuQ=@openvpn.net X-Received: by 2002:a05:6820:208e:b0:6aa:4d38:ad26 with SMTP id 006d021491bc7-6aad4210435mr926005eaf.69.1784805127791; Thu, 23 Jul 2026 04:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1784805127; cv=none; d=google.com; s=arc-20260327; b=DddTTdy9aNbzDs2fn8jKT1Rg7uJ050O9JVIj461kO50a8Zh8MMB+v0Lobe32zP1hKz b7fZnqCezTDJF/Vhneo9KxGVkyDkS7uybzQIBAVUTCluhhIJABeXBNhnSoWdGFd+oojv nCwkLNrhvDCYXLCHaU9Jl8wKuLx8d1gwb33WPUVbW8H7cHSJ8nFIfs7kExcRDRRAuat6 hca3BFktnB1x22vgdssw9bQ17Xmj+Hry6XeO5LaOxTIMWweC231OlIc1cXIXenCVa/zk AkbHPOHX7kcUgJfLI3rH7HIGvtad5tfZ8LS/k/aizEJvXvYsle7IC+b07J1eOARNPmzc zZ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=ArBZBlweqdkuayLmQC4YMT1/xBFcvlX/Ws8tVSvSvjs=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Uwx7ENG6sA3riA8OMppyTNB8++ZqOo88o+ct+Fpa/hL5TEYq5b3EZbnYk3ZRQ2Pu3P UWsC2NG51qEOQ/adYLXR4Wat7xrIIiHsYH04B7GKaWS1rPjJ106DmZHuclauJuBnEYcR 71SrnmUVXoyif+AO+DQsv9msdB2eOrqkYA0PeJ7tS+YvAYS5nC3uifXL3hYX/F7XAaut QleQRogp9Mytv6icI0N/Li42dwrIf3g3BfnHLwuTFLGE61SJW71ZzvQleYcy71TwZwHT fhaHVFj7eueYFhXq/m2vSHPIgRCGxrGQE4Wne/TTWZDEV4kvy/mMw/QtCRGEwQrqj5sK LGPg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=AoRRbyDy; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ReG7Jm46; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=lu4VcBpM; dkim=neutral (body hash did not verify) header.i=@quietcode.org header.s=kas202603051731 header.b=SvgK3AWZ; 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=quietcode.org Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 006d021491bc7-6aad8a5ad53si593833eaf.86.2026.07.23.04.12.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2026 04:12:07 -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=pass header.i=@lists.sourceforge.net header.s=beta header.b=AoRRbyDy; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ReG7Jm46; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=lu4VcBpM; dkim=neutral (body hash did not verify) header.i=@quietcode.org header.s=kas202603051731 header.b=SvgK3AWZ; 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=quietcode.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:Date:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ArBZBlweqdkuayLmQC4YMT1/xBFcvlX/Ws8tVSvSvjs=; b=AoRRbyDyeLQOrsUU8BvPy9VbKV 5KHrsBAiWafEaTaisYCFcokL0QTw9YfJ7fJy7AYnNK5TP1iM16F3VvZR13qpfydOzLjbyKsPvpiKx VO7ApMqfmFH96KYbzJ26tzj5SN0Ec+H25BItsakDoyFgzwJQDpkiJ1ihssv/HgBXwKC4=; 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 1wmrLJ-0004hY-DX; Thu, 23 Jul 2026 11:11:58 +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 1wmrLH-0004hO-My for openvpn-devel@lists.sourceforge.net; Thu, 23 Jul 2026 11:11:56 +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=CWVmdya4qFf803mfF87kx/GJDQ0iQ+BEHkhefBt7D4s=; b=ReG7Jm46aImbAOng3zDhin0nPg IxhSXtNeIk07lxkrILJCqJU4EqYzY5K7Igy0rdifk6gbDamVdDf+V8K9TywRciMb5Xh5TRgqxTS6Z 6MpvzIBhdz88kwdz5vqgFOeNx5e/I1j0Bn7Qf9tQZIYnlRwRqb8l6hJFvTihghibkOgI=; 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=CWVmdya4qFf803mfF87kx/GJDQ0iQ+BEHkhefBt7D4s=; b=l u4VcBpM1jJp7tfdRntP9uhGLYfVavt6hhwm6uJfgTJrC+PkTz1rfWl5fnXf2LYY6O+gI/7SPhWlgm uCXgf2QbBLW3ta/AoiBrxUtXaXz4zgCV/MeHcKHmkho5l96Muu8+JUqNvC9Yzi4bDRAaQXNJHUXFk 1bGJQ6TGLGv6syLo=; Received: from dd37824.kasserver.com ([85.13.157.174]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1wmrLK-0001Mb-3M for openvpn-devel@lists.sourceforge.net; Thu, 23 Jul 2026 11:11:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quietcode.org; s=kas202603051731; t=1784804010; bh=CWVmdya4qFf803mfF87kx/GJDQ0iQ+BEHkhefBt7D4s=; h=From:To:Cc:Subject:Date:From; b=SvgK3AWZdCZ9L0g/6i03v2PYdgNGuO0zcIMU5/cmpbhCYOXcJVhEjWwZHZcGCM0jQ o5Fp9HechA1z8dqxUG3RLOwl4Mu4KrKhBqtS7DxaFur4KrWEZrMESLsG9HiWLL+Ofr UQSce212qA0MBPnfGXtX6PMPYKpxlG1MN6BdN1zLsTH7DADsSEJJswKBg29h3xbxf+ f7uDcQTZMFBHblq/jnGWsSsc+KNh2uWS77sQ4s/9WucsAPbRtoZnpFbZiwCFC0OOZR /g1ItOWWhnaPBPjqm4xD84mHA6y2YRErrNbcTJ26ap5BPDt05zBsUoLiawmXCof3zM P8juBxHJWE7jA== Received: from voelundr.fritz.box (unknown [155.133.212.114]) by dd37824.kasserver.com (Postfix) with ESMTPSA id 5DAAD1980F1D; Thu, 23 Jul 2026 12:53:30 +0200 (CEST) From: Andreas Just To: openvpn-devel@lists.sourceforge.net Date: Thu, 23 Jul 2026 12:55:18 +0200 Message-ID: <20260723105518.2363-1-haiku-os@quietcode.org> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 X-Spamd-Bar: -- X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", 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: The Haiku IPv4 route implementation always passes rgi->iface to route(8). That interface describes the pre-VPN default gateway, so ordinary VPN routes are attached to the physical interface even when [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-Headers-End: 1wmrLK-0001Mb-3M Subject: [Openvpn-devel] [PATCH] Haiku: Route VPN networks through tunnel interface 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1871503821859828511 X-GMAIL-MSGID: 1871503821859828511 The Haiku IPv4 route implementation always passes rgi->iface to route(8). That interface describes the pre-VPN default gateway, so ordinary VPN routes are attached to the physical interface even when their gateway is the tunnel peer. Use the recorded physical interface only when the route gateway matches the recorded pre-VPN default gateway. Use the actual tunnel interface for other IPv4 VPN routes. Apply the same interface selection to route addition and deletion. Signed-off-by: Andreas Just --- src/openvpn/route.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 81ce867..e1d00f4 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1477,6 +1477,23 @@ is_on_link(const int is_local_route, const unsigned int flags, const struct rout } #endif +#if defined(TARGET_HAIKU) +static const char * +haiku_route_interface(const struct route_ipv4 *r, const struct tuntap *tt, + const struct route_gateway_info *rgi) +{ + const unsigned int required_flags = RGI_ADDR_DEFINED | RGI_IFACE_DEFINED; + + if (rgi != NULL && (rgi->flags & required_flags) == required_flags + && r->gateway == rgi->gateway.addr) + { + return rgi->iface; + } + + return tt->actual_name; +} +#endif + bool add_route(struct route_ipv4 *r, const struct tuntap *tt, unsigned int flags, const struct route_gateway_info *rgi, /* may be NULL */ @@ -1733,8 +1750,8 @@ add_route(struct route_ipv4 *r, const struct tuntap *tt, unsigned int flags, #elif defined(TARGET_HAIKU) /* ex: route add /dev/net/ipro1000/0 0.0.0.0 gw 192.168.1.1 netmask 128.0.0.0 */ - argv_printf(&argv, "%s add %s inet %s gw %s netmask %s", ROUTE_PATH, rgi->iface, network, - gateway, netmask); + argv_printf(&argv, "%s add %s inet %s gw %s netmask %s", ROUTE_PATH, + haiku_route_interface(r, tt, rgi), network, gateway, netmask); argv_msg(D_ROUTE, &argv); bool ret = openvpn_execve_check(&argv, es, 0, "ERROR: Haiku inet route add command failed"); status = ret ? RTA_SUCCESS : RTA_ERROR; @@ -2176,8 +2193,8 @@ delete_route(struct route_ipv4 *r, const struct tuntap *tt, unsigned int flags, #elif defined(TARGET_HAIKU) /* ex: route delete /dev/net/ipro1000/0 inet 192.168.0.0 gw 192.168.1.1 netmask 255.255.0.0 */ - argv_printf(&argv, "%s delete %s inet %s gw %s netmask %s", ROUTE_PATH, rgi->iface, network, - gateway, netmask); + argv_printf(&argv, "%s delete %s inet %s gw %s netmask %s", ROUTE_PATH, + haiku_route_interface(r, tt, rgi), network, gateway, netmask); argv_msg(D_ROUTE, &argv); openvpn_execve_check(&argv, es, 0, "ERROR: Haiku inet route delete command failed");