Attention is currently required from: cron2, flichtenheld, plaisthos.
Hello cron2, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1193?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: Allowing installing FreeBSD routes with interface instead of
next-hop
......................................................................
Allowing installing FreeBSD routes with interface instead of next-hop
This matches the Linux behaviour of the net_route add/delete commands
Change-Id: I88e16e15fad065cb310d38f09924053efc3a6ce5
Signed-off-by: Arne Schwabe <[email protected]>
---
M src/openvpn/networking_freebsd.c
1 file changed, 35 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1193/4
diff --git a/src/openvpn/networking_freebsd.c b/src/openvpn/networking_freebsd.c
index b47444c..b020f51 100644
--- a/src/openvpn/networking_freebsd.c
+++ b/src/openvpn/networking_freebsd.c
@@ -15,17 +15,29 @@
char buf1[INET_ADDRSTRLEN], buf2[INET_ADDRSTRLEN];
in_addr_t _dst, _gw;
struct argv argv = argv_new();
- bool status;
+
+ ASSERT(gw || iface);
_dst = ntohl(*dst);
- _gw = ntohl(*gw);
- argv_printf(&argv, "%s %s -net %s/%d %s -fib %d", ROUTE_PATH, op,
- inet_ntop(AF_INET, &_dst, buf1, sizeof(buf1)), prefixlen,
- inet_ntop(AF_INET, &_gw, buf2, sizeof(buf2)), table);
+ /* if gw is NULL we are installing a route with the interface as
+ * target instead */
+ if (gw)
+ {
+ _gw = ntohl(*gw);
+ argv_printf(&argv, "%s %s -net %s/%d %s -fib %d", ROUTE_PATH, op,
+ inet_ntop(AF_INET, &_dst, buf1, sizeof(buf1)), prefixlen,
+ inet_ntop(AF_INET, &_gw, buf2, sizeof(buf2)), table);
+ }
+ else
+ {
+ argv_printf(&argv, "%s %s -net %s/%d -iface %s -fib %d", ROUTE_PATH,
op,
+ inet_ntop(AF_INET, &_dst, buf1, sizeof(buf1)), prefixlen,
+ iface, table);
+ }
argv_msg(M_INFO, &argv);
- status = openvpn_execve_check(&argv, NULL, 0, "ERROR: FreeBSD route
command failed");
+ bool status = openvpn_execve_check(&argv, NULL, 0, "ERROR: FreeBSD route
command failed");
argv_free(&argv);
@@ -38,14 +50,26 @@
{
char buf1[INET6_ADDRSTRLEN], buf2[INET6_ADDRSTRLEN];
struct argv argv = argv_new();
- bool status;
- argv_printf(&argv, "%s -6 %s -net %s/%d %s -fib %d", ROUTE_PATH, op,
- inet_ntop(AF_INET6, dst, buf1, sizeof(buf1)), prefixlen,
- inet_ntop(AF_INET6, gw, buf2, sizeof(buf2)), table);
+ ASSERT(gw || iface);
+ /* if gw is NULL, we are installing a route with the interface as target
+ * instead */
+ if (gw)
+ {
+ argv_printf(&argv, "%s -6 %s -net %s/%d %s -fib %d", ROUTE_PATH, op,
+ inet_ntop(AF_INET6, dst, buf1, sizeof(buf1)), prefixlen,
+ inet_ntop(AF_INET6, gw, buf2, sizeof(buf2)), table);
+ }
+ else
+ {
+ argv_printf(&argv, "%s -6 %s -net %s/%d -iface %s -fib %d",
ROUTE_PATH, op,
+ inet_ntop(AF_INET6, dst, buf1, sizeof(buf1)), prefixlen,
+ iface, table);
+ }
+
argv_msg(M_INFO, &argv);
- status = openvpn_execve_check(&argv, NULL, 0, "ERROR: FreeBSD route
command failed");
+ bool status = openvpn_execve_check(&argv, NULL, 0, "ERROR: FreeBSD route
command failed");
argv_free(&argv);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1193?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I88e16e15fad065cb310d38f09924053efc3a6ce5
Gerrit-Change-Number: 1193
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: cron2 <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: cron2 <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel