From patchwork Fri Jul 25 19:41:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4328 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:3644:b0:671:5a2c:6455 with SMTP id a4csp1710569mai; Fri, 25 Jul 2025 12:41:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWYzmHNl9RchwoC22x66GfcCchQZy007Ut8/KoLqHUijnSDCQEILdW60c7HDy9jsLx8YIYTUxeONEo=@openvpn.net X-Google-Smtp-Source: AGHT+IFBdhJ7L6CjmeyBeRu+iHAUzzKd7qBnk9lcvAYOafOzkhL/6U4YJKdsnZ09FFHNGBo6GvCY X-Received: by 2002:a05:6808:211b:b0:40b:a456:e742 with SMTP id 5614622812f47-42bbb1a7ae2mr1597231b6e.37.1753472519686; Fri, 25 Jul 2025 12:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1753472519; cv=none; d=google.com; s=arc-20240605; b=ZQlwh94bnQ6WXnSvXbIcKjeyctXHwgNvyd2J7O06Q2e6w2iyuymKk99+CNjx2ZIj2y UcyBENtzik8qHaOALbO8eo9RlM/t4vJqcR2j1WH50vYACQs5eM+gMbZ7bstPdcsFk8mP BjSlV3sd2lmmhbo0GX6qfl7b08mWcnFvyhE/blSGCctA9s22bLAH4QTwg9TM+m9uI8Y/ JXzn/8sRVCAFEvbPNhWU/n2UnmYTlY09wBHseiak0zjL9/VJ/9A1ssSAVpyQEsVWGiJv /faQQQ6CUhvL8PnkAlgaJSPIygF3H4jAJDGkPCyFtf0aQfsOi31Q4iVuF7jiGWYz7qwx 0W4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=mZmgveFJ2CoFfCpXlxxeYC43brUJw50k2ulPBIZU0+o=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=BNOjQJtNAOuI018DA9MwfH9lzmzfiX5IL7nkQpLm34LdqgtZDJ09l/Gzg8a4uZwGIN rtHMljeOI5FqAJW+R1m8cZuU0nQrxx2c5wvPx0jHxe7IaWGsnFLIwwy0Bk+4tl7PCwHD 3YqZFN0EUqtyzi3jCJ02bWa5FL+5/76mnbvByu4vMe3mCi0MI6RjyNSPypM0aYg5GuTd 7blto/tokxNU7y7eHcbyevODXmtAFngp/sC099EVyS7asywXpQ04fhO55HTGchxWXsY0 sq74ZljUKf1cbWFVzyHh1T8cCQf9WbmqVflfY1cUN4UXilZWEUOV/5X9sKhCm/eM9TD9 0v/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=i+b2YmFq; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=mi0ThLF8; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dT2PBsS1; 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=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-42c80759dd7si121467b6e.253.2025.07.25.12.41.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jul 2025 12:41:59 -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=i+b2YmFq; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=mi0ThLF8; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dT2PBsS1; 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=muc.de 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:References:In-Reply-To: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:List-Owner; bh=mZmgveFJ2CoFfCpXlxxeYC43brUJw50k2ulPBIZU0+o=; b=i+b2YmFq+snxk/O0m/Uswihvkr nf7Wobb8l/HsYjIRHEtjNd0pmv9BKIe9DMQW/7OAIIBRMDZztBWmZZpmSJ3OPHdjA4xk9A9wqR+dz HfxMLmoM/c9fYprpKR0Ehk3F3cx6959JARh3u9Cfz51Ifge6iEccplPn+WDIsh9eJE/8=; 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 1ufOIn-0008HQ-NE; Fri, 25 Jul 2025 19:41:57 +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 1ufOIm-0008HJ-52 for openvpn-devel@lists.sourceforge.net; Fri, 25 Jul 2025 19:41: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:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jkw8EAX8YxuWiL18hUCmveSzTdAWJesm7q3RJcxBG0Q=; b=mi0ThLF858joNTrW9j9afno+h7 4hxDWGCfVkKkrAcCSLyd2Oa5BcWZlr89oJL0mwLU5ZihIAKQ1j623ExbGVZmQj6V0Ki9Cgkit2bQZ WEMG9BV19lZu+HCVRz9/LPf4T49GZh5Dd6hyHnChvf/tgWLQuQLFemlpFTscB0UAwEZA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jkw8EAX8YxuWiL18hUCmveSzTdAWJesm7q3RJcxBG0Q=; b=dT2PBsS1u5Pm0uWcg+dL2Hch1v Z1eFi8G3He7ZjBsL6zypqyTnyhMU/poul8+huKDJFw8Uv6PYxBKrCE63lGvWz1WBmN9M8RaX1HnsS 1EUqxdHdN0EPjD1CywfBnabrTI0QuJKX120l+wLkegfQ1cPQp/SNZUHc9SJuBWt05kco=; Received: from [193.149.48.143] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1ufOIk-00076B-Uc for openvpn-devel@lists.sourceforge.net; Fri, 25 Jul 2025 19:41:56 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 56PJfmvI017549 for ; Fri, 25 Jul 2025 21:41:48 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 56PJfmw0017546 for openvpn-devel@lists.sourceforge.net; Fri, 25 Jul 2025 21:41:48 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 25 Jul 2025 21:41:39 +0200 Message-ID: <20250725194147.17517-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) 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: From: Ralf Lici Introduce the MAPF_SHOW_FAMILY flag to prepend the address family to the address when printing an mroute_addr object, similar to print_sockaddr_ex(). This ensures that when logging a float operation, [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1ufOIk-00076B-Uc Subject: [Openvpn-devel] [PATCH v2] add flag to print addresses in a consistent format during float 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: =?utf-8?q?1838649200297566125?= X-GMAIL-MSGID: =?utf-8?q?1838649200297566125?= From: Ralf Lici Introduce the MAPF_SHOW_FAMILY flag to prepend the address family to the address when printing an mroute_addr object, similar to print_sockaddr_ex(). This ensures that when logging a float operation, both the old and new addresses are printed in the same format: $proto:[$family]$address:$port. Note: when using this flag with an IPv4-mapped IPv6 address, the output will appear as: [AF_INET6]a.b.c.d Change-Id: I43cd3d564d8c6ad4e41de5a38130d90cb6778395 Signed-off-by: Ralf Lici Acked-by: Gert Doering --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1092 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c index a617b33..e3b1e9b 100644 --- a/src/openvpn/mroute.c +++ b/src/openvpn/mroute.c @@ -415,6 +415,10 @@ { buf_printf(&out, "%s:", proto2ascii(maddr.proto, AF_INET, false)); } + if (flags & MAPF_SHOW_FAMILY) + { + buf_printf(&out, "[AF_INET]"); + } buf_printf(&out, "%s", print_in_addr_t(ntohl(maddr.v4.addr), (flags & MAPF_IA_EMPTY_IF_UNDEF) ? IA_EMPTY_IF_UNDEF : 0, gc)); if (maddr.type & MR_WITH_NETBITS) @@ -442,6 +446,10 @@ { buf_printf(&out, "%s:", proto2ascii(maddr.proto, AF_INET6, false)); } + if (flags & MAPF_SHOW_FAMILY) + { + buf_printf(&out, "[AF_INET6]"); + } if (IN6_IS_ADDR_V4MAPPED( &maddr.v6.addr ) ) { buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr, diff --git a/src/openvpn/mroute.h b/src/openvpn/mroute.h index c359fd2..4f9fc03 100644 --- a/src/openvpn/mroute.h +++ b/src/openvpn/mroute.h @@ -150,6 +150,7 @@ #define MAPF_SUBNET (1<<0) #define MAPF_IA_EMPTY_IF_UNDEF (1<<1) #define MAPF_SHOW_ARP (1<<2) +#define MAPF_SHOW_FAMILY (1<<3) const char *mroute_addr_print_ex(const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 4696686..69ec2da 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3274,8 +3274,8 @@ msg(D_MULTI_MEDIUM, "peer %" PRIu32 " (%s) floated from %s to %s", mi->context.c2.tls_multi->peer_id, tls_common_name(mi->context.c2.tls_multi, false), - mroute_addr_print(&mi->real, &gc), - print_link_socket_actual(&m->top.c2.from, &gc)); + mroute_addr_print_ex(&mi->real, MAPF_SHOW_FAMILY, &gc), + mroute_addr_print_ex(&real, MAPF_SHOW_FAMILY, &gc)); /* remove old address from hash table before changing address */ ASSERT(hash_remove(m->hash, &mi->real));