Subject: [patch]DragonFly support for net/openvpn
To: None <pkgsrc-users@netbsd.org>
From: Rumko <rumcic@gmail.com>
List: pkgsrc-users
Date: 07/21/2007 15:38:27
--nextPart1573371.cG1UTPjEbk
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8Bit

Attached are some files (openvpn.patch was made using patchdiff ... but it does
not contain patch-aa (how do you convince patchdiff to also include new
files?), other patches were made using mkpatches so that the ones in patches/
can just be replaced with these) for openvpn-2.1rc4.

Could someone please add DragonFly support (makes openvpn know how to use
ifconfig and route commands so there's no need for special scripts for stuff
that openvpn itself should know how to do) to openvpn?

--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="openvpn.patch"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="openvpn.patch"

Comparing patches/patch-ac to neki/patch-ac
26a27,35
> @@ -796,7 +802,7 @@ do_ifconfig (struct tuntap *tt,
>  	  add_route (&r, tt, 0, es);
>  	}
>  
> -#elif defined(TARGET_FREEBSD)
> +#elif defined(TARGET_FREEBSD) || defined(TARGET_DRAGONFLY)
>  
>        /* example: ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 netmask 255.255.255.255 up */
>        if (tun)
236a246,254
> @@ -1597,7 +1701,7 @@ read_tun (struct tuntap* tt, uint8_t *bu
>      return read (tt->fd, buf, len);
>  }
>  
> -#elif defined(TARGET_FREEBSD)
> +#elif defined(TARGET_FREEBSD) || defined(TARGET_DRAGONFLY)
>  
>  static inline int
>  freebsd_modify_read_write_return (int len)
Comparing patches/patch-ab to neki/patch-ab
3c3
< --- syshead.h.orig	2007-04-25 17:38:46.000000000 -0400
---
> --- syshead.h.orig	2007-04-25 23:38:46.000000000 +0200
5c5
< @@ -262,6 +262,10 @@
---
> @@ -260,8 +260,32 @@
6a7,28
>  #endif /* TARGET_FREEBSD */
>  
> +#ifdef TARGET_DRAGONFLY
> +
> +#ifdef HAVE_SYS_UIO_H
> +#include <sys/uio.h>
> +#endif
> +
> +#ifdef HAVE_NETINET_IN_SYSTM_H
> +#include <netinet/in_systm.h>
> +#endif
> +
> +#ifdef HAVE_NETINET_IP_H
> +#include <netinet/ip.h>
> +#endif
> +
> +#ifdef HAVE_NET_TUN_IF_TUN_H
> +#include <net/tun/if_tun.h>
> +#endif
> +
> +#endif /* TARGET_DRAGONFLY */
> +
Comparing patches/patch-ag to neki/patch-ag
3c3
< --- easy-rsa/2.0/pkitool.orig	2007-04-25 17:38:44.000000000 -0400
---
> --- easy-rsa/2.0/pkitool.orig	2007-04-25 23:38:44.000000000 +0200
Comparing patches/patch-ad to neki/patch-ad
3c3
< --- config.h.in.orig	2007-04-25 19:54:40.000000000 -0400
---
> --- config.h.in.orig	2007-04-26 01:54:40.000000000 +0200
5c5
< @@ -216,6 +216,9 @@
---
> @@ -216,9 +216,15 @@
14a15,30
> +/* Define to 1 if you have the <net/tun/if_tun.h> header file. */
> +#undef HAVE_NET_TUN_IF_TUN_H
> +
>  /* Define to 1 if you have the `nice' function. */
>  #undef HAVE_NICE
>  
> @@ -457,6 +463,9 @@
>  /* Are we running on FreeBSD? */
>  #undef TARGET_FREEBSD
>  
> +/* Are we running on DragonFly */
> +#undef TARGET_DRAGONFLY
> +
>  /* Are we running on Linux? */
>  #undef TARGET_LINUX
>  
Comparing patches/patch-af to neki/patch-af
3c3
< --- configure.orig	2007-04-25 19:54:40.000000000 -0400
---
> --- configure.orig	2007-04-26 01:54:40.000000000 +0200
5c5,19
< @@ -5528,7 +5528,7 @@ fi
---
> @@ -2828,6 +2828,13 @@ cat >>confdefs.h <<\_ACEOF
>  _ACEOF
>  
>  	;;
> +*dragonfly*)
> +
> +cat >>confdefs.h <<\_ACEOF
> +#define TARGET_DRAGONFLY 1
> +_ACEOF
> +
> +	;;
>  *netbsd*)
>  
>  cat >>confdefs.h <<\_ACEOF
> @@ -5528,7 +5535,7 @@ fi
10c24
< +for ac_header in sys/time.h sys/socket.h sys/ioctl.h sys/stat.h 		 sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h 		 stdarg.h unistd.h signal.h stdio.h string.h 		 strings.h ctype.h errno.h syslog.h pwd.h grp.h 		 net/if_tap.h net/if_tun.h stropts.h sys/sockio.h 		 netinet/in.h netinet/in_systm.h 		 netinet/tcp.h arpa/inet.h 		 netdb.h sys/uio.h linux/if_tun.h linux/sockios.h 		 linux/types.h sys/poll.h sys/epoll.h err.h
---
> +for ac_header in sys/time.h sys/socket.h sys/ioctl.h sys/stat.h 		 sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h 		 stdarg.h unistd.h signal.h stdio.h string.h 		 strings.h ctype.h errno.h syslog.h pwd.h grp.h 		 net/if_tap.h net/if_tun.h net/tun/if_tun.h stropts.h sys/sockio.h 		 netinet/in.h netinet/in_systm.h 		 netinet/tcp.h arpa/inet.h 		 netdb.h sys/uio.h linux/if_tun.h linux/sockios.h 		 linux/types.h sys/poll.h sys/epoll.h err.h
14c28
< @@ -5687,7 +5687,10 @@ _ACEOF
---
> @@ -5687,7 +5694,10 @@ _ACEOF
26c40
< @@ -5821,6 +5824,9 @@ cat >>conftest.$ac_ext <<_ACEOF
---
> @@ -5821,6 +5831,9 @@ cat >>conftest.$ac_ext <<_ACEOF
Comparing patches/patch-ae to neki/patch-ae
3c3
< --- configure.ac.orig	2007-04-25 17:38:46.000000000 -0400
---
> --- configure.ac.orig	2007-04-25 23:38:46.000000000 +0200
5c5,15
< @@ -285,14 +285,17 @@ AC_CHECK_HEADERS(sys/time.h sys/socket.h
---
> @@ -241,6 +241,9 @@ case "$target" in
>  *freebsd*)
>  	AC_DEFINE(TARGET_FREEBSD, 1, [Are we running on FreeBSD?])
>  	;;
> +*dragonfly*)
> +	AC_DEFINE(TARGET_DRAGONFLY, 1, [Are we running on DragonFly?])
> +	;;
>  *netbsd*)
>  	AC_DEFINE(TARGET_NETBSD, 1, [Are we running NetBSD?])
>  	;;
> @@ -285,14 +288,17 @@ AC_CHECK_HEADERS(sys/time.h sys/socket.h
10c20
< +		 net/if_tap.h net/if_tun.h stropts.h sys/sockio.h dnl
---
> +		 net/if_tap.h net/if_tun.h net/tun/if_tun.h stropts.h sys/sockio.h dnl
25c35
< @@ -314,6 +317,9 @@ AC_CHECK_HEADERS(netinet/if_ether.h,,,
---
> @@ -314,6 +320,9 @@ AC_CHECK_HEADERS(netinet/if_ether.h,,,
Only in new: neki/patch-aa (route.c)


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-aa"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-aa"

$NetBSD$

--- route.c.orig	2007-04-25 23:38:46.000000000 +0200
+++ route.c
@@ -870,6 +870,18 @@ add_route (struct route *r, const struct
   msg (D_ROUTE, "%s", BSTR (&buf));
   status = system_check (BSTR (&buf), es, 0, "ERROR: FreeBSD route add command failed");
 
+#elif defined(TARGET_DRAGONFLY)
+
+  buf_printf (&buf, ROUTE_PATH " add");
+  buf_printf (&buf, " -net %s %s %s",
+	      network,
+	      gateway,
+	      netmask);
+
+  msg (D_ROUTE, "%s", BSTR (&buf));
+  status = system_check (BSTR (&buf), es, 0, "ERROR: DragonFly route add command failed");
+
+
 #elif defined(TARGET_DARWIN)
 
   buf_printf (&buf, ROUTE_PATH " add");
@@ -1005,6 +1017,17 @@ delete_route (const struct route *r, con
   msg (D_ROUTE, "%s", BSTR (&buf));
   system_check (BSTR (&buf), es, 0, "ERROR: FreeBSD route delete command failed");
 
+#elif defined(TARGET_DRAGONFLY)
+
+  buf_printf (&buf, ROUTE_PATH " delete -net %s %s %s",
+	      network,
+	      gateway,
+	      netmask);
+
+  msg (D_ROUTE, "%s", BSTR (&buf));
+  system_check (BSTR (&buf), es, 0, "ERROR: DragonFly route delete command failed");
+
+
 #elif defined(TARGET_DARWIN)
 
   buf_printf (&buf, ROUTE_PATH " delete -net %s %s %s",
@@ -1460,7 +1483,7 @@ get_default_gateway (in_addr_t *gateway)
   return ret;
 }
 
-#elif defined(TARGET_FREEBSD)
+#elif defined(TARGET_FREEBSD) || defined(TARGET_DRAGONFLY)
 
 #include <sys/types.h>
 #include <sys/socket.h>


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-ab"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ab"

$NetBSD: patch-ab,v 1.5 2007/06/21 21:44:42 jlam Exp $

--- syshead.h.orig	2007-04-25 23:38:46.000000000 +0200
+++ syshead.h
@@ -260,8 +260,32 @@
 
 #endif /* TARGET_FREEBSD */
 
+#ifdef TARGET_DRAGONFLY
+
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+
+#ifdef HAVE_NET_TUN_IF_TUN_H
+#include <net/tun/if_tun.h>
+#endif
+
+#endif /* TARGET_DRAGONFLY */
+
 #ifdef TARGET_NETBSD
 
+#ifdef HAVE_NET_IF_TAP_H
+#include <net/if_tap.h>
+#endif
+
 #ifdef HAVE_NET_IF_TUN_H
 #include <net/if_tun.h>
 #endif


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-ac"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ac"

$NetBSD: patch-ac,v 1.5 2007/07/01 15:40:06 tnn Exp $

--- tun.c.orig	2007-04-25 23:38:46.000000000 +0200
+++ tun.c
@@ -68,6 +68,7 @@ static const char *netsh_get_id (const c
 
 #ifdef TARGET_SOLARIS
 static void solaris_error_close (struct tuntap *tt, const struct env_set *es, const char *actual);
+#include <stropts.h>
 #endif
 
 bool
@@ -659,7 +660,12 @@ do_ifconfig (struct tuntap *tt,
 			    );
 	}
       else
-	no_tap_ifconfig ();
+	openvpn_snprintf (command_line, sizeof (command_line),
+			  IFCONFIG_PATH " %s %s netmask %s broadcast + up",
+			  actual,
+			  ifconfig_local,
+			  ifconfig_remote_netmask
+			  );
 
       msg (M_INFO, "%s", command_line);
       if (!system_check (command_line, es, 0, "Solaris ifconfig phase-2 failed"))
@@ -796,7 +802,7 @@ do_ifconfig (struct tuntap *tt,
 	  add_route (&r, tt, 0, es);
 	}
 
-#elif defined(TARGET_FREEBSD)
+#elif defined(TARGET_FREEBSD) || defined(TARGET_DRAGONFLY)
 
       /* example: ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 netmask 255.255.255.255 up */
       if (tun)
@@ -945,7 +951,37 @@ open_tun_generic (const char *dev, const
 	  if (dynamic && !has_digit((unsigned char *)dev))
 	    {
 	      int i;
-	      for (i = 0; i < 256; ++i)
+#if defined(TAPGIFNAME)
+	      /*
+	       * Perhaps we have a cloning device.  Try opening
+	       * the device without any appended digits,
+	       * and use ioctl(,TAPGIFNAME,) to get the resulting
+	       * interface name.
+	       */
+	      openvpn_snprintf (tunname, sizeof (tunname), "/dev/%s", dev);
+	      if ((tt->fd = open (tunname, O_RDWR)) > 0)
+		{
+		  struct ifreq ifr;
+ 		  if (ioctl (tt->fd, TAPGIFNAME, (void*)&ifr) < 0)
+		    {
+		      msg (D_READ_WRITE | M_ERRNO,
+			   "ioctl(,TAPGIFNAME,) failed for %s", tunname);
+		      close(tt->fd);
+		    }
+		  else
+		    {
+		      strlcpy (dynamic_name, ifr.ifr_name,
+			       sizeof (dynamic_name));
+		      dynamic_opened = true;
+		      msg (M_INFO, "TUN/TAP dynamic interface %s opened",
+			   dynamic_name);
+		    }
+		}
+	      if (!dynamic_opened)
+ 		msg (D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)",
+		     tunname);
+#endif /* TAPGIFNAME */
+	      for (i = 0; i < 256 && !dynamic_opened; ++i)
 		{
 		  openvpn_snprintf (tunname, sizeof (tunname),
 				    "/dev/%s%d", dev, i);
@@ -1255,13 +1291,16 @@ read_tun (struct tuntap* tt, uint8_t *bu
 void
 open_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6, struct tuntap *tt)
 {
-  int if_fd, muxid, ppa = -1;
-  struct ifreq ifr;
+  int if_fd, ip_muxid, arp_muxid, arp_fd, ppa = -1;
+  struct lifreq ifr;
   const char *ptr;
-  const char *ip_node;
+  const char *ip_node, *arp_node;
   const char *dev_tuntap_type;
   int link_type;
   bool is_tun;
+  struct strioctl strioc_if, strioc_ppa;
+
+  memset(&ifr, 0x0, sizeof(ifr));
 
   ipv6_support (ipv6, false, tt);
 
@@ -1282,9 +1321,10 @@ open_tun (const char *dev, const char *d
     }
   else if (tt->type == DEV_TYPE_TAP)
     {
-      ip_node = "/dev/ip";
+      ip_node = "/dev/udp";
       if (!dev_node)
 	dev_node = "/dev/tap";
+      arp_node = dev_node;
       dev_tuntap_type = "tap";
       link_type = I_PLINK; /* was: I_LINK */
       is_tun = false;
@@ -1311,7 +1351,11 @@ open_tun (const char *dev, const char *d
     msg (M_ERR, "Can't open %s", dev_node);
 
   /* Assign a new PPA and get its unit number. */
-  if ((ppa = ioctl (tt->fd, TUNNEWPPA, ppa)) < 0)
+  strioc_ppa.ic_cmd = TUNNEWPPA;
+  strioc_ppa.ic_timout = 0;
+  strioc_ppa.ic_len = sizeof(ppa);
+  strioc_ppa.ic_dp = (char *)&ppa;
+  if ((ppa = ioctl (tt->fd, I_STR, &strioc_ppa)) < 0)
     msg (M_ERR, "Can't assign new interface");
 
   if ((if_fd = open (dev_node, O_RDWR, 0)) < 0)
@@ -1320,27 +1364,81 @@ open_tun (const char *dev, const char *d
   if (ioctl (if_fd, I_PUSH, "ip") < 0)
     msg (M_ERR, "Can't push IP module");
 
-  /* Assign ppa according to the unit number returned by tun device */
-  if (ioctl (if_fd, IF_UNITSEL, (char *) &ppa) < 0)
-    msg (M_ERR, "Can't set PPA %d", ppa);
-
-  if ((muxid = ioctl (tt->ip_fd, link_type, if_fd)) < 0)
-    msg (M_ERR, "Can't link %s device to IP", dev_tuntap_type);
-
-  close (if_fd);
+  if (tt->type == DEV_TYPE_TUN) 
+    {
+      /* Assign ppa according to the unit number returned by tun device */
+      if (ioctl (if_fd, IF_UNITSEL, (char *) &ppa) < 0)
+	msg (M_ERR, "Can't set PPA %d", ppa);
+    }
 
   tt->actual_name = (char *) malloc (32);
   check_malloc_return (tt->actual_name);
 
   openvpn_snprintf (tt->actual_name, 32, "%s%d", dev_tuntap_type, ppa);
 
-  CLEAR (ifr);
-  strncpynt (ifr.ifr_name, tt->actual_name, sizeof (ifr.ifr_name));
-  ifr.ifr_ip_muxid = muxid;
+  if (tt->type == DEV_TYPE_TAP) 
+    {
+      if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0)
+	msg (M_ERR, "Can't get flags\n");
+      strncpynt (ifr.lifr_name, tt->actual_name, sizeof (ifr.lifr_name));          
+      ifr.lifr_ppa = ppa;
+      /* Assign ppa according to the unit number returned by tun device */          
+      if (ioctl (if_fd, SIOCSLIFNAME, &ifr) < 0)
+	msg (M_ERR, "Can't set PPA %d", ppa);              
+      if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) <0)
+	msg (M_ERR, "Can't get flags\n");
+      /* Push arp module to if_fd */
+      if (ioctl (if_fd, I_PUSH, "arp") < 0)
+	msg (M_ERR, "Can't push ARP module");
+
+      /* Push arp module to ip_fd */
+      if (ioctl (tt->ip_fd, I_POP, NULL) < 0)
+	msg (M_ERR, "I_POP failed\n");  
+      if (ioctl (tt->ip_fd, I_PUSH, "arp") < 0) 
+	msg (M_ERR, "Can't push ARP module\n");
+
+      /* Open arp_fd */
+      if ((arp_fd = open (arp_node, O_RDWR, 0)) < 0)
+	msg (M_ERR, "Can't open %s\n", arp_node);
+      /* Push arp module to arp_fd */          
+      if (ioctl (arp_fd, I_PUSH, "arp") < 0)
+	msg (M_ERR, "Can't push ARP module\n");
+
+      /* Set ifname to arp */
+      strioc_if.ic_cmd = SIOCSLIFNAME;
+      strioc_if.ic_timout = 0;
+      strioc_if.ic_len = sizeof(ifr);
+      strioc_if.ic_dp = (char *)&ifr;
+      if (ioctl(arp_fd, I_STR, &strioc_if) < 0){
+	msg (M_ERR, "Can't set ifname to arp\n");
+      }
+    }
+  
+  if ((ip_muxid = ioctl (tt->ip_fd, link_type, if_fd)) < 0)
+    msg (M_ERR, "Can't link %s device to IP", dev_tuntap_type);
+
+  if (tt->type == DEV_TYPE_TAP) {
+    if ((arp_muxid = ioctl (tt->ip_fd, link_type, arp_fd)) < 0)
+      msg (M_ERR, "Can't link %s device to ARP", dev_tuntap_type);
+    close (arp_fd);
+  }
 
-  if (ioctl (tt->ip_fd, SIOCSIFMUXID, &ifr) < 0)
+  close (if_fd);
+
+  CLEAR (ifr);
+  strncpynt (ifr.lifr_name, tt->actual_name, sizeof (ifr.lifr_name));
+  ifr.lifr_ip_muxid  = ip_muxid;
+  if (tt->type == DEV_TYPE_TAP) {
+    ifr.lifr_arp_muxid = arp_muxid;
+  }
+  
+  if (ioctl (tt->ip_fd, SIOCSLIFMUXID, &ifr) < 0)
     {
-      ioctl (tt->ip_fd, I_PUNLINK, muxid);
+      if (tt->type == DEV_TYPE_TAP) 
+        {
+	  ioctl (tt->ip_fd, I_PUNLINK , arp_muxid);
+        }
+      ioctl (tt->ip_fd, I_PUNLINK, ip_muxid);
       msg (M_ERR, "Can't set multiplexor id");
     }
 
@@ -1358,18 +1456,24 @@ solaris_close_tun (struct tuntap *tt)
     {
       if (tt->ip_fd >= 0)
 	{
-	  struct ifreq ifr;
+	  struct lifreq ifr;
 	  CLEAR (ifr);
-	  strncpynt (ifr.ifr_name, tt->actual_name, sizeof (ifr.ifr_name));
+	  strncpynt (ifr.lifr_name, tt->actual_name, sizeof (ifr.lifr_name));
 
-	  if (ioctl (tt->ip_fd, SIOCGIFFLAGS, &ifr) < 0)
+	  if (ioctl (tt->ip_fd, SIOCGLIFFLAGS, &ifr) < 0)
 	    msg (M_WARN | M_ERRNO, "Can't get iface flags");
 
-	  if (ioctl (tt->ip_fd, SIOCGIFMUXID, &ifr) < 0)
+	  if (ioctl (tt->ip_fd, SIOCGLIFMUXID, &ifr) < 0)
 	    msg (M_WARN | M_ERRNO, "Can't get multiplexor id");
 
-	  if (ioctl (tt->ip_fd, I_PUNLINK, ifr.ifr_ip_muxid) < 0)
-	    msg (M_WARN | M_ERRNO, "Can't unlink interface");
+	  if (tt->type == DEV_TYPE_TAP)
+            {
+	      if (ioctl (tt->ip_fd, I_PUNLINK, ifr.lifr_arp_muxid) < 0)
+		msg (M_WARN | M_ERRNO, "Can't unlink interface(arp)");
+	    }
+
+	  if (ioctl (tt->ip_fd, I_PUNLINK, ifr.lifr_ip_muxid) < 0)
+	    msg (M_WARN | M_ERRNO, "Can't unlink interface(ip)");
 
 	  close (tt->ip_fd);
 	  tt->ip_fd = -1;
@@ -1597,7 +1701,7 @@ read_tun (struct tuntap* tt, uint8_t *bu
     return read (tt->fd, buf, len);
 }
 
-#elif defined(TARGET_FREEBSD)
+#elif defined(TARGET_FREEBSD) || defined(TARGET_DRAGONFLY)
 
 static inline int
 freebsd_modify_read_write_return (int len)


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-ad"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ad"

$NetBSD: patch-ad,v 1.2 2007/06/21 21:44:42 jlam Exp $

--- config.h.in.orig	2007-04-26 01:54:40.000000000 +0200
+++ config.h.in
@@ -216,9 +216,15 @@
 /* Define to 1 if you have the <net/if.h> header file. */
 #undef HAVE_NET_IF_H
 
+/* Define to 1 if you have the <net/if_tap.h> header file. */
+#undef HAVE_NET_IF_TAP_H
+
 /* Define to 1 if you have the <net/if_tun.h> header file. */
 #undef HAVE_NET_IF_TUN_H
 
+/* Define to 1 if you have the <net/tun/if_tun.h> header file. */
+#undef HAVE_NET_TUN_IF_TUN_H
+
 /* Define to 1 if you have the `nice' function. */
 #undef HAVE_NICE
 
@@ -457,6 +463,9 @@
 /* Are we running on FreeBSD? */
 #undef TARGET_FREEBSD
 
+/* Are we running on DragonFly */
+#undef TARGET_DRAGONFLY
+
 /* Are we running on Linux? */
 #undef TARGET_LINUX
 


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-ae"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ae"

$NetBSD: patch-ae,v 1.2 2007/06/21 21:44:42 jlam Exp $

--- configure.ac.orig	2007-04-25 23:38:46.000000000 +0200
+++ configure.ac
@@ -241,6 +241,9 @@ case "$target" in
 *freebsd*)
 	AC_DEFINE(TARGET_FREEBSD, 1, [Are we running on FreeBSD?])
 	;;
+*dragonfly*)
+	AC_DEFINE(TARGET_DRAGONFLY, 1, [Are we running on DragonFly?])
+	;;
 *netbsd*)
 	AC_DEFINE(TARGET_NETBSD, 1, [Are we running NetBSD?])
 	;;
@@ -285,14 +288,17 @@ AC_CHECK_HEADERS(sys/time.h sys/socket.h
 		 sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h dnl
 		 stdarg.h unistd.h signal.h stdio.h string.h dnl
 		 strings.h ctype.h errno.h syslog.h pwd.h grp.h dnl
-		 net/if_tun.h stropts.h sys/sockio.h dnl
+		 net/if_tap.h net/if_tun.h net/tun/if_tun.h stropts.h sys/sockio.h dnl
 		 netinet/in.h netinet/in_systm.h dnl
 		 netinet/tcp.h arpa/inet.h dnl
 		 netdb.h sys/uio.h linux/if_tun.h linux/sockios.h dnl
 		 linux/types.h sys/poll.h sys/epoll.h err.h dnl
 )
 AC_CHECK_HEADERS(net/if.h,,,
-		 [#ifdef HAVE_SYS_SOCKET_H 
+		 [#ifdef HAVE_SYS_TYPES_H 
+		  # include <sys/types.h>
+		  #endif
+		  #ifdef HAVE_SYS_SOCKET_H 
 		  # include <sys/socket.h>
 		  #endif
 		 ])
@@ -314,6 +320,9 @@ AC_CHECK_HEADERS(netinet/if_ether.h,,,
 		  #ifdef HAVE_SYS_SOCKET_H
 		  # include <sys/socket.h>
 		  #endif
+		  #ifdef HAVE_NET_IF_H
+		  # include <net/if.h>
+		  #endif
 		  #ifdef HAVE_NETINET_IN_H
 		  # include <netinet/in.h>
 		  #endif


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-af"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-af"

$NetBSD: patch-af,v 1.3 2007/06/21 21:44:42 jlam Exp $

--- configure.orig	2007-04-26 01:54:40.000000000 +0200
+++ configure
@@ -2828,6 +2828,13 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
 	;;
+*dragonfly*)
+
+cat >>confdefs.h <<\_ACEOF
+#define TARGET_DRAGONFLY 1
+_ACEOF
+
+	;;
 *netbsd*)
 
 cat >>confdefs.h <<\_ACEOF
@@ -5528,7 +5535,7 @@ fi
 
 
 
-for ac_header in sys/time.h sys/socket.h sys/ioctl.h sys/stat.h 		 sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h 		 stdarg.h unistd.h signal.h stdio.h string.h 		 strings.h ctype.h errno.h syslog.h pwd.h grp.h 		 net/if_tun.h stropts.h sys/sockio.h 		 netinet/in.h netinet/in_systm.h 		 netinet/tcp.h arpa/inet.h 		 netdb.h sys/uio.h linux/if_tun.h linux/sockios.h 		 linux/types.h sys/poll.h sys/epoll.h err.h
+for ac_header in sys/time.h sys/socket.h sys/ioctl.h sys/stat.h 		 sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h 		 stdarg.h unistd.h signal.h stdio.h string.h 		 strings.h ctype.h errno.h syslog.h pwd.h grp.h 		 net/if_tap.h net/if_tun.h net/tun/if_tun.h stropts.h sys/sockio.h 		 netinet/in.h netinet/in_systm.h 		 netinet/tcp.h arpa/inet.h 		 netdb.h sys/uio.h linux/if_tun.h linux/sockios.h 		 linux/types.h sys/poll.h sys/epoll.h err.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -5687,7 +5694,10 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#ifdef HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_TYPES_H
+		  # include <sys/types.h>
+		  #endif
+		  #ifdef HAVE_SYS_SOCKET_H
 		  # include <sys/socket.h>
 		  #endif
 
@@ -5821,6 +5831,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 		  #ifdef HAVE_SYS_SOCKET_H
 		  # include <sys/socket.h>
 		  #endif
+		  #ifdef HAVE_NET_IF_H
+		  # include <net/if.h>
+		  #endif
 		  #ifdef HAVE_NETINET_IN_H
 		  # include <netinet/in.h>
 		  #endif


--nextPart1573371.cG1UTPjEbk
Content-Type: text/x-diff; name="patch-ag"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ag"

$NetBSD: patch-ag,v 1.1 2007/06/21 21:44:42 jlam Exp $

--- easy-rsa/2.0/pkitool.orig	2007-04-25 23:38:44.000000000 +0200
+++ easy-rsa/2.0/pkitool
@@ -134,6 +134,9 @@ CA="ca"
 PKCS11_MODULE_PATH="dummy"
 PKCS11_PIN="dummy"
 
+[ -n "$GREP" ] || GREP=grep
+[ -n "$OPENSSL" ] || OPENSSL=openssl
+
 # Process options
 while [ $# -gt 0 ]; do
     case "$1" in


--nextPart1573371.cG1UTPjEbk--