Skip to contentSkip to conversation

Implement on-link route adding for iproute2

PATCH In review Philipp Hagemeister 2 participants 5 messages Sep 26, 2014 – Oct 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Implement on-link route adding for iproute2

Currently, when compiling with --enable-iproute2 , OpenVPN does not create a correct route when the user is connected to the Internet without a gateway (e.g. via ppp). This patch implements the corresponding FIXME.

---
 src/openvpn/route.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
src/openvpn/route.c +8 -5
index 5428e76..a06c841 100644
@@ -1285,15 +1285,18 @@ add_route (struct route_ipv4 *r,
 
 #if defined(TARGET_LINUX)
 #ifdef ENABLE_IPROUTE
-  /* FIXME -- add on-link support for ENABLE_IPROUTE */
-  argv_printf (&argv, "%s route add %s/%d via %s",
-             iproute_path,
+  argv_printf (&argv, "%s route add %s/%d",
+             iproute_path,
              network,
-             count_netmask_bits(netmask),
-             gateway);
+             count_netmask_bits(netmask));
+
   if (r->flags & RT_METRIC_DEFINED)
     argv_printf_cat (&argv, "metric %d", r->metric);
 
+  if (is_on_link (is_local_route, flags, rgi))
+    argv_printf_cat (&argv, "dev %s", rgi->iface);
+  else
+    argv_printf_cat (&argv, "via %s", gateway);
 #else
   argv_printf (&argv, "%s add -net %s netmask %s",
               ROUTE_PATH,
Signature · 1 line
2.1.1
#1 lore raw

Hi,

Quoted 6 lines · Philipp Hagemeister

Currently, when compiling with --enable-iproute2 , OpenVPN does not create a correct route when the user is connected to the Internet without a gateway (e.g. via ppp). This patch implements the corresponding FIXME.

Looks good to me. Will test and then commit (might take a few days).

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw

Hi Gert,

Quoted 1 line · Gert Doering

Looks good to me. Will test and then commit (might take a few days).

is there a problem with the patch or could you just not test it yet?

Best,

Philipp

#3 lore raw

Hi,

Quoted 4 lines · Philipp Hagemeister
Quoted 1 line · Gert Doering

Looks good to me. Will test and then commit (might take a few days).

is there a problem with the patch or could you just not test it yet?

Couldn't test yet, sorry, mostly for "no time to setup laptop + UMTS to get a ppp0 interface" - have no other machine right now that has openvpn *and* a non-ethernet default gatway.

Apologies.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#4 lore raw
In reply to Philipp Hagemeister

Hi,

Quoted 6 lines · Philipp Hagemeister

Currently, when compiling with --enable-iproute2 , OpenVPN does not create a correct route when the user is connected to the Internet without a gateway (e.g. via ppp). This patch implements the corresponding FIXME.

ACK - feature-ack, stare-at-code ACK and actually tested it on a ppp0 link :)

Your patch was slightly whitespace mangled, so my standard git wrapper tool refused to apply it - "git am --igore-space-change" worked like a charm, though...

Anyway - it's in the master and release/2.3 tree.

commit baa195b9884e276c4fd3dc0c9e8a84b89ea71cfb (master) commit a76fcf1567c912c404e52da1ea5a1b2cca7d601c (release/2.3)

Author: Philipp Hagemeister <[email protected]...>
Date:   Fri Sep 26 18:11:01 2014 +0200
    Implement on-link route adding for iproute2
    Signed-off-by: Philipp Hagemeister <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>
    Message-Id: <[email protected]...>
    URL: http://article.gmane.org/gmane.network.openvpn.devel/9056
    Signed-off-by: Gert Doering <[email protected]...>

sorry it took so long.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...