$OpenBSD: patch-src_openvpn_tun_c,v 1.17 2019/02/21 23:41:12 jca Exp $

- no need for link0 any more, we have separate tap interfaces
- fix memory leak (gc is unused)

Index: src/openvpn/tun.c
--- src/openvpn/tun.c.orig
+++ src/openvpn/tun.c
@@ -1202,7 +1202,7 @@ do_ifconfig(struct tuntap *tt,
         if (tun)
         {
             argv_printf(&argv,
-                        "%s %s %s %s mtu %d netmask 255.255.255.255 up -link0",
+                        "%s %s %s %s mtu %d netmask 255.255.255.255 up",
                         IFCONFIG_PATH,
                         actual,
                         ifconfig_local,
@@ -1214,7 +1214,7 @@ do_ifconfig(struct tuntap *tt,
         {
             remote_end = create_arbitrary_remote( tt );
             argv_printf(&argv,
-                        "%s %s %s %s mtu %d netmask %s up -link0",
+                        "%s %s %s %s mtu %d netmask %s up",
                         IFCONFIG_PATH,
                         actual,
                         ifconfig_local,
@@ -1225,8 +1225,13 @@ do_ifconfig(struct tuntap *tt,
         }
         else
         {
+           /*
+            * OpenBSD has distinct tun and tap devices
+            * so we don't need the "link0" extra parameter to specify we want to do
+            * tunneling at the ethernet level
+            */
             argv_printf(&argv,
-                        "%s %s %s netmask %s mtu %d broadcast %s link0",
+                        "%s %s %s netmask %s mtu %d broadcast %s",
                         IFCONFIG_PATH,
                         actual,
                         ifconfig_local,
@@ -2615,7 +2620,6 @@ close_tun(struct tuntap *tt)
     }
     else if (tt)
     {
-        struct gc_arena gc = gc_new();
         struct argv argv = argv_new();
 
         /* setup command, close tun dev (clears tt->actual_name!), run command
