- add support for on-link routes

Index: src/openvpn/route.c
--- src/openvpn/route.c.orig
+++ src/openvpn/route.c
@@ -1548,7 +1548,7 @@ local_route(in_addr_t network,
 
 /* Return true if the "on-link" form of the route should be used.  This is when the gateway for
  * a route is specified as an interface rather than an address. */
-#if defined(TARGET_LINUX) || defined(_WIN32) || defined(TARGET_DARWIN)
+#if defined(TARGET_LINUX) || defined(_WIN32) || defined(TARGET_DARWIN) || defined(TARGET_OPENBSD)
 static inline bool
 is_on_link(const int is_local_route, const unsigned int flags, const struct route_gateway_info *rgi)
 {
@@ -1820,12 +1820,17 @@ add_route(struct route_ipv4 *r,
     }
 #endif
 
-    argv_printf_cat(&argv, "-net %s %s -netmask %s",
+    argv_printf_cat (&argv, "-net %s -netmask %s",
                     network,
-                    gateway,
                     netmask);
 
-    /* FIXME -- add on-link support for OpenBSD/NetBSD */
+    /* FIXME -- add on-link support for NetBSD */
+#ifdef TARGET_OPENBSD
+    if (is_on_link (is_local_route, flags, rgi))
+        argv_printf_cat (&argv, "-link -iface %s", rgi->iface);
+    else
+#endif
+        argv_printf_cat (&argv, "%s", gateway);
 
     argv_msg(D_ROUTE, &argv);
     bool ret = openvpn_execve_check(&argv, es, 0,
