[Openvpn-devel] Add 'printing of port number' to mroute_addr_print_ex() for v4-mapped v6.
| Message ID | 20181207123303.70827-1-gert@greenie.muc.de |
|---|---|
| State | Accepted |
| Delegated to: | Antonio Quartulli |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 8AcBAs1oClykUQAAIUCqbw for <patchwork@openvpn.net>; Fri, 07 Dec 2018 07:34:21 -0500 Received: from proxy4.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id +Pr7Ac1oClxbbwAApN4f7A ; Fri, 07 Dec 2018 07:34:21 -0500 Received: from smtp14.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.ord1d.rsapps.net with LMTP id gMS0Ac1oCly1dAAAiYrejw ; Fri, 07 Dec 2018 07:34:21 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp14.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=greenie.muc.de X-Suspicious-Flag: YES X-Classification-ID: 6af87b2a-fa1c-11e8-8569-525400504bae-1-1 Received: from [216.105.38.7] ([216.105.38.7:57832] helo=lists.sourceforge.net) by smtp14.gate.ord1d.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 70/C6-06014-CC86A0C5; Fri, 07 Dec 2018 07:34:20 -0500 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1gVFJk-0003Nf-51; Fri, 07 Dec 2018 12:33:16 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from <gert@mariotte2.space.net>) id 1gVFJj-0003NY-4W for openvpn-devel@lists.sourceforge.net; Fri, 07 Dec 2018 12:33:15 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Mux+0FrVtZyR8t5Ggcb7NtvJ4PgGxyxEG/LArwPn8Yc=; b=IGrylwXXWte7ihsyLUvVt6In2i WrHNMYNqvG/fGaqPgq1dKAqcSPfPd45HUCDSlEOzvPJdQHTNGDWkjHB+EA/HZ0Q02Vk55sQRhagbJ SYpRUCCaPEQ4hLKhkKqHFXJqLwMbvGYZsr6W6yog4RVt0SDboVF6nrFA2kte2E01b0ts=; 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: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Mux+0FrVtZyR8t5Ggcb7NtvJ4PgGxyxEG/LArwPn8Yc=; b=N 74/plun2gpWhZcWl79Zi/W89b7csxyHwi+WBA/eHjRBO65PpASg8BV03xBMLNog3XdWVz5rOs6sBq RHvPdyi9uIKdPhzLrWduP+fyBKrTTqtiFW4v1/hjGYbCpPIEWm2RhJ4B2iPUB9L4ZSakwgHQR9Wzl FEUfF9a6dcbTv+Qw=; Received: from mariotte.space.net ([193.149.36.253] helo=mariotte2.space.net) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1gVFJg-00625Z-N2 for openvpn-devel@lists.sourceforge.net; Fri, 07 Dec 2018 12:33:15 +0000 Received: from mariotte2.space.net (localhost [127.0.0.1]) by mariotte2.space.net (8.15.2/8.15.2) with ESMTPS id wB7CX3SS070869 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for <openvpn-devel@lists.sourceforge.net>; Fri, 7 Dec 2018 13:33:03 +0100 (CET) (envelope-from gert@mariotte2.space.net) Received: (from gert@localhost) by mariotte2.space.net (8.15.2/8.15.2/Submit) id wB7CX36L070868 for openvpn-devel@lists.sourceforge.net; Fri, 7 Dec 2018 13:33:03 +0100 (CET) (envelope-from gert) From: Gert Doering <gert@greenie.muc.de> To: openvpn-devel@lists.sourceforge.net Date: Fri, 7 Dec 2018 13:33:03 +0100 Message-Id: <20181207123303.70827-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1gVFJg-00625Z-N2 Subject: [Openvpn-devel] [PATCH] Add 'printing of port number' to mroute_addr_print_ex() for v4-mapped v6. X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] Add 'printing of port number' to mroute_addr_print_ex() for v4-mapped v6.
|
|
Commit Message
Gert Doering
Dec. 7, 2018, 1:33 a.m. UTC
For whatever reason, this function never printed port numbers for
IPv6 addresses (but it did for IPv4) - which creates a bit of
confusion for IPv6-mapped v4 addresses on a dual stack socket,
that will have ports numbers printed or not, depending on whether
it's a dual-stack v6 socket or single-stack v4.
This will not(!) add printing of port numbers for "proper" v6
addresses yet, because that might have adverse side effects to address
parsing elsewhere.
Signed-off-by: Gert Doering <gert@greenie.muc.de>
---
src/openvpn/mroute.c | 7 +++++++
1 file changed, 7 insertions(+)
Comments
Hi, On 07/12/2018 22:33, Gert Doering wrote: > For whatever reason, this function never printed port numbers for > IPv6 addresses (but it did for IPv4) - which creates a bit of > confusion for IPv6-mapped v4 addresses on a dual stack socket, > that will have ports numbers printed or not, depending on whether > it's a dual-stack v6 socket or single-stack v4. > > This will not(!) add printing of port numbers for "proper" v6 > addresses yet, because that might have adverse side effects to address > parsing elsewhere. > > Signed-off-by: Gert Doering <gert@greenie.muc.de> > --- > src/openvpn/mroute.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c > index 28940a8d..134f4c00 100644 > --- a/src/openvpn/mroute.c > +++ b/src/openvpn/mroute.c > @@ -477,6 +477,13 @@ mroute_addr_print_ex(const struct mroute_addr *ma, > { > buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr, > IA_NET_ORDER, gc)); > + /* we only print port numbers for v4mapped v6 as of > + * today, because "v6addr:port" is too ambiguous > + */ The comments above are indented with tab+spaces, while the code below is just all spaces. Please use the all spaces everywhere. > + if (maddr.type & MR_WITH_PORT) > + { > + buf_printf(&out, ":%d", ntohs(maddr.v6.port)); > + } I don't understand how is this solving the ambiguity? Or you are just saying: "we can't do much, let's just print the port anyway"? My suggestion would be to surround the address with [], so basically change the printf format above from %s to [%s]. Does it make sense? Cheers, > } > else > { >
Hi, On Sat, Dec 08, 2018 at 09:47:37AM +1000, Antonio Quartulli wrote: > > + /* we only print port numbers for v4mapped v6 as of > > + * today, because "v6addr:port" is too ambiguous > > + */ > > The comments above are indented with tab+spaces, while the code below is > just all spaces. Please use the all spaces everywhere. Gah. That was the intention, but the comment was added later on and using the wrong editor :-) > > + if (maddr.type & MR_WITH_PORT) > > + { > > + buf_printf(&out, ":%d", ntohs(maddr.v6.port)); > > + } > > I don't understand how is this solving the ambiguity? These are *v4* addresses, just masquerading as v6 in the socket structure. So 1.2.3.4:567 is never ambiguous. For "true v6 addresses" (the other branch) we keep on not printing the port number. > Or you are just > saying: "we can't do much, let's just print the port anyway"? My > suggestion would be to surround the address with [], so basically change > the printf format above from %s to [%s]. Does it make sense? This is something I want to discuss. Changing mroute_print_addr_ex() for "true v6 addresses" and printing the port number in a new format will affect status file printing, management interface, etc. - so it needs to be well considered. *This* patch just fixes the discrepancy that v4 addresses are printed "with port" if doing "proto udp4", and "without port" if a v4 connect comes in on a "proto udp / v6only=no" socket. (We do not need to discuss how many problems the v4mapped v6 address format brings with it...) gert
Hi, On 08/12/2018 18:03, Gert Doering wrote: > Hi, > > On Sat, Dec 08, 2018 at 09:47:37AM +1000, Antonio Quartulli wrote: >>> + /* we only print port numbers for v4mapped v6 as of >>> + * today, because "v6addr:port" is too ambiguous >>> + */ >> >> The comments above are indented with tab+spaces, while the code below is >> just all spaces. Please use the all spaces everywhere. > > Gah. That was the intention, but the comment was added later on and > using the wrong editor :-) > >>> + if (maddr.type & MR_WITH_PORT) >>> + { >>> + buf_printf(&out, ":%d", ntohs(maddr.v6.port)); >>> + } >> >> I don't understand how is this solving the ambiguity? > > These are *v4* addresses, just masquerading as v6 in the socket structure. > > So 1.2.3.4:567 is never ambiguous. > > For "true v6 addresses" (the other branch) we keep on not printing the > port number. > >> Or you are just >> saying: "we can't do much, let's just print the port anyway"? My >> suggestion would be to surround the address with [], so basically change >> the printf format above from %s to [%s]. Does it make sense? > > This is something I want to discuss. Changing mroute_print_addr_ex() > for "true v6 addresses" and printing the port number in a new format > will affect status file printing, management interface, etc. - so it > needs to be well considered. > > *This* patch just fixes the discrepancy that v4 addresses are printed > "with port" if doing "proto udp4", and "without port" if a v4 connect > comes in on a "proto udp / v6only=no" socket. (We do not need to discuss > how many problems the v4mapped v6 address format brings with it...) > Thanks for the clarification. The patch looks good and does what it says on the lid. Tested by checking the status output (with and without the patch) and everything looked good. Now it only needs to have the tabs fixed on the comment lines, but other than that: Acked-by: Antonio Quartulli <antonio@openvpn.net> Regards,
Patch has been applied to the master and release/2.4 branch (as I see
this as a bugfix). Uncrustify applied, tabs are spaced.
"Print port numbers on v6 addresses" landed on my agenda again, need
to make up my mind on address format and then come up with a proposal.
commit 4543b13b8540836f6faf67a03b5358bb8bb94a4a (master)
commit c2f7058700bc12858a74c53266534c567d1b05f2 (release/2.4)
Author: Gert Doering
Date: Fri Dec 7 13:33:03 2018 +0100
Add 'printing of port number' to mroute_addr_print_ex() for v4-mapped v6.
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20181207123303.70827-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17996.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c index 28940a8d..134f4c00 100644 --- a/src/openvpn/mroute.c +++ b/src/openvpn/mroute.c @@ -477,6 +477,13 @@ mroute_addr_print_ex(const struct mroute_addr *ma, { buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr, IA_NET_ORDER, gc)); + /* we only print port numbers for v4mapped v6 as of + * today, because "v6addr:port" is too ambiguous + */ + if (maddr.type & MR_WITH_PORT) + { + buf_printf(&out, ":%d", ntohs(maddr.v6.port)); + } } else {