Skip to contentSkip to conversation

Change in openvpn[master]: if a local IPv6 address is provided, socket must be v6-only

Openvpn-devel its_Giaan (Code Review) 1 participant 9 messages Sep 23, 2024 – Feb 2, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1727098847000.I705fd9bf9298a54560eca12e3797351f4af321a7@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, ordex, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/761?usp=email

to review the following change.

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

if a local IPv6 address is provided, socket must be v6-only

Change-Id I705fd9bf9298a54560eca12e3797351f4af321a7

---
M src/openvpn/socket.c

1 file changed, 8 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/761/1

src/openvpn/socket.c +8 -2
index a7835e0..d1b16c5 100644
@@ -1108,9 +1108,15 @@
         }
         else
         {
+            bool v6only = sock->info.bind_ipv6_only;
+
+            /* 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", sock->info.bind_ipv6_only);
+                        ai_family, "TCP/UDP", v6only);
         }
     }
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: its_Giaan, ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/761?usp=email )

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

Patch Set 1: Code-Review-1

(2 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/761/comment/17ec1bd2_7d7dd5bc :
PS1, Line 7: if
Please add more details in commit message.

Does this fix a pre-existing issue? Or is this only required in context of multi-socket?

File src/openvpn/socket.c:

http://gerrit.openvpn.net/c/openvpn/+/761/comment/1ecc789a_f41e03db :
PS1, Line 1114: is a
"and"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 13:49:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, its_Giaan, plaisthos.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/761?usp=email )

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

Patch Set 1:

(1 comment)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/761/comment/022a32f8_4e0ee3ea :
PS1, Line 7: if

Quoted 1 line

Please add more details in commit message. […]

Chiming in as I am responsible for this change (implemented loooong ago).
Unfortunately I can't recall the reason why we needed this, but I think it has to do with some "interesting" combination of sockets, like:
- one on a specific ipv6
- one on wildcard ipv4
or something along those lines.

I am unable to trigger any conflict using multiple instances right now (with master branch).

We can exclude this patch for the time being and get back to it once tests will reveal what the problem was (or when maybe my memory about this will get back)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 01 Oct 2024 13:04:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, its_Giaan, plaisthos.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/761?usp=email )

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

Patch Set 1:

(1 comment)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/761/comment/62c4bed4_547e83d0 :
PS1, Line 7: if

Quoted 1 line

Chiming in as I am responsible for this change (implemented loooong ago). […]

The only thing that comes to my mind is that if we wanted to have a wildcard ipv6 socket (i.e. ::$port) that should be separate from a wildcard ipv4 socket, we must have this flag on when passing '::' to --local, otherwise the second socket won't be able to bind.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 01 Oct 2024 13:07:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, its_Giaan, plaisthos.

Hello flichtenheld, ordex, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/761?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

if a local IPv6 address is provided, socket must be v6-only

If we want to use a wildcard IPv6 socket (i.e ::port), it must be separate from an IPv4 wildcard socket. To do this, we need to set a specific flag when passing '::' to '--local' otherwise the second socket won't be able to bind properly.

Change-Id I705fd9bf9298a54560eca12e3797351f4af321a7

---
M src/openvpn/socket.c

1 file changed, 10 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/761/2

src/openvpn/socket.c +10 -2
index 1e48d9a..8677472 100644
@@ -1111,9 +1111,17 @@
         }
         else
         {
+            bool v6only = sock->info.bind_ipv6_only;
+
+            /* force binding IPv6-only if an address was specified
+             * and 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", sock->info.bind_ipv6_only);
+                        ai_family, "TCP/UDP", v6only);
         }
     }
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/761?usp=email )

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

Patch Set 2:

(1 comment)

File src/openvpn/socket.c:

http://gerrit.openvpn.net/c/openvpn/+/761/comment/82bc4287_22f216c6 :
PS1, Line 1114: is a

Quoted 1 line

"and"

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 01 Oct 2024 15:31:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos.

Hello flichtenheld, ordex, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/761?usp=email

to look at the new patch set (#5).

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

if a local IPv6 address is provided, socket must be v6-only

If we want to use a wildcard IPv6 socket (i.e ::port), it must be separate from an IPv4 wildcard socket. To do this, we need to set a specific flag when passing '::' to '--local' otherwise the second socket won't be able to bind properly.

Change-Id I705fd9bf9298a54560eca12e3797351f4af321a7

---
M src/openvpn/socket.c

1 file changed, 10 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/761/5

src/openvpn/socket.c +10 -2
index b7d80ee..2b55021 100644
@@ -1111,9 +1111,17 @@
         }
         else
         {
+            bool v6only = sock->info.bind_ipv6_only;
+
+            /* force binding IPv6-only if an address was specified
+             * and 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", sock->info.bind_ipv6_only);
+                        ai_family, "TCP/UDP", v6only);
         }
     }
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-MessageType: newpatchset

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, its_Giaan, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/761?usp=email )

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

Patch Set 6: Code-Review-1

(1 comment)

Patchset:

PS6:
The patch looks fine, though I'm not sure how we want things to be in future. Maybe we just want to get rid of ipv6only completely, as that's just a hack to get dual-stack server support on OSes that support this...

Indeed, postpone this a bit, and think more on "what do we want 2.7 to behave like?" - some multi-socket daemons do one thing, others do it differently (apache, sshd)...

But whatever it ends up being, it needs an addition to the ipv6only flag to --bind in the manpage...

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 6
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 23 Oct 2024 20:46:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, its_Giaan, ordex, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/761?usp=email )

Change subject: if a local IPv6 address is provided, socket must be v6-only
......................................................................

Patch Set 16: Code-Review-1

(1 comment)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/761/comment/78420fab_8b8d4fb4 :
PS1, Line 7: if

Quoted 1 line

The only thing that comes to my mind is that if we wanted to have a wildcard ipv6 socket (i.e. […]

The more I think about this, the more I find that we should cover this by documentation :-) - changing the default bind behaviour will break people's config on upgrading a server config with local :: or proto udp6, because it will stop listening to IPv4.

So what we should do is to document that * udp6 or ::will default to ipv4 + ipv6, unless bind ipv6only is configured - and not try to solve this in code, at least not for 2.7 when "just one socket" configs will be the normal case on upgrading.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/761?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I705fd9bf9298a54560eca12e3797351f4af321a7
Gerrit-Change-Number: 761
Gerrit-PatchSet: 16
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Sun, 02 Feb 2025 21:12:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment