[csw-devel] SF.net SVN: gar:[5892] csw/mgar/pkg/openvpn/trunk

bensons at users.sourceforge.net bensons at users.sourceforge.net
Thu Aug 6 18:11:11 CEST 2009


Revision: 5892
          http://gar.svn.sourceforge.net/gar/?rev=5892&view=rev
Author:   bensons
Date:     2009-08-06 16:11:06 +0000 (Thu, 06 Aug 2009)

Log Message:
-----------
openvpn: initial commit for GARv2

Modified Paths:
--------------
    csw/mgar/pkg/openvpn/trunk/Makefile
    csw/mgar/pkg/openvpn/trunk/checksums

Added Paths:
-----------
    csw/mgar/pkg/openvpn/trunk/files/cswopenvpn
    csw/mgar/pkg/openvpn/trunk/files/patch.openvpn-2.0.9.tun.c

Removed Paths:
-------------
    csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.gspec
    csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.prototype
    csw/mgar/pkg/openvpn/trunk/files/etc/

Modified: csw/mgar/pkg/openvpn/trunk/Makefile
===================================================================
--- csw/mgar/pkg/openvpn/trunk/Makefile	2009-08-06 15:48:31 UTC (rev 5891)
+++ csw/mgar/pkg/openvpn/trunk/Makefile	2009-08-06 16:11:06 UTC (rev 5892)
@@ -1,5 +1,5 @@
 GARNAME = openvpn
-GARVERSION = 2.0.7
+GARVERSION = 2.0.9
 CATEGORIES = server
 
 DESCRIPTION = secure IP tunnel daemon
@@ -7,21 +7,40 @@
 OpenVPN is a full-featured SSL VPN solution which can accomodate a wide range of configurations, including remote access, site-to-site VPNs, WiFi security, and enterprise-scale remote access solutions with load balancing, failover, and fine-grained access-controls
 endef
 
+# master files
 MASTER_SITES = http://openvpn.net/release/
 DISTFILES = $(GARNAME)-$(GARVERSION).tar.gz
-DISTFILES += $(call admfiles,CSWopenvpn, prototype )
 
+# we require
+REQUIRED_PKGS = CSWosslrt CSWlzo
+
 # We define upstream file regex so we can be notifed of new upstream software release
 UFILES_REGEX = $(GARNAME)-(\d+(?:\.\d+)*).tar.gz
 
 CONFIGURE_ARGS  = --prefix=$(prefix) --mandir=/opt/csw/share/man
+PATCHFILES = patch.openvpn-2.0.9.tun.c
 
-TEST_SCRIPTS =
+# use classes for install/removal
+PRESERVECONF = $(sysconfdir)/$(GARNAME)/$(GARNAME).conf.CSW
+INITSMF = /etc/opt/csw/init.d/cswopenvpn
 
+# no build tests
+SKIPTEST = 1
+
 include gar/category.mk
 
-post-install:
-	( cp -r $(WORKSRC)/../../../files/etc $(DESTDIR)/etc )
-	( mkdir -p $(DESTDIR)/etc/csw/easy-rsa )
-	( cp -r $(WORKSRC)/easy-rsa $(DESTDIR)/etc/csw/easy-rsa )
+post-install-modulated:
+	@echo "Installing sample files"
+	@ginstall -d -m 755 $(DESTDIR)$(docdir)/$(GARNAME)
+	@cp -pr $(WORKSRC)/easy-rsa $(DESTDIR)$(docdir)/$(GARNAME)
+	@cp -pr $(WORKSRC)/sample-scripts $(DESTDIR)$(docdir)/$(GARNAME)
+	@cp -pr $(WORKSRC)/sample-config-files $(DESTDIR)$(docdir)/$(GARNAME)
+	@echo "Installing $(GARNAME).conf.CSW"
+	@ginstall -d -m 755 $(DESTDIR)$(sysconfdir)/$(GARNAME)
+	@cp -pr $(WORKSRC)/sample-config-files/server.conf \
+		$(DESTDIR)$(sysconfdir)/$(GARNAME)/$(GARNAME).conf.CSW
+	@echo "Installing start/stop script"
+	@ginstall -d -m 755 $(DESTDIR)/etc/opt/csw/init.d
+	@ginstall -m 755 $(FILEDIR)/cswopenvpn  \
+		$(DESTDIR)/etc/opt/csw/init.d/cswopenvpn
 	@$(MAKECOOKIE)

Modified: csw/mgar/pkg/openvpn/trunk/checksums
===================================================================
--- csw/mgar/pkg/openvpn/trunk/checksums	2009-08-06 15:48:31 UTC (rev 5891)
+++ csw/mgar/pkg/openvpn/trunk/checksums	2009-08-06 16:11:06 UTC (rev 5892)
@@ -1,3 +1,2 @@
-93528233f1f6d02fc18e2c00f82e0aca  download/openvpn-2.0.7.tar.gz
-c3b9c93937349f371ca49b897d752ff0  download/CSWopenvpn.gspec
-735806001ebc39ad07dcb1d557bf36a3  download/CSWopenvpn.prototype
+60745008b90b7dbe25fe8337c550fec6  download/openvpn-2.0.9.tar.gz
+1c9565b3212299c029821f1753138972  download/patch.openvpn-2.0.9.tun.c

Deleted: csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.gspec
===================================================================
--- csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.gspec	2009-08-06 15:48:31 UTC (rev 5891)
+++ csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.gspec	2009-08-06 16:11:06 UTC (rev 5892)
@@ -1,4 +0,0 @@
-%var            bitname openvpn
-%var            pkgname CSWopenvpn
-%include        url file://%{PKGLIB}/csw_dyndepend.gspec
-%copyright      url file://%{WORKSRC}/COPYING

Deleted: csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.prototype
===================================================================
--- csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.prototype	2009-08-06 15:48:31 UTC (rev 5891)
+++ csw/mgar/pkg/openvpn/trunk/files/CSWopenvpn.prototype	2009-08-06 16:11:06 UTC (rev 5892)
@@ -1,51 +0,0 @@
-d none /opt/csw/sbin 0755 root bin
-f none /opt/csw/sbin/openvpn 0755 root bin
-d none /opt/csw/share 0755 root bin
-d none /opt/csw/share/man 0755 root bin
-d none /opt/csw/share/man/man8 0755 root bin
-f none /opt/csw/share/man/man8/openvpn.8 0644 root bin
-i copyright=CSWopenvpn.copyright
-i depend=CSWopenvpn.depend
-i pkginfo=CSWopenvpn.pkginfo
-d none /etc 0755 root bin
-d none /etc/init.d 0755 root bin
-f none /etc/init.d/cswopenvpn 0755 root bin
-s none /etc/rc0.d/K16cswopenvpn=../init.d/cswopenvpn
-s none /etc/rc1.d/K16cswopenvpn=../init.d/cswopenvpn
-s none /etc/rc2.d/S60cswopenvpn=../init.d/cswopenvpn
-s none /etc/rcS.d/K16cswopenvpn=../init.d/cswopenvpn
-d none /etc/csw 0755 root bin
-d none /etc/csw/openvpn 0700 root bin
-f none /etc/csw/openvpn/openvpn.conf.CSW 0644 root bin
-d none /etc/csw/openvpn/easy-rsa 0700 root bin
-f none /etc/csw/openvpn/easy-rsa/vars 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/list-crl 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/clean-all 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/openssl.cnf 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/sign-req 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/README 0644 root bin
-d none /etc/csw/openvpn/easy-rsa/Windows 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/clean-all.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/build-key-server.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/vars.bat.sample 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/build-key-pkcs12.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/README.txt 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/build-key.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/revoke-full.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/init-config.bat 0744 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/index.txt.start 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/build-ca.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/build-dh.bat 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/Windows/serial.start 0644 root bin
-f none /etc/csw/openvpn/easy-rsa/build-key-pkcs12 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-key-server 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-key-pass 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/revoke-full 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/make-crl 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-req-pass 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-key 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-req 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-ca 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-dh 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/build-inter 0755 root bin
-f none /etc/csw/openvpn/easy-rsa/revoke-crt 0755 root bin

Added: csw/mgar/pkg/openvpn/trunk/files/cswopenvpn
===================================================================
--- csw/mgar/pkg/openvpn/trunk/files/cswopenvpn	                        (rev 0)
+++ csw/mgar/pkg/openvpn/trunk/files/cswopenvpn	2009-08-06 16:11:06 UTC (rev 5892)
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Start/Stop script for CSW OpenVPN daemon
+#
+# Multiple openvpd daemon processes are possible, but this script will
+# only handle the first one.
+# AUTOENABLE no
+OPENVPN_CONF=/opt/csw/etc/openvpn/openvpn.conf
+PATH=/opt/csw/bin:$PATH
+OPENVPN_DAEMON=/opt/csw/sbin/openvpn
+
+case $1 in
+'start')
+        if [ -f $OPENVPN_CONF ]; then
+                printf "Starting OpenVPN daemon..."
+                $OPENVPN_DAEMON --config $OPENVPN_CONF --daemon
+                printf "DONE \n"
+        fi
+        ;;
+'stop')
+        pkill -TERM openvpn && printf "OpenVPN daemon stopped\n"
+        ;;
+*)
+        echo "Usage: $0 { start | stop }"
+        exit 1
+        ;;
+esac

Added: csw/mgar/pkg/openvpn/trunk/files/patch.openvpn-2.0.9.tun.c
===================================================================
--- csw/mgar/pkg/openvpn/trunk/files/patch.openvpn-2.0.9.tun.c	                        (rev 0)
+++ csw/mgar/pkg/openvpn/trunk/files/patch.openvpn-2.0.9.tun.c	2009-08-06 16:11:06 UTC (rev 5892)
@@ -0,0 +1,213 @@
+--- openvpn-2.0.9/tun.c	Wed Apr  5 15:29:24 2006
++++ 207/openvpn/tun.c	Wed May 20 23:10:36 2009
+@@ -30,6 +30,12 @@
+  * from VTun by Maxim Krasnyansky <max_mk at yahoo.com>.
+  */
+ 
++/*
++ *  Modified by: Kazuyoshi <admin2 at whiteboard.ne.jp>
++ *  Modified for supporting tap device for Solaris 
++ *  $Date: 2009/05/20 14:10:36 $, $Revision: 1.10.2.1 $
++ */
++
+ #ifdef WIN32
+ #include "config-win32.h"
+ #else
+@@ -49,6 +55,7 @@
+ 
+ #ifdef TARGET_SOLARIS
+ static void solaris_error_close (struct tuntap *tt, const struct env_set *es, const char *actual);
++#include <stropts.h>
+ #endif
+ 
+ bool
+@@ -629,7 +636,12 @@
+ 			    );
+ 	}
+       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"))
+@@ -1186,14 +1198,17 @@
+ 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);
+ 
+   if (tt->type == DEV_TYPE_NULL)
+@@ -1213,9 +1228,10 @@
+     }
+   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;
+@@ -1242,7 +1258,11 @@
+     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)
+@@ -1251,27 +1271,85 @@
+   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 (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);
++    }
+ 
+-  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);
+-
+   tt->actual_name = (char *) malloc (32);
+   check_malloc_return (tt->actual_name);
+ 
+   openvpn_snprintf (tt->actual_name, 32, "%s%d", dev_tuntap_type, ppa);
+ 
++  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");
++
++          /* Pop any modules on the stream */
++          while (true)
++            {
++                 if (ioctl (tt->ip_fd, I_POP, NULL) < 0)
++                     break;
++            }
++          /* Push arp module to ip_fd */
++	  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);
++  }
++
++  close (if_fd);
++
+   CLEAR (ifr);
+-  strncpynt (ifr.ifr_name, tt->actual_name, sizeof (ifr.ifr_name));
+-  ifr.ifr_ip_muxid = muxid;
++  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, SIOCSIFMUXID, &ifr) < 0)
++  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");
+     }
+ 
+@@ -1289,19 +1367,25 @@
+     {
+       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;
+ 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list