Subject: pkg/32871: OpenVPN fails to properly assign IP adress to TAP device ( fix included )
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <kdev@no-log.org>
List: pkgsrc-bugs
Date: 02/18/2006 23:25:00
>Number:         32871
>Category:       pkg
>Synopsis:       OpenVPN fails to properly assign IP adress to TAP device ( fix included )
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 18 23:25:00 +0000 2006
>Originator:     Emmanuel Kasper
>Release:        3.0
>Organization:
Cocoon Technologies
>Environment:
NetBSD dhcppc0 3.0 NetBSD 3.0 (GENERIC_LAPTOP) #0: Mon Dec 19 01:08:52 UTC 2005  builds@works.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/i386/200512182024Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/i386/compile/GENERIC_LAPTOP i386
>Description:
When starting OpenVPN 2.0.5  from pkgsrc using a tap device, openvpn vpn exits with the message, if you request 

Sorry, but I don't know how to do 'ifconfig' commands on th
is operating system.  You should ifconfig your TUN/TAP device manually or use an
 --up script.

This problem is NetBSD specific.
>How-To-Repeat:
Use openvpn with a config file which have : 
dev tap
pull 
>Fix:
Patch to tun.c : just add the right ifconfig parameters for netbsd's tap

--- tun.c.orig	2006-01-07 17:56:51.000000000 +0000
+++ tun.c	2006-01-07 18:08:22.000000000 +0000
@@ -690,7 +690,19 @@ do_ifconfig (struct tuntap *tt,
 			  tun_mtu
 			  );
       else
-	no_tap_ifconfig ();
+      /*
+       * NetBSD 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
+       */
+		openvpn_snprintf (command_line, sizeof (command_line),
+			  IFCONFIG_PATH " %s %s netmask %s mtu %d broadcast %s",
+			  actual,
+			  ifconfig_local,
+			  ifconfig_remote_netmask,
+			  tun_mtu,
+			  ifconfig_broadcast
+			  );
       msg (M_INFO, "%s", command_line);
       system_check (command_line, es, S_FATAL, "NetBSD ifconfig failed");
       tt->did_ifconfig = true;