From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id C3A0B5A0271 for ; Fri, 11 Aug 2023 09:36:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691739365; bh=tuYImNfkOza8jF/fd+2JFTwUHHz4JuIFeU9qzTcgZj4=; h=From:To:Cc:Subject:Date:From; b=kMRPsKYVu9cUn6iWIFSPwqmWIYWQDAu1/2P9YV5wJh4QEIOUe+sySth8SbVDP+mlC JoA2Com2qtkYnnUDYxuVEBFJySLJxTpePXlYDAvnwHiOY52MQs+Nqp6YB1Mtfv0M98 WzaE0xgYE0RFmIF5zU12+KaNf+4EWjKQW0HGJSyM= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RMbFK6PD7z4wxW; Fri, 11 Aug 2023 17:36:05 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH] conf: Demote overlapping port ranges error to a warning Date: Fri, 11 Aug 2023 17:36:00 +1000 Message-ID: <20230811073600.685128-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: JTTWWTNR5Y4GJ7LIKZHFSSF2UEMSQ5D4 X-Message-ID-Hash: JTTWWTNR5Y4GJ7LIKZHFSSF2UEMSQ5D4 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Daniel Rudolf , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: We give a fatal error if the port ranges from any port forwarding specifiers overlap. This occurs even if those port ranges are specifically bound to different addresses, so there's not really any overlap. Right now, we can't 100% handle this case correctly, because our data structures don't have a way to represent per-address forwarding. However, there are a number of cases that will actually work just fine: e.g. mapping the same port to the same port on two different addresses (say :: and 127.0.0.1). We have long term plans to fix this properly, but that is still some time away. For the time being, demote this error to a warning so that the cases that already work will be allowed. Link: https://bugs.passt.top/show_bug.cgi?id=56 Signed-off-by: David Gibson --- conf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/conf.c b/conf.c index 0631b00..0ad6e23 100644 --- a/conf.c +++ b/conf.c @@ -303,7 +303,7 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg, for (i = xrange.first; i <= xrange.last; i++) { if (bitmap_isset(exclude, i)) - goto overlap; + die("Overlapping excluded ranges %s", optarg); bitmap_set(exclude, i); } @@ -370,7 +370,8 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg, for (i = orig_range.first; i <= orig_range.last; i++) { if (bitmap_isset(fwd->map, i)) - goto overlap; + warn( +"Altering mapping of already mapped port number: %s", optarg); if (bitmap_isset(exclude, i)) continue; @@ -406,8 +407,6 @@ enfile: die("Can't open enough sockets for port specifier: %s", optarg); bad: die("Invalid port specifier %s", optarg); -overlap: - die("Overlapping port specifier %s", optarg); mode_conflict: die("Port forwarding mode '%s' conflicts with previous mode", optarg); bind_fail: -- 2.41.0