Skip to contentSkip to conversation

Make error in setting metric for IPv6 interface non-fatal

PATCH In review [email protected]... 3 participants 3 messages Mar 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make error in setting metric for IPv6 interface non-fatal

From: Selva Nair <[email protected]...>

- Unfortunately there are still users out there who disable IPv6 on tun/tap/dco interfaces or even system-wide.

Fixes Github issue #294
---
 src/openvpnserv/interactive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpnserv/interactive.c +2 -2
index a3d43752..98a42b1f 100644
@@ -847,8 +847,8 @@ AddBlockDNS(const block_dns_message_t *msg, undo_lists_t *lists)
                                        BLOCK_DNS_IFACE_METRIC);
             if (!err)
             {
-                err = set_interface_metric(msg->iface.index, AF_INET6,
-                                           BLOCK_DNS_IFACE_METRIC);
+                set_interface_metric(msg->iface.index, AF_INET6,
+                                     BLOCK_DNS_IFACE_METRIC);
             }
             if (err)
             {
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

I reproduced the bug by disabling IPv6 on the DCO adapter and verified that this patch fixes the problem. Code looks obvious enough.

Could there be clients with IPv6 enabled and IPv4 disabled? :)

ke 22. maalisk. 2023 klo 17.16 [email protected]... kirjoitti:

Quoted 36 lines

From: Selva Nair <[email protected]...>

- Unfortunately there are still users out there who disable IPv6 on tun/tap/dco interfaces or even system-wide.

Fixes Github issue #294
---
 src/openvpnserv/interactive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpnserv/interactive.c +2 -3
index a3d43752..98a42b1f 100644
@@ -847,8 +847,8 @@ AddBlockDNS(const block_dns_message_t *msg, undo_lists_t *lists)
                                        BLOCK_DNS_IFACE_METRIC);
             if (!err)
             {
-                err = set_interface_metric(msg->iface.index, AF_INET6,
-                                           BLOCK_DNS_IFACE_METRIC);
+                set_interface_metric(msg->iface.index, AF_INET6,
+                                     BLOCK_DNS_IFACE_METRIC);
             }
             if (err)
             {
--

2.34.1

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 1 line
-Lev
Acked-by on v1 1/1
#2 lore raw
In reply to [email protected]...

"Trivially correct" according to #294 - same code, just ignoring errors.

I have MinGW-build-tested this, but didn't feel like disabling IPv6 on one of my dear machines to test for real (plus, I currently do not have a working "MinGW build with iservice" setup).

I have added an explanatory comment on why we are intentionally not checking errors in this place while we do it everywhere else (otherwise someone will come in 6 months and point out that "you are missing an return value check there!" :-) ).

Your patch has been applied to the master and release/2.6 branch.

commit b8ee8c43fd81988a58343da466999d2e30ae6221 (master) commit 5babbc78fa27f84039e94b545d03c7049c8bd9c9 (release/2.6)

Author: Selva Nair
Date:   Wed Mar 22 11:15:50 2023 -0400
     Make error in setting metric for IPv6 interface non-fatal

     Signed-off-by: Selva Nair <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26477.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering