diff options
author | Philipp Hagemeister | 2014-09-26 18:11:01 +0200 |
---|---|---|
committer | Gert Doering | 2014-10-14 16:18:37 +0200 |
commit | a76fcf1567c912c404e52da1ea5a1b2cca7d601c (patch) | |
tree | 14d4b8e424c9578b3d856fa36b1f65dc8040eb3f | |
parent | 27ab61cec7cefa645a1e02834e032eef12907598 (diff) | |
download | openvpn-a76fcf1567c912c404e52da1ea5a1b2cca7d601c.zip openvpn-a76fcf1567c912c404e52da1ea5a1b2cca7d601c.tar.gz |
Implement on-link route adding for iproute2
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
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.
Signed-off-by: Philipp Hagemeister <phihag@phihag.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <54259015.2030005@phihag.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9056
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit baa195b9884e276c4fd3dc0c9e8a84b89ea71cfb)
-rw-r--r-- | src/openvpn/route.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 532edc6..cc85e4d 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1318,15 +1318,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", + 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, |