From patchwork Wed Nov 15 13:45:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "ralf_lici (Code Review)" X-Patchwork-Id: 3438 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:3c06:b0:f2:62eb:61c1 with SMTP id e6csp2926018dys; Wed, 15 Nov 2023 05:45:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpo0w5odp1xmnhErIQgFplyeD9S8Et6LsQIJjCEK9sWgWmGJnunEIhajpBng598ps7c+XB X-Received: by 2002:a05:6a21:6d93:b0:171:737:df97 with SMTP id wl19-20020a056a216d9300b001710737df97mr2987213pzb.2.1700055948878; Wed, 15 Nov 2023 05:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700055948; cv=none; d=google.com; s=arc-20160816; b=f9EIsfW7BHTLYz7VfPS49qdRw872ytlU2qWpFVXHXNnFeIS4pLNgazre8Q+/THwY2f 6AjaPNWBqQ8cK2SeUlKjL0jX2mI8bcTXjS7p1mPmXSu2xKojXHZRwEvsWZNd24ieqRqu YtBP5yg1iYtZTKwrl96EV/oygY8MjGtmf909e9wHPsyNt3usfrwEG6CCBK8esMatKKqE /842WN9ZsB5gJSweQ17q46C2TsQQOMlGWm5rFkLwX13sNwm5iO+zfJt5j32y7wWv+9UO HLBZkwOxjs5ktw0mxZCDd8/ni/wbzHfz48qToTGF8Flz97TECGrx52bzwgC2NA+oVeos KkvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=FSX6zcCznP6+/Gh46esoLuKVkvAFkm2Ghe95nA78nyg=; fh=U7wEyxtwz2o5+UdevFSA47vNeG9knhWH0KV//QhD5a0=; b=PBZ/S3Oq71wh5BXSMy+YEs/fosu+zkWOQNapVcCr1w5gcoaqInaob8Iaim2DIDkzYl WfiJNcx+znExDDDaf7xO0ShqixVA8qoYpLAx+OwCmxU+rCw1c4yui6S4LxV55RPNeGfZ FfYQx1oA+vm5cI0/4vWDmikitb3ZS5rjBzqPgQYXmmQ1rUpGhINoG3qrIEGPiIlEJlHm 2YG2CZDgLjwfa5T/fY40HEmfozuOUj12xjnhij4S1gHMN+P+hRfWKr3ZjYY/E7Yz3VvH 8AdzA1g4Gdtr7TROAHelbicVnvxUgr4e4OvY31ItCP4xr/qNzgBrD41TQjZCeTJWgt+V qwRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=IRWvK8EG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QJiTETc4; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Sa0KbpNQ; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id q8-20020a6557c8000000b005bdd76219edsi9695687pgr.675.2023.11.15.05.45.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2023 05:45:48 -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=IRWvK8EG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QJiTETc4; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Sa0KbpNQ; 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 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 1r3GCt-0000Qa-Gd; Wed, 15 Nov 2023 13:45:27 +0000 Received: from [172.30.20.202] (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 1r3GCs-0000QT-2B for openvpn-devel@lists.sourceforge.net; Wed, 15 Nov 2023 13:45:26 +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=KDBb37fZU0ZVBcMWuwKSZR53MuaONWXcvNRRMWjKdKk=; b=IRWvK8EGM7aBcshgx16icnfjHV 4tXGZ3eNsbQXOobK3Y0f1/pzf6BHyE+66t7rAwXuTFwUU1BZ0V73WFEb+HvyiQiFePc6RuuQF79vE csuqsNKWBjbwXH0yzl2LT4cKM/WrG1NOVeALH99wjcw31OoSMFUCJrr5zWvFwdOxgqsE=; 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=KDBb37fZU0ZVBcMWuwKSZR53MuaONWXcvNRRMWjKdKk=; b=Q JiTETc4fm3iOaNfo+cgxg8dihQkb+0YITkBDqXQCZ/BLAt1lZxlOsSVGY/hlpU1woCtF2Bahd+90r hJ6pm36XadpOuvqfhHisHrK4rWUKrJem9vy8IoIsEIwH/nvHuEKvH9Hj3EO5qXdeiB1e5eu9CV5DO Rdm1eJpSCvCzpwIg=; Received: from mail-wr1-f44.google.com ([209.85.221.44]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1r3GCo-0000Nz-5S for openvpn-devel@lists.sourceforge.net; Wed, 15 Nov 2023 13:45:26 +0000 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-32daeed7771so3957934f8f.3 for ; Wed, 15 Nov 2023 05:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1700055916; x=1700660716; 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=KDBb37fZU0ZVBcMWuwKSZR53MuaONWXcvNRRMWjKdKk=; b=Sa0KbpNQEy8bN5ri/tD/xpKZfA/9+XC42tPnmla7HjHeJEli+6Zc2ClC7IWUcQR7vy SnF2osGuvBOLxws8iy0f7UbBgwwUYqenRP+urEKA2pGMvb3vxJTd6wjDIM86l8fYSxiw 2olEPDJJcv38jKUY9WghTYZo+3XBhRe+Nb1F5v8/RSM7NRt6eW3lMTnPlkQROxaVDdlr A1yarBdxgITWgsdLEoBhxPkWnjb9rkW/3IA4GAOjDODEJJPTFca34qmVX+J8NVyOvILB GCdw+l8LudVA7hnGxTOiTQFqcH7/ydZKXIFQEOjjNKlreamGAa/jyItwKStCv4/4c0Vg WUSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700055916; x=1700660716; 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=KDBb37fZU0ZVBcMWuwKSZR53MuaONWXcvNRRMWjKdKk=; b=xSlIloB024yVG3tU025JRhczyQ9nQcfO7fet5BBUhiAsUAUG8sahCaLETrETg+jFi1 lxzDoRBn0aDFA/osQ/vbq0NqO+3YsVxVrEemuDKHKmLIefh5qKllR1NQiqbiRw3RdAD/ JYrbG9Sgs67HGrssoFw4BOyTXPzpoZ9yz2qsDBCy5TnGHlreeIAN8s7CCYG75AfN5Tie SGQEXI1we0AStnVEei07cV1xliCXCjnzuErWDg1iVcQu2yFIkDyT8rZ8lJquc/rRgSUA DpWH5JxF9FV7kC6ptt+MIZF/Aa/zTlaYzmBAG1tC+w4uliqgKskloGxrLaPMuKAUYXSL j80Q== X-Gm-Message-State: AOJu0YzdnUFsvArGFTUH78s5ZJ1APYnTA1YmcG/kz/eWY+0JZ/FEbHq3 deZLSNvPYC+AYlpNUURRPSk0dA== X-Received: by 2002:adf:d1cf:0:b0:32d:d2ef:b0e4 with SMTP id b15-20020adfd1cf000000b0032dd2efb0e4mr10050131wrd.0.1700055915697; Wed, 15 Nov 2023 05:45:15 -0800 (PST) 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 b15-20020adff90f000000b0031fd849e797sm10596409wrr.105.2023.11.15.05.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:45:15 -0800 (PST) From: "ordex (Code Review)" X-Google-Original-From: "ordex (Code Review)" X-Gerrit-PatchSet: 1 Date: Wed, 15 Nov 2023 13:45:14 +0000 To: plaisthos , flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I8c9ec61af9e786ec284e756ec3a77a959c79f49b X-Gerrit-Change-Number: 437 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 9aef3a4cb8113863f71da635a503ecba253fa006 References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 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: Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.44 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.44 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_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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 T_SCC_BODY_TEXT_LINE No description available. 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1r3GCo-0000Nz-5S Subject: [Openvpn-devel] [S] Change in openvpn[master]: override ai_family if 'local' numeric address was specified 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: a@unstable.cc, 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?1782637867088433831?= X-GMAIL-MSGID: =?utf-8?q?1782637867088433831?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/437?usp=email to review the following change. Change subject: override ai_family if 'local' numeric address was specified ...................................................................... override ai_family if 'local' numeric address was specified This change ensures that when a numeric IP address is specified as argument to a 'local' directive, its ai_family overrides the one extracted from the 'proto' config option. Change-Id: I8c9ec61af9e786ec284e756ec3a77a959c79f49b Signed-off-by: Antonio Quartulli --- M src/openvpn/socket.c 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/37/437/1 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 5d9e111..ffd8daf 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -489,9 +489,8 @@ sig_info = &sigrec; } - /* try numeric ipv6 addr first */ + /* try numeric ip addr first */ CLEAR(hints); - hints.ai_family = ai_family; hints.ai_flags = AI_NUMERICHOST; if (flags & GETADDR_PASSIVE) @@ -519,6 +518,10 @@ const char *fmt; int level = 0; + /* this is not a numeric IP, therefore force resolution using the + * provided ai_family */ + hints.ai_family = ai_family; + if (hostname && (flags & GETADDR_RANDOMIZE)) { hostname = hostname_randomize(hostname, &gc); @@ -1120,7 +1123,9 @@ /* force binding IPv6-only if an address was specified * an it is a IPv6 */ if (sock->local_host && ai_family == AF_INET6) + { v6only = true; + } socket_bind(sock->sd, sock->info.lsa->bind_local, ai_family, "TCP/UDP", v6only); @@ -1712,6 +1717,10 @@ sock->local_host, sock->local_port, gai_strerror(status)); } + + /* the resolved 'local entry' might have a different family than what + * was globally configured */ + sock->info.af = sock->info.lsa->bind_local->ai_family; } gc_free(&gc);