[Openvpn-devel,2/2] Fix IPv6 routes on tap interfaces on OpenSolaris/OpenIndiana

Message ID 20191009095200.9337-2-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,1/2] repair tap mode on OpenSolaris/OpenIndiana | expand

Commit Message

Gert Doering Oct. 8, 2019, 10:52 p.m. UTC
The "route add" code always used "metric 0" on OpenSolaris, because
(on tun interfaces) it was required to make the route work on
"non-ethernet" interfaces (connected, no NDP).

This breaks routes via tap interfaces on recent Solaris versions
(tested on OpenIndiana 2019) - there, routes only work if metric
is != 0 (or just not set).  Otherwise it tries to map the gateway
address to a local address and fails.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
---
 src/openvpn/route.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Antonio Quartulli Oct. 9, 2019, 12:11 a.m. UTC | #1
Hi,

On 09/10/2019 11:52, Gert Doering wrote:
> The "route add" code always used "metric 0" on OpenSolaris, because
> (on tun interfaces) it was required to make the route work on
> "non-ethernet" interfaces (connected, no NDP).
> 
> This breaks routes via tap interfaces on recent Solaris versions
> (tested on OpenIndiana 2019) - there, routes only work if metric
> is != 0 (or just not set).  Otherwise it tries to map the gateway
> address to a local address and fails.
> 

I have no means to test the code so I only stared at it and ensured it
was affecting the SOLARIS platform code only. It does what the commit
says and it makes sense in the solaris-nonsense-world.

Gert has performed some live tests on his new OpenIndiana 2019 host
(where the problem was observed) and ensured it worked fine.

Acked-by: Antonio Quartulli <antonio@openvpn.net>


> Signed-off-by: Gert Doering <gert@greenie.muc.de>
> ---
>  src/openvpn/route.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/openvpn/route.c b/src/openvpn/route.c
> index 3183fb47..97e90e56 100644
> --- a/src/openvpn/route.c
> +++ b/src/openvpn/route.c
> @@ -2043,8 +2043,8 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,
>                  r6->netbits,
>                  gateway );
>  
> -    /* on tun/tap, not "elsewhere"? -> metric 0 */
> -    if (!r6->iface)
> +    /* on tun (not tap), not "elsewhere"? -> metric 0 */
> +    if (tt->type == DEV_TYPE_TUN && !r6->iface)
>      {
>          argv_printf_cat(&argv, "0");
>      }
>
Gert Doering Oct. 9, 2019, 12:44 a.m. UTC | #2
Your patch has been applied to the master branch.

commit 01b3a48c29df6dc4bade3d8fb7903346a3f77887
Author: Gert Doering
Date:   Wed Oct 9 11:52:00 2019 +0200

     Fix IPv6 routes on tap interfaces on OpenSolaris/OpenIndiana

     Signed-off-by: Gert Doering <gert@greenie.muc.de>
     Acked-by: Antonio Quartulli <antonio@openvpn.net>
     Message-Id: <20191009095200.9337-2-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18906.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
Gert Doering Oct. 28, 2019, 7:19 a.m. UTC | #3
Hi,

On Wed, Oct 09, 2019 at 01:44:08PM +0200, Gert Doering wrote:
> Your patch has been applied to the master branch.
> 
> commit 01b3a48c29df6dc4bade3d8fb7903346a3f77887
> Author: Gert Doering
> Date:   Wed Oct 9 11:52:00 2019 +0200

I have also pulled this to release/2.4, as it's needed to unbreak
tap on OpenIndiana.

(This is the "route metric 0" confusion - the "do not mix addif and mtu"
patch is not needed because the offending refactoring is not in 2.4
either)

commit 0b2b25dfa3a19aba9c99e9a55a082fe85c4ccd59 (HEAD -> release/2.4, vweb1/release/2.4)
Author: Gert Doering <gert@greenie.muc.de>
Date:   Wed Oct 9 11:52:00 2019 +0200

    Fix IPv6 routes on tap interfaces on OpenSolaris/OpenIndiana

    (cherry picked from commit 01b3a48c29df6dc4bade3d8fb7903346a3f77887)

gert

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 3183fb47..97e90e56 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -2043,8 +2043,8 @@  add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,
                 r6->netbits,
                 gateway );
 
-    /* on tun/tap, not "elsewhere"? -> metric 0 */
-    if (!r6->iface)
+    /* on tun (not tap), not "elsewhere"? -> metric 0 */
+    if (tt->type == DEV_TYPE_TUN && !r6->iface)
     {
         argv_printf_cat(&argv, "0");
     }