build revolution
Re: [Openvpn-devel] [PATCH 19/52] Remove tap-win32
In reply to Alon Bar-LevAs tap-win32 is being moved to a separate subproject, this makes sense.
ACK.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 6,707 lines
Introduce
tap-windows.hwhich is modifiedtap-win32/common.h. Except of function rename, it is the same without thetap_id. This file should be provided as part of tap-win32 MSI. For now we hold a copy.Signed-off-by Alon Bar-Lev <[email protected]...>--- Makefile.am | 3 +- configure.ac | 14 +- tap-win32/MAKEFILE | 6 - tap-win32/SOURCES.in | 64 - tap-win32/common.h | 82 -- tap-win32/constants.h | 52 - tap-win32/dhcp.c | 599 -------- tap-win32/dhcp.h | 164 --- tap-win32/endian.h | 35 - tap-win32/error.c | 378 ----- tap-win32/error.h | 88 -- tap-win32/hexdump.c | 69 - tap-win32/hexdump.h | 63 - tap-win32/i386/OemWin2k.inf.in | 195 --- tap-win32/instance.c | 241 --- tap-win32/lock.h | 75 - tap-win32/macinfo.c | 154 -- tap-win32/macinfo.h | 38 - tap-win32/mem.c | 186 --- tap-win32/proto.h | 224 --- tap-win32/prototypes.h | 260 ---- tap-win32/resource.rc | 58 - tap-win32/tapdrvr.c | 3146 ---------------------------------------- tap-win32/types.h | 178 --- tap-windows.h | 68 + tun.h | 2 +- win/autodefs.h.in | 2 +- 27 files changed, 78 insertions(+), 6366 deletions(-) delete mode 100755 tap-win32/MAKEFILE delete mode 100755 tap-win32/SOURCES.in delete mode 100755 tap-win32/common.h delete mode 100755 tap-win32/constants.h delete mode 100755 tap-win32/dhcp.c delete mode 100755 tap-win32/dhcp.h delete mode 100755 tap-win32/endian.h delete mode 100755 tap-win32/error.c delete mode 100755 tap-win32/error.h delete mode 100755 tap-win32/hexdump.c delete mode 100755 tap-win32/hexdump.h delete mode 100755 tap-win32/i386/OemWin2k.inf.in delete mode 100755 tap-win32/instance.c delete mode 100755 tap-win32/lock.h delete mode 100755 tap-win32/macinfo.c delete mode 100755 tap-win32/macinfo.h delete mode 100755 tap-win32/mem.c delete mode 100755 tap-win32/proto.h delete mode 100755 tap-win32/prototypes.h delete mode 100755 tap-win32/resource.rc delete mode 100755 tap-win32/tapdrvr.c delete mode 100755 tap-win32/types.h create mode 100644 tap-windows.hMakefile.am +1
-2@@ -44,7 +44,6 @@ EXTRA_DIST = \ sample-keys \ sample-scripts \ suse \ - tap-win32 \ contrib \ debug \ plugins \@@ -147,7 +146,7 @@ openvpn_SOURCES = \ ssl_verify_polarssl.c ssl_verify_polarssl.h \ status.c status.h \ syshead.h \ - tun.c tun.h \ + tun.c tun.h tap-windows.h \ win32.h win32.c \ cryptoapi.h cryptoapi.cconfigure.ac +7
-7@@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then ) fi -TAP_ID="PRODUCT_TAP_ID" +TAP_COMPONENT_ID="PRODUCT_TAP_ID" TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR" TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR" -AC_DEFINE_UNQUOTED(TAP_ID, "${TAP_ID}", [The TAP-Win32 id defined in tap-win32/SOURCES]) -AC_DEFINE_UNQUOTED(TAP_WIN32_MIN_MAJOR, ${TAP_WIN32_MIN_MAJOR}, [The TAP-Win32 version number is defined in tap-win32/SOURCES]) -AC_DEFINE_UNQUOTED(TAP_WIN32_MIN_MINOR, ${TAP_WIN32_MIN_MINOR}, [The TAP-Win32 version number is defined in tap-win32/SOURCES]) -AC_SUBST(TAP_ID) -AC_SUBST(TAP_WIN32_MIN_MAJOR) -AC_SUBST(TAP_WIN32_MIN_MINOR) +AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id]) +AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES]) +AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES]) +AC_SUBST([TAP_COMPONENT_ID]) +AC_SUBST([TAP_WIN32_MIN_MAJOR]) +AC_SUBST([TAP_WIN32_MIN_MINOR]) win32datadir="\${datadir}/${PACKAGE}-win32" AC_SUBST(win32datadir)tap-win32/MAKEFILE deleted +0
-6@@ -1,6 +0,0 @@ -# -# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source -# file to this component. This file merely indirects to the real make file -# that is shared by all the components of NT OS/2 -# -!INCLUDE $(NTMAKEENV)\makefile.deftap-win32/SOURCES.in deleted +0
-64@@ -1,64 +0,0 @@ -# Build TAP-Win32 driver. -# Build Command: build -cef - -MAJORCOMP=ntos -MINORCOMP=ndis - -TARGETNAME=@@PRODUCT_TAP_ID@@ -TARGETTYPE=DRIVER -TARGETPATH=. -TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib $(DDK_LIB_PATH)\ntstrsafe.lib -INCLUDES=$(DDK_INCLUDE_PATH) .. - -# The TAP version numbers here must be >= -# PRODUCT_TAP_WIN32_MIN_x values defined in version.m4 -C_DEFINES= -C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MAJOR_VERSION=@@PRODUCT_TAP_MAJOR_VER@@ -C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MINOR_VERSION=@@PRODUCT_TAP_MINOR_VER@@ - -# Produce the same symbolic information for both free & checked builds. -# This will allow us to perform full source-level debugging on both -# builds without affecting the free build's performance. -!IF "$(DDKBUILDENV)" != "chk" -NTDEBUGTYPE=both -USE_PDB=1 -!ELSE -NTDEBUGTYPE=both -USE_PDB=1 -!ENDIF - -# Set compiler optimizations: -# /Ox - Full optimization enabled -# /Os - favor speed over size when optimizing -# /Od - Disable all optimizations -# /Oi - Enable optimization for intrinsic functions -# /Fc - Generate mixed assembler/source code files -# -# For both checked and free builds, make sure that any intrinsic -# functions are compiled correctly. To do this, ensure that /Oi -# is selected for both free and checked builds. There is a bug in -# VC++ 6.0 (at least through SP4) where, if you specify any -# intrinsic functions in your code with "#pragma intrinsic" but -# you don't have the /Oi optimization enabled, neither a call -# to the function, nor the intrinsic inline version of the function -# will end up in your object code. This bug only applies to free -# builds, but just to be safe we'll make sure that the flag is -# enabled for all builds. - -!IF "$(DDKBUILDENV)" != "chk" -MSC_OPTIMIZATION=/Ox /Oi /Fc -!ELSE -MSC_OPTIMIZATION=/Od /Oi /Fc -!ENDIF - -# Generate a linker map file just in case we need one for debugging -LINKER_FLAGS=$(LINKER_FLAGS) /INCREMENTAL:NO /MAP /MAPINFO:EXPORTS - -# Generate a browser information file for use in IDE development -#BROWSER_INFO=1 -#BROWSERFILE=$(TARGETNAME).BSC -n - -# Abort compilation on warnings by adding /WX -MSC_WARNING_LEVEL=/W3 - -SOURCES=tapdrvr.c resource.rctap-win32/common.h deleted +0
-82@@ -1,82 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//=============================================== -// This file is included both by OpenVPN and -// the TAP-Win32 driver and contains definitions -// common to both. -//=============================================== - -#ifndef HAVE_CONFIG_H -#include "autodefs.h" -#endif - -//============= -// TAP IOCTLs -//============= - -#define TAP_CONTROL_CODE (request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -// Present in 8.1 - -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) - -// Added in 8.2 - -/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */ -#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED) - -//================= -// Registry keys -//================= - -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -//====================== -// Filesystem prefixes -//====================== - -#define USERMODEDEVICEDIR "\\\\.\\Global\\" -#define SYSDEVICEDIR "\\Device\\" -#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" - -//========================================================= -// TAP_COMPONENT_ID -- This string defines the TAP driver -// type -- different component IDs can reside in the system -// simultaneously. -//========================================================= - -#define TAP_COMPONENT_ID TAP_IDtap-win32/constants.h deleted +0
-52@@ -1,52 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//==================================================================== -// Product and Version public settings -//==================================================================== - -#define PRODUCT_STRING PRODUCT_TAP_DEVICE_DESCRIPTION - -#define TAP_NDIS_MAJOR_VERSION 5 -#define TAP_NDIS_MINOR_VERSION 0 - -//=========================================================== -// Driver constants -//=========================================================== - -#define ETHERNET_HEADER_SIZE (sizeof (ETH_HEADER)) -#define ETHERNET_MTU 1500 -#define ETHERNET_PACKET_SIZE (ETHERNET_MTU + ETHERNET_HEADER_SIZE) -#define DEFAULT_PACKET_LOOKAHEAD (ETHERNET_PACKET_SIZE) - -#define NIC_MAX_MCAST_LIST 32 // Max length of multicast address list - -#define MINIMUM_MTU 576 // USE TCP Minimum MTU -#define MAXIMUM_MTU 65536 // IP maximum MTU - -#define PACKET_QUEUE_SIZE 64 // tap -> userspace queue size -#define IRP_QUEUE_SIZE 16 // max number of simultaneous i/o operations from userspace -#define INJECT_QUEUE_SIZE 16 // DHCP/ARP -> tap injection queue - -#define TAP_LITTLE_ENDIAN // affects ntohs, htonl, etc. functions tap-win32/dhcp.c deleted +0
-599@@ -1,599 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//========================= -// Code to set DHCP options -//========================= - -VOID -SetDHCPOpt (DHCPMsg *m,void *data,unsigned int len) -{ -if (!m->overflow) - { -if (m->optlen + len <=DHCP_OPTIONS_BUFFER_SIZE ) - { -if (len) - { -NdisMoveMemory (m->msg.options + m->optlen, data, len); - m->optlen += len; - } - } -else - { - m->overflow = TRUE; - } - } -} - -VOID -SetDHCPOpt0 (DHCPMsg *msg,int type) -{ -DHCPOPT0 opt; - opt.type = (UCHAR ) type; -SetDHCPOpt (msg, &opt,sizeof (opt)); -} - -VOID -SetDHCPOpt8 (DHCPMsg *msg,int type,ULONG data) -{ -DHCPOPT8 opt; - opt.type = (UCHAR ) type; - opt.len =sizeof (opt.data); - opt.data = (UCHAR ) data; -SetDHCPOpt (msg, &opt,sizeof (opt)); -} - -VOID -SetDHCPOpt32 (DHCPMsg *msg,int type,ULONG data) -{ -DHCPOPT32 opt; - opt.type = (UCHAR ) type; - opt.len =sizeof (opt.data); - opt.data = data; -SetDHCPOpt (msg, &opt,sizeof (opt)); -} - -//============== -// Checksum code -//============== - -USHORT -ip_checksum (const UCHAR *buf,const int len_ip_header) -{ -USHORT word16; -ULONG sum =0 ; -int i; - -// make 16 bit words out of every two adjacent 8 bit words in the packet -// and add them up -for (i =0 ; i < len_ip_header -1 ; i +=2 ) { - word16 = ((buf[i] <<8 ) &0xFF00 ) + (buf[i+1 ] &0xFF ); - sum += (ULONG ) word16; - } - -// take only 16 bits out of the 32 bit sum and add up the carries -while (sum >>16 ) - sum = (sum &0xFFFF ) + (sum >>16 ); - -// one's complement the result -return ((USHORT ) ~sum); -} - -USHORT -udp_checksum (const UCHAR *buf, -const int len_udp, -const UCHAR *src_addr, -const UCHAR *dest_addr) -{ -USHORT word16; -ULONG sum =0 ; -int i; - -// make 16 bit words out of every two adjacent 8 bit words and -// calculate the sum of all 16 bit words -for (i =0 ; i < len_udp; i +=2 ){ - word16 = ((buf[i] <<8 ) &0xFF00 ) + ((i +1 < len_udp) ? (buf[i+1 ] &0xFF ) :0 ); - sum += word16; - } - -// add the UDP pseudo header which contains the IP source and destination addresses -for (i =0 ; i <4 ; i +=2 ){ - word16 =((src_addr[i] <<8 ) &0xFF00 ) + (src_addr[i+1 ] &0xFF ); - sum += word16; - } -for (i =0 ; i <4 ; i +=2 ){ - word16 =((dest_addr[i] <<8 ) &0xFF00 ) + (dest_addr[i+1 ] &0xFF ); - sum += word16; - } - -// the protocol number and the length of the UDP packet - sum += (USHORT )IPPROTO_UDP + (USHORT ) len_udp; - -// keep only the last 16 bits of the 32 bit calculated sum and add the carries -while (sum >>16 ) - sum = (sum &0xFFFF ) + (sum >>16 ); - -// Take the one's complement of sum -return ((USHORT ) ~sum); -} - -//================================ -// Set IP and UDP packet checksums -//================================ - -VOID -SetChecksumDHCPMsg (DHCPMsg *m) -{ -// Set IP checksum - m->msg.pre.ip.check =htons (ip_checksum ((UCHAR *) &m->msg.pre.ip,sizeof (IPHDR ))); - -// Set UDP Checksum - m->msg.pre.udp.check =htons (udp_checksum ((UCHAR *) &m->msg.pre.udp, -sizeof (UDPHDR ) +sizeof (DHCP ) + m->optlen, - (UCHAR *)&m->msg.pre.ip.saddr, - (UCHAR *)&m->msg.pre.ip.daddr)); -} - -//=================== -// DHCP message tests -//=================== - -int -GetDHCPMessageType (const DHCP *dhcp,const int optlen) -{ -const UCHAR *p = (UCHAR *) (dhcp +1 ); -int i; - -for (i =0 ; i < optlen; ++i) - { -const UCHAR type = p[i]; -const int room = optlen - i -1 ; -if (type ==DHCP_END )// didn't find what we were looking for -return -1 ; -else if (type ==DHCP_PAD )// no-operation - ; -else if (type ==DHCP_MSG_TYPE )// what we are looking for - { -if (room >=2 ) - { -if (p[i+1 ] ==1 )// message length should be 1 -return p[i+2 ];// return message type - } -return -1 ; - } -else // some other message - { -if (room >=1 ) - { -const int len = p[i+1 ];// get message length - i += (len +1 );// advance to next message - } - } - } -return -1 ; -} - -BOOLEAN -DHCPMessageOurs (const TapAdapterPointer p_Adapter, -const ETH_HEADER *eth, -const IPHDR *ip, -const UDPHDR *udp, -const DHCP *dhcp) -{ -// Must be UDPv4 protocol -if (!(eth->proto ==htons (ETH_P_IP ) && ip->protocol ==IPPROTO_UDP )) -return FALSE; - -// Source MAC must be our adapter -if (!MAC_EQUAL (eth->src, p_Adapter->m_MAC)) -return FALSE; - -// Dest MAC must be either broadcast or our virtual DHCP server -if (!(MAC_EQUAL (eth->dest, p_Adapter->m_MAC_Broadcast) - ||MAC_EQUAL (eth->dest, p_Adapter->m_dhcp_server_mac))) -return FALSE; - -// Port numbers must be correct -if (!(udp->dest ==htons (BOOTPS_PORT ) - && udp->source ==htons (BOOTPC_PORT ))) -return FALSE; - -// Hardware address must be MAC addr sized -if (!(dhcp->hlen ==sizeof (MACADDR ))) -return FALSE; - -// Hardware address must match our adapter -if (!MAC_EQUAL (eth->src, dhcp->chaddr)) -return FALSE; - -return TRUE; -} - - -//===================================================== -// Build all of DHCP packet except for DHCP options. -// Assume that *p has been zeroed before we are called. -//===================================================== - -VOID -BuildDHCPPre (const TapAdapterPointer a, -DHCPPre *p, -const ETH_HEADER *eth, -const IPHDR *ip, -const UDPHDR *udp, -const DHCP *dhcp, -const int optlen, -const int type) -{ -// Should we broadcast or direct to a specific MAC / IP address? -const BOOLEAN broadcast = (type ==DHCPNAK - ||MAC_EQUAL (eth->dest, a->m_MAC_Broadcast)); -// Build ethernet header - -COPY_MAC (p->eth.src, a->m_dhcp_server_mac); - -if (broadcast) -COPY_MAC (p->eth.dest, a->m_MAC_Broadcast); -else -COPY_MAC (p->eth.dest, eth->src); - - p->eth.proto =htons (ETH_P_IP ); - -// Build IP header - - p->ip.version_len = (4 <<4 ) | (sizeof (IPHDR ) >>2 ); - p->ip.tos =0 ; - p->ip.tot_len =htons (sizeof (IPHDR ) +sizeof (UDPHDR ) +sizeof (DHCP ) + optlen); - p->ip.id =0 ; - p->ip.frag_off =0 ; - p->ip.ttl =16 ; - p->ip.protocol =IPPROTO_UDP ; - p->ip.check =0 ; - p->ip.saddr = a->m_dhcp_server_ip; - -if (broadcast) - p->ip.daddr = ~0 ; -else - p->ip.daddr = a->m_dhcp_addr; - -// Build UDP header - - p->udp.source =htons (BOOTPS_PORT ); - p->udp.dest =htons (BOOTPC_PORT ); - p->udp.len =htons (sizeof (UDPHDR ) +sizeof (DHCP ) + optlen); - p->udp.check =0 ; - -// Build DHCP response - - p->dhcp.op =BOOTREPLY ; - p->dhcp.htype =1 ; - p->dhcp.hlen =sizeof (MACADDR ); - p->dhcp.hops =0 ; - p->dhcp.xid = dhcp->xid; - p->dhcp.secs =0 ; - p->dhcp.flags =0 ; - p->dhcp.ciaddr =0 ; - -if (type ==DHCPNAK ) - p->dhcp.yiaddr =0 ; -else - p->dhcp.yiaddr = a->m_dhcp_addr; - - p->dhcp.siaddr = a->m_dhcp_server_ip; - p->dhcp.giaddr =0 ; -COPY_MAC (p->dhcp.chaddr, eth->src); - p->dhcp.magic =htonl (0x63825363 ); -} -//============================= -// Build specific DHCP messages -//============================= - -VOID -SendDHCPMsg (const TapAdapterPointer a, -const int type, -const ETH_HEADER *eth, -const IPHDR *ip, -const UDPHDR *udp, -const DHCP *dhcp) -{ -DHCPMsg *pkt; - -if (!(type ==DHCPOFFER || type ==DHCPACK || type ==DHCPNAK )) - { -DEBUGP (("[TAP] SendDHCPMsg: Bad DHCP type: %d\n" , type)); -return ; - } - - pkt = (DHCPMsg *)MemAlloc (sizeof (DHCPMsg), TRUE); - -if (pkt) - { -//----------------------- -// Build DHCP options -//----------------------- - -// Message Type -SetDHCPOpt8 (pkt,DHCP_MSG_TYPE , type); - -// Server ID -SetDHCPOpt32 (pkt,DHCP_SERVER_ID , a->m_dhcp_server_ip); - -if (type ==DHCPOFFER || type ==DHCPACK ) - { -// Lease Time -SetDHCPOpt32 (pkt,DHCP_LEASE_TIME ,htonl (a->m_dhcp_lease_time)); - -// Netmask -SetDHCPOpt32 (pkt,DHCP_NETMASK , a->m_dhcp_netmask); - -// Other user-defined options -SetDHCPOpt (pkt, - a->m_dhcp_user_supplied_options_buffer, - a->m_dhcp_user_supplied_options_buffer_len); - } - -// End -SetDHCPOpt0 (pkt,DHCP_END ); - -if (!DHCPMSG_OVERFLOW (pkt)) - { -// The initial part of the DHCP message (not including options) gets built here -BuildDHCPPre (a, - &pkt->msg.pre, - eth, - ip, - udp, - dhcp, -DHCPMSG_LEN_OPT (pkt), - type); - -SetChecksumDHCPMsg (pkt); - -DUMP_PACKET ("DHCPMsg" , -DHCPMSG_BUF (pkt), -DHCPMSG_LEN_FULL (pkt)); - -// Return DHCP response to kernel -InjectPacketDeferred (a, -DHCPMSG_BUF (pkt), -DHCPMSG_LEN_FULL (pkt)); - } -else - { -DEBUGP (("[TAP] SendDHCPMsg: DHCP buffer overflow\n" )); - } - -MemFree (pkt,sizeof (DHCPMsg)); - } -} - -//=================================================================== -// Handle a BOOTPS packet produced by the local system to -// resolve the address/netmask of this adapter. -// If we are in TAP_IOCTL_CONFIG_DHCP_MASQ mode, reply -// to the message. Return TRUE if we processed the passed -// message, so that downstream stages can ignore it. -//=================================================================== - -BOOLEAN -ProcessDHCP (TapAdapterPointer p_Adapter, -const ETH_HEADER *eth, -const IPHDR *ip, -const UDPHDR *udp, -const DHCP *dhcp, -int optlen) -{ -int msg_type; - -// Sanity check IP header -if (!(ntohs (ip->tot_len) ==sizeof (IPHDR ) +sizeof (UDPHDR ) +sizeof (DHCP ) + optlen - && (ntohs (ip->frag_off) &IP_OFFMASK ) ==0 )) -return TRUE; - -// Does this message belong to us? -if (!DHCPMessageOurs (p_Adapter, eth, ip, udp, dhcp)) -return FALSE; - - msg_type =GetDHCPMessageType (dhcp, optlen); - -// Drop non-BOOTREQUEST messages -if (dhcp->op !=BOOTREQUEST ) -return TRUE; - -// Drop any messages except DHCPDISCOVER or DHCPREQUEST -if (!(msg_type ==DHCPDISCOVER || msg_type ==DHCPREQUEST )) -return TRUE; - -// Should we reply with DHCPOFFER, DHCPACK, or DHCPNAK? -if (msg_type ==DHCPREQUEST - && ((dhcp->ciaddr && dhcp->ciaddr != p_Adapter->m_dhcp_addr) - || !p_Adapter->m_dhcp_received_discover - || p_Adapter->m_dhcp_bad_requests >=BAD_DHCPREQUEST_NAK_THRESHOLD )) -SendDHCPMsg (p_Adapter, -DHCPNAK , - eth, ip, udp, dhcp); -else -SendDHCPMsg (p_Adapter, - (msg_type ==DHCPDISCOVER ?DHCPOFFER :DHCPACK ), - eth, ip, udp, dhcp); - -// Remember if we received a DHCPDISCOVER -if (msg_type ==DHCPDISCOVER ) - p_Adapter->m_dhcp_received_discover = TRUE; - -// Is this a bad DHCPREQUEST? -if (msg_type ==DHCPREQUEST && dhcp->ciaddr != p_Adapter->m_dhcp_addr) - ++p_Adapter->m_dhcp_bad_requests; - -return TRUE; -} - -#if DBG - -const char * -message_op_text (int op) -{ -switch (op) - { -case BOOTREQUEST : -return "BOOTREQUEST" ; -case BOOTREPLY : -return "BOOTREPLY" ; -default : -return "???" ; - } -} - -const char * -message_type_text (int type) -{ -switch (type) - { -case DHCPDISCOVER : -return "DHCPDISCOVER" ; -case DHCPOFFER : -return "DHCPOFFER" ; -case DHCPREQUEST : -return "DHCPREQUEST" ; -case DHCPDECLINE : -return "DHCPDECLINE" ; -case DHCPACK : -return "DHCPACK" ; -case DHCPNAK : -return "DHCPNAK" ; -case DHCPRELEASE : -return "DHCPRELEASE" ; -case DHCPINFORM : -return "DHCPINFORM" ; -default : -return "???" ; - } -} - -const char * -port_name (int port) -{ -switch (port) - { -case BOOTPS_PORT : -return "BOOTPS" ; -case BOOTPC_PORT : -return "BOOTPC" ; -default : -return "unknown" ; - } -} - -VOID -DumpDHCP (const ETH_HEADER *eth, -const IPHDR *ip, -const UDPHDR *udp, -const DHCP *dhcp, -const int optlen) -{ -DEBUGP ((" %s" ,message_op_text (dhcp->op))); -DEBUGP ((" %s " ,message_type_text (GetDHCPMessageType (dhcp, optlen)))); -PrIP (ip->saddr); -DEBUGP ((":%s[" ,port_name (ntohs (udp->source)))); -PrMac (eth->src); -DEBUGP (("] -> " )); -PrIP (ip->daddr); -DEBUGP ((":%s[" ,port_name (ntohs (udp->dest)))); -PrMac (eth->dest); -DEBUGP (("]" )); -if (dhcp->ciaddr) - { -DEBUGP ((" ci=" )); -PrIP (dhcp->ciaddr); - } -if (dhcp->yiaddr) - { -DEBUGP ((" yi=" )); -PrIP (dhcp->yiaddr); - } -if (dhcp->siaddr) - { -DEBUGP ((" si=" )); -PrIP (dhcp->siaddr); - } -if (dhcp->hlen ==sizeof (MACADDR )) - { -DEBUGP ((" ch=" )); -PrMac (dhcp->chaddr); - } - -DEBUGP ((" xid=0x%08x" ,ntohl (dhcp->xid))); - -if (ntohl (dhcp->magic) !=0x63825363 ) -DEBUGP ((" ma=0x%08x" ,ntohl (dhcp->magic))); -if (dhcp->htype !=1 ) -DEBUGP ((" htype=%d" , dhcp->htype)); -if (dhcp->hops) -DEBUGP ((" hops=%d" , dhcp->hops)); -if (ntohs (dhcp->secs)) -DEBUGP ((" secs=%d" ,ntohs (dhcp->secs))); -if (ntohs (dhcp->flags)) -DEBUGP ((" flags=0x%04x" ,ntohs (dhcp->flags))); - -// extra stuff - -if (ip->version_len !=0x45 ) -DEBUGP ((" vl=0x%02x" , ip->version_len)); -if (ntohs (ip->tot_len) !=sizeof (IPHDR ) +sizeof (UDPHDR ) +sizeof (DHCP ) + optlen) -DEBUGP ((" tl=%d" ,ntohs (ip->tot_len))); -if (ntohs (udp->len) !=sizeof (UDPHDR ) +sizeof (DHCP ) + optlen) -DEBUGP ((" ul=%d" ,ntohs (udp->len))); - -if (ip->tos) -DEBUGP ((" tos=0x%02x" , ip->tos)); -if (ntohs (ip->id)) -DEBUGP ((" id=0x%04x" ,ntohs (ip->id))); -if (ntohs (ip->frag_off)) -DEBUGP ((" frag_off=0x%04x" ,ntohs (ip->frag_off))); - -DEBUGP ((" ttl=%d" , ip->ttl)); -DEBUGP ((" ic=0x%04x [0x%04x]" ,ntohs (ip->check), -ip_checksum ((UCHAR *)ip,sizeof (IPHDR )))); -DEBUGP ((" uc=0x%04x [0x%04x/%d]" ,ntohs (udp->check), -udp_checksum ((UCHAR *) udp, -sizeof (UDPHDR ) +sizeof (DHCP ) + optlen, - (UCHAR *) &ip->saddr, - (UCHAR *) &ip->daddr), - optlen)); - -// Options - { -const UCHAR *opt = (UCHAR *) (dhcp +1 ); -int i; - -DEBUGP ((" OPT" )); -for (i =0 ; i < optlen; ++i) - { -const UCHAR data = opt[i]; -DEBUGP ((".%d" , data)); - } - } -} - -#endif /* DBG */ tap-win32/dhcp.h deleted +0
-164@@ -1,164 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#pragma pack(1) - -//=================================================== -// How many bad DHCPREQUESTs do we receive before we -// return a NAK? -// -// A bad DHCPREQUEST is defined to be one where the -// requestor doesn't know its IP address. -//=================================================== - -#define BAD_DHCPREQUEST_NAK_THRESHOLD 3 - -//============================================== -// Maximum number of DHCP options bytes supplied -//============================================== - -#define DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE 256 -#define DHCP_OPTIONS_BUFFER_SIZE 256 - -//=================================== -// UDP port numbers of DHCP messages. -//=================================== - -#define BOOTPS_PORT 67 -#define BOOTPC_PORT 68 - -//=========================== -// The DHCP message structure -//=========================== - -typedef struct { -# define BOOTREQUEST 1 -# define BOOTREPLY 2 -UCHAR op;/* message op */ - -UCHAR htype;/* hardware address type (e.g. '1' = 10Mb Ethernet) */ -UCHAR hlen;/* hardware address length (e.g. '6' for 10Mb Ethernet) */ -UCHAR hops;/* client sets to 0, may be used by relay agents */ -ULONG xid;/* transaction ID, chosen by client */ -USHORT secs;/* seconds since request process began, set by client */ -USHORT flags; -ULONG ciaddr;/* client IP address, client sets if known */ -ULONG yiaddr;/* 'your' IP address -- server's response to client */ -ULONG siaddr;/* server IP address */ -ULONG giaddr;/* relay agent IP address */ -UCHAR chaddr[16 ];/* client hardware address */ -UCHAR sname[64 ];/* optional server host name */ -UCHAR file[128 ];/* boot file name */ -ULONG magic;/* must be 0x63825363 (network order) */ -}DHCP ; - -typedef struct { -ETH_HEADER eth; -IPHDR ip; -UDPHDR udp; -DHCP dhcp; -}DHCPPre ; - -typedef struct { -DHCPPre pre; -UCHAR options[DHCP_OPTIONS_BUFFER_SIZE ]; -}DHCPFull ; - -typedef struct { -unsigned int optlen; -BOOLEAN overflow; -DHCPFull msg; -}DHCPMsg ; - -//=================== -// Macros for DHCPMSG -//=================== - -#define DHCPMSG_LEN_BASE (p) (sizeof (DHCPPre)) -#define DHCPMSG_LEN_OPT (p) ((p)->optlen) -#define DHCPMSG_LEN_FULL (p) (DHCPMSG_LEN_BASE(p) + DHCPMSG_LEN_OPT(p)) -#define DHCPMSG_BUF (p) ((UCHAR*) &(p)->msg) -#define DHCPMSG_OVERFLOW (p) ((p)->overflow) - -//======================================== -// structs to hold individual DHCP options -//======================================== - -typedef struct { -UCHAR type; -}DHCPOPT0 ; - -typedef struct { -UCHAR type; -UCHAR len; -UCHAR data; -}DHCPOPT8 ; - -typedef struct { -UCHAR type; -UCHAR len; -ULONG data; -}DHCPOPT32 ; - -#pragma pack() - -//================== -// DHCP Option types -//================== - -#define DHCP_MSG_TYPE 53/* message type (u8) */ -#define DHCP_PARM_REQ 55/* parameter request list: c1 (u8), ... */ -#define DHCP_CLIENT_ID 61/* client ID: type (u8), i1 (u8), ... */ -#define DHCP_IP 50/* requested IP addr (u32) */ -#define DHCP_NETMASK 1/* subnet mask (u32) */ -#define DHCP_LEASE_TIME 51/* lease time sec (u32) */ -#define DHCP_RENEW_TIME 58/* renewal time sec (u32) */ -#define DHCP_REBIND_TIME 59/* rebind time sec (u32) */ -#define DHCP_SERVER_ID 54/* server ID: IP addr (u32) */ -#define DHCP_PAD 0 -#define DHCP_END 255 - -//==================== -// DHCP Messages types -//==================== - -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPDECLINE 4 -#define DHCPACK 5 -#define DHCPNAK 6 -#define DHCPRELEASE 7 -#define DHCPINFORM 8 - -#if DBG - -VOID -DumpDHCP (const ETH_HEADER *eth, -const IPHDR *ip, -const UDPHDR *udp, -const DHCP *dhcp, -const int optlen); - -#endif tap-win32/endian.h deleted +0
-35@@ -1,35 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifdef TAP_LITTLE_ENDIAN -#define ntohs (x) RtlUshortByteSwap(x) -#define htons (x) RtlUshortByteSwap(x) -#define ntohl (x) RtlUlongByteSwap(x) -#define htonl (x) RtlUlongByteSwap(x) -#else -#define ntohs (x) ((USHORT)(x)) -#define htons (x) ((USHORT)(x)) -#define ntohl (x) ((ULONG)(x)) -#define htonl (x) ((ULONG)(x)) -#endif tap-win32/error.c deleted +0
-378@@ -1,378 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//----------------- -// DEBUGGING OUTPUT -//----------------- - -const char *g_LastErrorFilename; -int g_LastErrorLineNumber; - -#if DBG - -DebugOutput g_Debug; - -BOOLEAN -NewlineExists (const char *str,int len) -{ -while (len-- >0 ) - { -const char c = *str++; -if (c =='\n' ) -return TRUE; -else if (c =='\0' ) -break ; - } -return FALSE; -} - -VOID -MyDebugInit (unsigned int bufsiz) -{ -NdisZeroMemory (&g_Debug,sizeof (g_Debug)); - g_Debug.text = (char *)MemAlloc (bufsiz, FALSE); -if (g_Debug.text) - g_Debug.capacity = bufsiz; -} - -VOID -MyDebugFree () -{ -if (g_Debug.text) -MemFree (g_Debug.text, g_Debug.capacity); -NdisZeroMemory (&g_Debug,sizeof (g_Debug)); -} - -VOID -MyDebugPrint (const unsigned char * format, ...) -{ -if (g_Debug.text && g_Debug.capacity >0 &&CAN_WE_PRINT ) - { -BOOLEAN owned; -ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned); -if (owned) - { -const int remaining = (int )g_Debug.capacity - (int )g_Debug.out; - -if (remaining >0 ) - { -va_list args; -NTSTATUS status; -char *end; - -va_start (args, format); - status =RtlStringCchVPrintfExA (g_Debug.text + g_Debug.out, - remaining, - &end, -NULL , -STRSAFE_NO_TRUNCATION |STRSAFE_IGNORE_NULLS , - format, - args); -va_end (args); - -if (status ==STATUS_SUCCESS ) - g_Debug.out = (unsigned int ) (end - g_Debug.text); -else - g_Debug.error = TRUE; - } -else - g_Debug.error = TRUE; - -RELEASE_MUTEX (&g_Debug.lock); - } -else - g_Debug.error = TRUE; - } -} - -BOOLEAN -GetDebugLine (char *buf,const int len) -{ -static const char *truncated ="[OUTPUT TRUNCATED]\n" ; -BOOLEAN ret = FALSE; - -NdisZeroMemory (buf, len); - -if (g_Debug.text && g_Debug.capacity >0 ) - { -BOOLEAN owned; -ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned); -if (owned) - { -int i =0 ; - -if (g_Debug.error ||NewlineExists (g_Debug.text + g_Debug.in, (int )g_Debug.out - (int )g_Debug.in)) - { -while (i < (len -1 ) && g_Debug.in < g_Debug.out) - { -const char c = g_Debug.text[g_Debug.in++]; -if (c =='\n' ) -break ; - buf[i++] = c; - } -if (i < len) - buf[i] ='\0' ; - } - -if (!i) - { -if (g_Debug.in == g_Debug.out) - { - g_Debug.in = g_Debug.out =0 ; -if (g_Debug.error) - { -const unsigned int tlen =strlen (truncated); -if (tlen < g_Debug.capacity) - { -NdisMoveMemory (g_Debug.text, truncated, tlen+1 ); - g_Debug.out = tlen; - } - g_Debug.error = FALSE; - } - } - } -else - ret = TRUE; - -RELEASE_MUTEX (&g_Debug.lock); - } - } -return ret; -} - -VOID -MyAssert (const unsigned char *file,int line) -{ -DEBUGP (("MYASSERT failed %s/%d\n" , file, line)); -KeBugCheckEx (0x0F00BABA , - (ULONG_PTR ) line, - (ULONG_PTR )0 , - (ULONG_PTR )0 , - (ULONG_PTR )0 ); -} - -VOID -PrMac (const MACADDR mac) -{ -DEBUGP (("%x:%x:%x:%x:%x:%x" , - mac[0 ], mac[1 ], mac[2 ], - mac[3 ], mac[4 ], mac[5 ])); -} - -VOID -PrIP (IPADDR ip_addr) -{ -const unsigned char *ip = (const unsigned char *) &ip_addr; - -DEBUGP (("%d.%d.%d.%d" , - ip[0 ], ip[1 ], ip[2 ], ip[3 ])); -} - -const char * -PrIPProto (int proto) -{ -switch (proto) - { -case IPPROTO_UDP : -return "UDP" ; -case IPPROTO_TCP : -return "TCP" ; -case IPPROTO_ICMP : -return "ICMP" ; -case IPPROTO_IGMP : -return "IGMP" ; -default : -return "???" ; - } -} - -VOID -DumpARP (const char *prefix,const ARP_PACKET *arp) -{ -DEBUGP (("%s ARP src=" , prefix)); -PrMac (arp->m_MAC_Source); -DEBUGP ((" dest=" )); -PrMac (arp->m_MAC_Destination); -DEBUGP ((" OP=0x%04x" , - (int )ntohs (arp->m_ARP_Operation))); -DEBUGP ((" M=0x%04x(%d)" , - (int )ntohs (arp->m_MAC_AddressType), - (int )arp->m_MAC_AddressSize)); -DEBUGP ((" P=0x%04x(%d)" , - (int )ntohs (arp->m_PROTO_AddressType), - (int )arp->m_PROTO_AddressSize)); - -DEBUGP ((" MacSrc=" )); -PrMac (arp->m_ARP_MAC_Source); -DEBUGP ((" MacDest=" )); -PrMac (arp->m_ARP_MAC_Destination); - -DEBUGP ((" IPSrc=" )); -PrIP (arp->m_ARP_IP_Source); -DEBUGP ((" IPDest=" )); -PrIP (arp->m_ARP_IP_Destination); - -DEBUGP (("\n" )); -} - -struct ethpayload { -ETH_HEADER eth; -UCHAR payload[DEFAULT_PACKET_LOOKAHEAD ]; -}; - -VOID -DumpPacket2 (const char *prefix, -const ETH_HEADER *eth, -const unsigned char *data, -unsigned int len) -{ -struct ethpayload *ep = (struct ethpayload *)MemAlloc (sizeof (struct ethpayload ), TRUE); -if (ep) - { -if (len >DEFAULT_PACKET_LOOKAHEAD ) - len =DEFAULT_PACKET_LOOKAHEAD ; - ep->eth = *eth; -NdisMoveMemory (ep->payload, data, len); -DumpPacket (prefix, (unsigned char *) ep,sizeof (ETH_HEADER ) + len); -MemFree (ep,sizeof (struct ethpayload )); - } -} - -VOID -DumpPacket (const char *prefix, -const unsigned char *data, -unsigned int len) -{ -const ETH_HEADER *eth = (const ETH_HEADER *) data; -const IPHDR *ip = (const IPHDR *) (data +sizeof (ETH_HEADER )); - -if (len <sizeof (ETH_HEADER )) - { -DEBUGP (("%s TRUNCATED PACKET LEN=%d\n" , prefix, len)); -return ; - } - -// ARP Packet? -if (len >=sizeof (ARP_PACKET ) && eth->proto ==htons (ETH_P_ARP )) - { -DumpARP (prefix, (const ARP_PACKET *) data); -return ; - } - -// IPv4 packet? -if (len >= (sizeof (IPHDR ) +sizeof (ETH_HEADER )) - && eth->proto ==htons (ETH_P_IP ) - &&IPH_GET_VER (ip->version_len) ==4 ) - { -const int hlen =IPH_GET_LEN (ip->version_len); -const int blen = len -sizeof (ETH_HEADER ); -BOOLEAN did = FALSE; - -DEBUGP (("%s IPv4 %s[%d]" , prefix,PrIPProto (ip->protocol), len)); - -if (!(ntohs (ip->tot_len) == blen && hlen <= blen)) - { -DEBUGP ((" XXX" )); -return ; - } - -// TCP packet? -if (ip->protocol ==IPPROTO_TCP - && blen - hlen >= (sizeof (TCPHDR ))) - { -const TCPHDR *tcp = (TCPHDR *) (data +sizeof (ETH_HEADER ) + hlen); -DEBUGP ((" " )); -PrIP (ip->saddr); -DEBUGP ((":%d" ,ntohs (tcp->source))); -DEBUGP ((" -> " )); -PrIP (ip->daddr); -DEBUGP ((":%d" ,ntohs (tcp->dest))); - did = TRUE; - } - -// UDP packet? -else if ((ntohs (ip->frag_off) &IP_OFFMASK ) ==0 - && ip->protocol ==IPPROTO_UDP - && blen - hlen >= (sizeof (UDPHDR ))) - { -const UDPHDR *udp = (UDPHDR *) (data +sizeof (ETH_HEADER ) + hlen); - -// DHCP packet? -if ((udp->dest ==htons (BOOTPC_PORT ) || udp->dest ==htons (BOOTPS_PORT )) - && blen - hlen >= (sizeof (UDPHDR ) +sizeof (DHCP ))) - { -const DHCP *dhcp = (DHCP *) (data - + hlen - +sizeof (ETH_HEADER ) - +sizeof (UDPHDR )); - -int optlen = len - -sizeof (ETH_HEADER ) - - hlen - -sizeof (UDPHDR ) - -sizeof (DHCP ); - -if (optlen <0 ) - optlen =0 ; - -DumpDHCP (eth, ip, udp, dhcp, optlen); - did = TRUE; - } - -if (!did) - { -DEBUGP ((" " )); -PrIP (ip->saddr); -DEBUGP ((":%d" ,ntohs (udp->source))); -DEBUGP ((" -> " )); -PrIP (ip->daddr); -DEBUGP ((":%d" ,ntohs (udp->dest))); - did = TRUE; - } - } - -if (!did) - { -DEBUGP ((" ipproto=%d " , ip->protocol)); -PrIP (ip->saddr); -DEBUGP ((" -> " )); -PrIP (ip->daddr); - } - -DEBUGP (("\n" )); -return ; - } - - { -DEBUGP (("%s ??? src=" , prefix)); -PrMac (eth->src); -DEBUGP ((" dest=" )); -PrMac (eth->dest); -DEBUGP ((" proto=0x%04x len=%d\n" , - (int )ntohs (eth->proto), - len)); - } -} - -#endif tap-win32/error.h deleted +0
-88@@ -1,88 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//----------------- -// DEBUGGING OUTPUT -//----------------- - -#define NOTE_ERROR () \ -{ \ - g_LastErrorFilename = __FILE__; \ - g_LastErrorLineNumber = __LINE__; \ -} - -#if DBG - -typedef struct { -unsigned int in; -unsigned int out; -unsigned int capacity; -char *text; -BOOLEAN error; -MUTEX lock; -}DebugOutput ; - -VOID MyDebugPrint (const unsigned char * format, ...); - -VOID MyAssert (const unsigned char *file,int line); - -VOID DumpPacket (const char *prefix, -const unsigned char *data, -unsigned int len); - -VOID DumpPacket2 (const char *prefix, -const ETH_HEADER *eth, -const unsigned char *data, -unsigned int len); - -#define CAN_WE_PRINT (DEBUGP_AT_DISPATCH || KeGetCurrentIrql () < DISPATCH_LEVEL) - -#if ALSO_DBGPRINT -#define DEBUGP (fmt) { MyDebugPrint fmt; if (CAN_WE_PRINT) DbgPrint fmt; } -#else -#define DEBUGP (fmt) { MyDebugPrint fmt; } -#endif - -#define MYASSERT (exp) \ -{ \ - if (!(exp)) \ - { \ - MyAssert(__FILE__, __LINE__); \ - } \ -} - -#define DUMP_PACKET (prefix, data, len) \ - DumpPacket (prefix, data, len) - -#define DUMP_PACKET2 (prefix, eth, data, len) \ - DumpPacket2 (prefix, eth, data, len) - -#else - -#define DEBUGP (fmt) -#define MYASSERT (exp) -#define DUMP_PACKET (prefix, data, len) -#define DUMP_PACKET2 (prefix, eth, data, len) - -#endif tap-win32/hexdump.c deleted +0
-69@@ -1,69 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "hexdump.h" - -#ifndef NDIS_MINIPORT_DRIVER - -VOID (*DbgMessage)(char *p_Format, ...) = DisplayDebugString; - -VOID DisplayDebugString (char *p_Format, ...) - { -static char l_Buffer [4096 ]; - -va_list l_ArgumentList; -va_start (l_ArgumentList, p_Format); -vsprintf (l_Buffer, p_Format, l_ArgumentList); -va_end (l_ArgumentList); - -OutputDebugStringA (l_Buffer); - } - -#endif - -VOID HexDump (unsigned char *p_Buffer,unsigned long p_Size) - { -unsigned long l_Index, l_Idx; -unsigned char l_Row [17 ]; - -for (l_Index = l_Row [16 ] =0 ; l_Index < p_Size || l_Index %16 ; ++l_Index) - { -if (l_Index %16 ==0 ) -DEBUGP (("%05x " , l_Index)); -DEBUGP (("%02x " , l_Row [l_Index %16 ] = (l_Index < p_Size ? p_Buffer [l_Index] :0 ))); - l_Row [l_Index %16 ] =IfPrint (l_Row [l_Index %16 ]); -if ((l_Index +1 ) %16 ==0 ) -DEBUGP ((" %s\n" , l_Row)); - } - -DEBUGP (("\n" )); - } - -#ifdef __cplusplus -} -#endif tap-win32/hexdump.h deleted +0
-63@@ -1,63 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef HEXDUMP_DEFINED -#define HEXDUMP_DEFINED - -#ifdef __cplusplus -extern "C" { -#endif - -//===================================================================================== -// Debug Routines -//===================================================================================== - -#ifndef NDIS_MINIPORT_DRIVER -# include <stdio.h> -# include <ctype.h> -# include <windows.h> -# include <winnt.h> -# include <memory.h> - -# ifndef DEBUGP -# define DEBUGP (fmt) { DbgMessage fmt; } -# endif - -extern VOID (*DbgMessage)(char *p_Format, ...); - -VOID DisplayDebugString (char *p_Format, ...); -#endif - -//=================================================================================== -// Reporting / Debugging -//=================================================================================== -#define IfPrint (c) (c >= 32 && c < 127 ? c : '.') - -VOID HexDump (unsigned char *p_Buffer,unsigned long p_Size); - -#ifdef __cplusplus -} -#endif - -#endif tap-win32/i386/OemWin2k.inf.in deleted +0
-195@@ -1,195 +0,0 @@ -; **************************************************************************** -; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. * -; * This program is free software; you can redistribute it and/or modify * -; * it under the terms of the GNU General Public License version 2 * -; * as published by the Free Software Foundation. * -; **************************************************************************** - -; SYNTAX CHECKER -; cd \WINDDK\3790\tools\chkinf -; chkinf c:\src\openvpn\tap-win32\i386\oemwin2k.inf -; OUTPUT -> file:///c:/WINDDK/3790/tools/chkinf/htm/c%23+src+openvpn+tap-win32+i386+__OemWin2k.htm - -; INSTALL/REMOVE DRIVER -; tapinstall install OemWin2k.inf TAP0901 -; tapinstall update OemWin2k.inf TAP0901 -; tapinstall remove TAP0901 - -;********************************************************* -; Note to Developers: -; -; If you are bundling the TAP-Win32 driver with your app, -; you should try to rename it in such a way that it will -; not collide with other instances of TAP-Win32 defined -; by other apps. Multiple versions of the TAP-Win32 -; driver, each installed by different apps, can coexist -; on the same machine if you follow these guidelines. -; NOTE: these instructions assume you are editing the -; generated OemWin2k.inf file, not the source -; OemWin2k.inf.in file which is preprocessed by winconfig -; and uses macro definitions from settings.in. -; -; (1) Rename all tapXXXX instances in this file to -; something different (use at least 5 characters -; for this name!) -; (2) Change the "!define TAP" definition in openvpn.nsi -; to match what you changed tapXXXX to. -; (3) Change TARGETNAME in SOURCES to match what you -; changed tapXXXX to. -; (4) Change TAP_COMPONENT_ID in common.h to match what -; you changed tapXXXX to. -; (5) Change SZDEPENDENCIES in service.h to match what -; you changed tapXXXX to. -; (6) Change DeviceDescription and Provider strings. -; (7) Change PRODUCT_STRING in constants.h to what you -; set DeviceDescription to. -; -;********************************************************* - -[Version] - Signature = "$Windows NT$" - CatalogFile = @@PRODUCT_TAP_ID@@.cat - ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} - Provider = %Provider% - Class = Net - -; This version number should match the version -; number given in SOURCES. - DriverVer=@@PRODUCT_TAP_RELDATE@@,@@PRODUCT_TAP_MAJOR_VER@@.00.00.@@PRODUCT_TAP_MINOR_VER@@ - -[Strings] - DeviceDescription = "@@PRODUCT_TAP_DEVICE_DESCRIPTION@@" - Provider = "@@PRODUCT_TAP_PROVIDER@@" - -;---------------------------------------------------------------- -; Manufacturer + Product Section (Done) -;---------------------------------------------------------------- -[Manufacturer] -!ifdef AMD64 - %Provider% = @@PRODUCT_TAP_ID@@, NTamd64 -!else - %Provider% = @@PRODUCT_TAP_ID@@ -!endif - -!ifdef AMD64 -[@@PRODUCT_TAP_ID@@.NTamd64] -!else -[@@PRODUCT_TAP_ID@@] -!endif - %DeviceDescription% = @@PRODUCT_TAP_ID@@.ndi, @@PRODUCT_TAP_ID@@ - -;--------------------------------------------------------------- -; Driver Section (Done) -;--------------------------------------------------------------- - -;----------------- Characteristics ------------ -; NCF_PHYSICAL = 0x04 -; NCF_VIRTUAL = 0x01 -; NCF_SOFTWARE_ENUMERATED = 0x02 -; NCF_HIDDEN = 0x08 -; NCF_NO_SERVICE = 0x10 -; NCF_HAS_UI = 0x80 -;----------------- Characteristics ------------ - -[@@PRODUCT_TAP_ID@@.ndi] - CopyFiles = @@PRODUCT_TAP_ID@@.driver, @@PRODUCT_TAP_ID@@.files - AddReg = @@PRODUCT_TAP_ID@@.reg - AddReg = @@PRODUCT_TAP_ID@@.params.reg - Characteristics = @@PRODUCT_TAP_CHARACTERISTICS@@ - -[@@PRODUCT_TAP_ID@@.ndi.Services] - AddService = @@PRODUCT_TAP_ID@@, 2, @@PRODUCT_TAP_ID@@.service - -[@@PRODUCT_TAP_ID@@.reg] - HKR, Ndi, Service, 0, "@@PRODUCT_TAP_ID@@" - HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" - HKR, , Manufacturer, 0, "%Provider%" - HKR, , ProductName, 0, "%DeviceDescription%" - -[@@PRODUCT_TAP_ID@@.params.reg] - HKR, Ndi\params\MTU, ParamDesc, 0, "MTU" - HKR, Ndi\params\MTU, Type, 0, "int" - HKR, Ndi\params\MTU, Default, 0, "1500" - HKR, Ndi\params\MTU, Optional, 0, "0" - HKR, Ndi\params\MTU, Min, 0, "100" - HKR, Ndi\params\MTU, Max, 0, "1500" - HKR, Ndi\params\MTU, Step, 0, "1" - HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status" - HKR, Ndi\params\MediaStatus, Type, 0, "enum" - HKR, Ndi\params\MediaStatus, Default, 0, "0" - HKR, Ndi\params\MediaStatus, Optional, 0, "0" - HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled" - HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected" - HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address" - HKR, Ndi\params\MAC, Type, 0, "edit" - HKR, Ndi\params\MAC, Optional, 0, "1" - HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access" - HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum" - HKR, Ndi\params\AllowNonAdmin, Default, 0, "1" - HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0" - HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed" - HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed" - -;---------------------------------------------------------------- -; Service Section -;---------------------------------------------------------------- - -;---------- Service Type ------------- -; SERVICE_KERNEL_DRIVER = 0x01 -; SERVICE_WIN32_OWN_PROCESS = 0x10 -;---------- Service Type ------------- - -;---------- Start Mode --------------- -; SERVICE_BOOT_START = 0x0 -; SERVICE_SYSTEM_START = 0x1 -; SERVICE_AUTO_START = 0x2 -; SERVICE_DEMAND_START = 0x3 -; SERVICE_DISABLED = 0x4 -;---------- Start Mode --------------- - -[@@PRODUCT_TAP_ID@@.service] - DisplayName = %DeviceDescription% - ServiceType = 1 - StartType = 3 - ErrorControl = 1 - LoadOrderGroup = NDIS - ServiceBinary = %12%\@@PRODUCT_TAP_ID@@.sys - -;----------------------------------------------------------------- -; File Installation -;----------------------------------------------------------------- - -;----------------- Copy Flags ------------ -; COPYFLG_NOSKIP = 0x02 -; COPYFLG_NOVERSIONCHECK = 0x04 -;----------------- Copy Flags ------------ - -; SourceDisksNames -; diskid = description[, [tagfile] [, <unused>, subdir]] -; 1 = "Intel Driver Disk 1",e100bex.sys,, - -[SourceDisksNames] - 1 = %DeviceDescription%, @@PRODUCT_TAP_ID@@.sys - -; SourceDisksFiles -; filename_on_source = diskID[, [subdir][, size]] -; e100bex.sys = 1,, ; on distribution disk 1 - -[SourceDisksFiles] -@@PRODUCT_TAP_ID@@.sys = 1 - -[DestinationDirs] - @@PRODUCT_TAP_ID@@.files = 11 - @@PRODUCT_TAP_ID@@.driver = 12 - -[@@PRODUCT_TAP_ID@@.files] -; TapPanel.cpl,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK -; cipsrvr.exe,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK - -[@@PRODUCT_TAP_ID@@.driver] - @@PRODUCT_TAP_ID@@.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK - -;--------------------------------------------------------------- -; End -;---------------------------------------------------------------tap-win32/instance.c deleted +0
-241@@ -1,241 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define INSTANCE_KEY (a) ((PVOID)((a)->m_Extension.m_TapDevice)) - -#define N_INSTANCE_BUCKETS 256 - -typedef struct _INSTANCE { -struct _INSTANCE *next; -TapAdapterPointer m_Adapter; -}INSTANCE ; - -typedef struct { -INSTANCE *list; -MUTEX lock; -}INSTANCE_BUCKET ; - -typedef struct { -INSTANCE_BUCKET buckets[N_INSTANCE_BUCKETS ]; -}INSTANCE_HASH ; - -INSTANCE_HASH *g_InstanceHash =NULL ; - -// must return a hash >= 0 and < N_INSTANCE_BUCKETS -int -InstanceHashValue (PVOID addr) -{ -UCHAR *p = (UCHAR *) &addr; - -if (sizeof (addr) ==4 ) -return p[0 ] ^ p[1 ] ^ p[2 ] ^ p[3 ]; -else if (sizeof (addr) ==8 ) -return p[0 ] ^ p[1 ] ^ p[2 ] ^ p[3 ] ^ p[4 ] ^ p[5 ] ^ p[6 ] ^ p[7 ]; -else - { -MYASSERT (0 ); - } -} - -BOOLEAN -InitInstanceList (VOID ) -{ -MYASSERT (g_InstanceHash ==NULL ); - g_InstanceHash =MemAlloc (sizeof (INSTANCE_HASH ), TRUE); -if (g_InstanceHash) - { -int i; -for (i =0 ; i <N_INSTANCE_BUCKETS ; ++i) -INIT_MUTEX (&g_InstanceHash->buckets[i].lock); -return TRUE; - } -else -return FALSE; -} - -int -NInstances (VOID ) -{ -int i, n =0 ; - -if (g_InstanceHash) - { -for (i =0 ; i <N_INSTANCE_BUCKETS ; ++i) - { -BOOLEAN got_lock; -INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i]; -ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); - -if (got_lock) - { -INSTANCE *current; -for (current = ib->list; current !=NULL ; current = current->next) - ++n; -RELEASE_MUTEX (&ib->lock); - } -else -return -1 ; - } - } - -return n; -} - -int -InstanceMaxBucketSize (VOID ) -{ -int i, n =0 ; - -if (g_InstanceHash) - { -for (i =0 ; i <N_INSTANCE_BUCKETS ; ++i) - { -BOOLEAN got_lock; -int bucket_size =0 ; -INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i]; -ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); - -if (got_lock) - { -INSTANCE *current; -for (current = ib->list; current !=NULL ; current = current->next) - ++bucket_size; -if (bucket_size > n) - n = bucket_size; -RELEASE_MUTEX (&ib->lock); - } -else -return -1 ; - } - } - -return n; -} - -VOID -FreeInstanceList (VOID ) -{ -if (g_InstanceHash) - { -MYASSERT (NInstances () ==0 ); -MemFree (g_InstanceHash,sizeof (INSTANCE_HASH )); - g_InstanceHash =NULL ; - } -} - -BOOLEAN -AddAdapterToInstanceList (TapAdapterPointer p_Adapter) -{ -BOOLEAN got_lock; -BOOLEAN ret = FALSE; -const int hash =InstanceHashValue (INSTANCE_KEY (p_Adapter)); -INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[hash]; - -DEBUGP (("[TAP] AddAdapterToInstanceList hash=%d\n" , hash)); - -ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); - -if (got_lock) - { -INSTANCE *i =MemAlloc (sizeof (INSTANCE ), FALSE); -if (i) - { -MYASSERT (p_Adapter); - i->m_Adapter = p_Adapter; - i->next = ib->list; - ib->list = i; - ret = TRUE; - } -RELEASE_MUTEX (&ib->lock); - } - -return ret; -} - -BOOLEAN -RemoveAdapterFromInstanceList (TapAdapterPointer p_Adapter) -{ -BOOLEAN got_lock; -BOOLEAN ret = FALSE; -INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue (INSTANCE_KEY (p_Adapter))]; - -ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); - -if (got_lock) - { -INSTANCE *current, *prev=NULL ; -for (current = ib->list; current !=NULL ; current = current->next) - { -if (current->m_Adapter == p_Adapter)// found match - { -if (prev) - prev->next = current->next; -else - ib->list = current->next; -MemFree (current->m_Adapter,sizeof (TapAdapter)); -MemFree (current,sizeof (INSTANCE )); - ret = TRUE; -break ; - } - prev = current; - } -RELEASE_MUTEX (&ib->lock); - } - -return ret; -} - -TapAdapterPointer -LookupAdapterInInstanceList (PDEVICE_OBJECT p_DeviceObject) -{ -BOOLEAN got_lock; -TapAdapterPointer ret =NULL ; -INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue ((PVOID )p_DeviceObject)]; - -ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock); - -if (got_lock) - { -INSTANCE *current, *prev=NULL ; -for (current = ib->list; current !=NULL ; current = current->next) - { -if (p_DeviceObject ==INSTANCE_KEY (current->m_Adapter))// found match - { -// move it to head of list -if (prev) - { - prev->next = current->next; - current->next = ib->list; - ib->list = current; - } - ret = ib->list->m_Adapter; -break ; - } - prev = current; - } -RELEASE_MUTEX (&ib->lock); - } - -return ret; -}tap-win32/lock.h deleted +0
-75@@ -1,75 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -typedef struct -{ -volatile long count; -}MUTEX ; - -#define MUTEX_SLEEP_TIME 10000 // microseconds - -#define INIT_MUTEX (m) { (m)->count = 0; } - -#define ACQUIRE_MUTEX_BLOCKING (m) \ -{ \ - while (NdisInterlockedIncrement (&((m)->count)) != 1) \ - { \ - NdisInterlockedDecrement(&((m)->count)); \ - NdisMSleep(MUTEX_SLEEP_TIME); \ - } \ -} - -#define RELEASE_MUTEX (m) \ -{ \ - NdisInterlockedDecrement(&((m)->count)); \ -} - -#define ACQUIRE_MUTEX_NONBLOCKING (m, result) \ -{ \ - if (NdisInterlockedIncrement (&((m)->count)) != 1) \ - { \ - NdisInterlockedDecrement(&((m)->count)); \ - result = FALSE; \ - } \ - else \ - { \ - result = TRUE; \ - } \ -} - -#define ACQUIRE_MUTEX_ADAPTIVE (m, result) \ -{ \ - result = TRUE; \ - while (NdisInterlockedIncrement (&((m)->count)) != 1) \ - { \ - NdisInterlockedDecrement(&((m)->count)); \ - if (KeGetCurrentIrql () < DISPATCH_LEVEL) \ - NdisMSleep(MUTEX_SLEEP_TIME); \ - else \ - { \ - result = FALSE; \ - break; \ - } \ - } \ -}tap-win32/macinfo.c deleted +0
-154@@ -1,154 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "macinfo.h" - -int -HexStringToDecimalInt (const int p_Character) -{ -int l_Value =0 ; - -if (p_Character >='A' && p_Character <='F' ) - l_Value = (p_Character -'A' ) +10 ; -else if (p_Character >='a' && p_Character <='f' ) - l_Value = (p_Character -'a' ) +10 ; -else if (p_Character >='0' && p_Character <='9' ) - l_Value = p_Character -'0' ; - -return l_Value; -} - -BOOLEAN -ParseMAC (MACADDR dest,const char *src) -{ -int c; -int mac_index =0 ; -BOOLEAN high_digit = FALSE; -int delim_action =1 ; - -MYASSERT (src); -MYASSERT (dest); - -CLEAR_MAC (dest); - -while (c = *src++) - { -if (IsMacDelimiter (c)) - { - mac_index += delim_action; - high_digit = FALSE; - delim_action =1 ; - } -else if (IsHexDigit (c)) - { -const int digit =HexStringToDecimalInt (c); -if (mac_index <sizeof (MACADDR )) - { -if (!high_digit) - { - dest[mac_index] = (char )(digit); - high_digit = TRUE; - delim_action =1 ; - } -else - { - dest[mac_index] = (char )(dest[mac_index] *16 + digit); - ++mac_index; - high_digit = FALSE; - delim_action =0 ; - } - } -else -return FALSE; - } -else -return FALSE; - } - -return (mac_index + delim_action) >=sizeof (MACADDR ); -} - -/* -* Generate a MAC using the GUID in the adapter name. -* -* The mac is constructed as 00:FF:xx:xx:xx:xx where -* the Xs are taken from the first 32 bits of the GUID in the -* adapter name. This is similar to the Linux 2.4 tap MAC -* generator, except linux uses 32 random bits for the Xs. -* -* In general, this solution is reasonable for most -* applications except for very large bridged TAP networks, -* where the probability of address collisions becomes more -* than infintesimal. -* -* Using the well-known "birthday paradox", on a 1000 node -* network the probability of collision would be -* 0.000116292153. On a 10,000 node network, the probability -* of collision would be 0.01157288998621678766. -*/ - -VOID GenerateRandomMac (MACADDR mac,const unsigned char *adapter_name) -{ -unsigned const char *cp = adapter_name; -unsigned char c; -unsigned int i =2 ; -unsigned int byte =0 ; -int brace =0 ; -int state =0 ; - -CLEAR_MAC (mac); - - mac[0 ] =0x00 ; - mac[1 ] =0xFF ; - -while (c = *cp++) - { -if (i >=sizeof (MACADDR )) -break ; -if (c =='{' ) - brace =1 ; -if (IsHexDigit (c) && brace) - { -const unsigned int digit =HexStringToDecimalInt (c); -if (state) - { - byte <<=4 ; - byte |= digit; - mac[i++] = (unsigned char ) byte; - state =0 ; - } -else - { - byte = digit; - state =1 ; - } - } - } -} - -VOID GenerateRelatedMAC (MACADDR dest,const MACADDR src,const int delta) -{ -COPY_MAC (dest, src); - dest[2 ] += (UCHAR ) delta; -}tap-win32/macinfo.h deleted +0
-38@@ -1,38 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef MacInfoDefined -#define MacInfoDefined - -//=================================================================================== -// Macros -//=================================================================================== -#define IsMacDelimiter (a) (a == ':' || a == '-' || a == '.') -#define IsHexDigit (c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) - -#define COPY_MAC (dest, src) NdisMoveMemory ((dest), (src), sizeof (MACADDR)) -#define CLEAR_MAC (dest) NdisZeroMemory ((dest), sizeof (MACADDR)) -#define MAC_EQUAL (a,b) (memcmp ((a), (b), sizeof (MACADDR)) == 0) - -#endif tap-win32/mem.c deleted +0
-186@@ -1,186 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//------------------ -// Memory Management -//------------------ - -PVOID -MemAlloc (ULONG p_Size,BOOLEAN zero) -{ -PVOID l_Return =NULL ; - -if (p_Size) - { - __try - { -if (NdisAllocateMemoryWithTag (&l_Return, p_Size,'APAT' ) - ==NDIS_STATUS_SUCCESS ) - { -if (zero) -NdisZeroMemory (l_Return, p_Size); - } -else - l_Return =NULL ; - } - __except (EXCEPTION_EXECUTE_HANDLER ) - { - l_Return =NULL ; - } - } - -return l_Return; -} - -VOID -MemFree (PVOID p_Addr,ULONG p_Size) -{ -if (p_Addr && p_Size) - { - __try - { -#if DBG -NdisZeroMemory (p_Addr, p_Size); -#endif -NdisFreeMemory (p_Addr, p_Size,0 ); - } - __except (EXCEPTION_EXECUTE_HANDLER ) - { - } - } -} - -/* -* Circular queue management routines. -*/ - -#define QUEUE_BYTE_ALLOCATION (size) \ - (sizeof (Queue) + (size * sizeof (PVOID))) - -#define QUEUE_ADD_INDEX (var, inc) \ -{ \ - var += inc; \ - if (var >= q->capacity) \ - var -= q->capacity; \ - MYASSERT (var < q->capacity); \ -} - -#define QUEUE_SANITY_CHECK () \ - MYASSERT (q != NULL && q->base < q->capacity && q->size <= q->capacity) - -#define QueueCount (q) (q->size) - -#define UPDATE_MAX_SIZE () \ -{ \ - if (q->size > q->max_size) \ - q->max_size = q->size; \ -} - -Queue * -QueueInit (ULONG capacity) -{ -Queue *q; - -MYASSERT (capacity >0 ); - q = (Queue *)MemAlloc (QUEUE_BYTE_ALLOCATION (capacity), TRUE); -if (!q) -return NULL ; - - q->base = q->size =0 ; - q->capacity = capacity; - q->max_size =0 ; -return q; -} - -VOID -QueueFree (Queue *q) -{ -if (q) - { -QUEUE_SANITY_CHECK (); -MemFree (q,QUEUE_BYTE_ALLOCATION (q->capacity)); - } -} - -PVOID -QueuePush (Queue *q,PVOID item) -{ -ULONG dest; -QUEUE_SANITY_CHECK (); -if (q->size == q->capacity) -return NULL ; - dest = q->base; -QUEUE_ADD_INDEX (dest, q->size); - q->data[dest] = item; - ++q->size; -UPDATE_MAX_SIZE (); -return item; -} - -PVOID -QueuePop (Queue *q) -{ -ULONG oldbase; -QUEUE_SANITY_CHECK (); -if (!q->size) -return NULL ; - oldbase = q->base; -QUEUE_ADD_INDEX (q->base,1 ); - --q->size; -UPDATE_MAX_SIZE (); -return q->data[oldbase]; -} - -PVOID -QueueExtract (Queue *q,PVOID item) -{ -ULONG src, dest, count, n; -QUEUE_SANITY_CHECK (); - n =0 ; - src = dest = q->base; - count = q->size; -while (count--) - { -if (item == q->data[src]) - { - ++n; - --q->size; - } -else - { - q->data[dest] = q->data[src]; -QUEUE_ADD_INDEX (dest,1 ); - } -QUEUE_ADD_INDEX (src,1 ); - } -if (n) -return item; -else -return NULL ; -} - -#undef QUEUE_BYTE_ALLOCATION -#undef QUEUE_ADD_INDEX -#undef QUEUE_SANITY_CHECK -#undef UPDATE_MAX_SIZEtap-win32/proto.h deleted +0
-224@@ -1,224 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -//============================================================ -// MAC address, Ethernet header, and ARP -//============================================================ - -#pragma pack(1) - -#define IP_HEADER_SIZE 20 -#define IPV6_HEADER_SIZE 40 - -typedef unsigned char MACADDR [6 ]; -typedef unsigned long IPADDR ; -typedef unsigned char IPV6ADDR [16 ]; - -//----------------- -// Ethernet address -//----------------- - -typedef struct { -MACADDR addr; -}ETH_ADDR ; - -typedef struct { -ETH_ADDR list[NIC_MAX_MCAST_LIST ]; -}MC_LIST ; - -//---------------- -// Ethernet header -//---------------- - -typedef struct -{ -MACADDR dest;/* destination eth addr */ -MACADDR src;/* source ether addr */ - -# define ETH_P_IP 0x0800/* IPv4 protocol */ -# define ETH_P_IPV6 0x86DD/* IPv6 protocol */ -# define ETH_P_ARP 0x0806/* ARP protocol */ -USHORT proto;/* packet type ID field */ -}ETH_HEADER , *PETH_HEADER ; - -//---------------- -// ARP packet -//---------------- - -typedef struct - { -MACADDR m_MAC_Destination;// Reverse these two -MACADDR m_MAC_Source;// to answer ARP requests -USHORT m_Proto;// 0x0806 - -# define MAC_ADDR_TYPE 0x0001 -USHORT m_MAC_AddressType;// 0x0001 - -USHORT m_PROTO_AddressType;// 0x0800 -UCHAR m_MAC_AddressSize;// 0x06 -UCHAR m_PROTO_AddressSize;// 0x04 - -# define ARP_REQUEST 0x0001 -# define ARP_REPLY 0x0002 -USHORT m_ARP_Operation;// 0x0001 for ARP request, 0x0002 for ARP reply - -MACADDR m_ARP_MAC_Source; -IPADDR m_ARP_IP_Source; -MACADDR m_ARP_MAC_Destination; -IPADDR m_ARP_IP_Destination; - } -ARP_PACKET , *PARP_PACKET ; - -//---------- -// IP Header -//---------- - -typedef struct { -# define IPH_GET_VER (v) (((v) >> 4) & 0x0F) -# define IPH_GET_LEN (v) (((v) & 0x0F) << 2) -UCHAR version_len; - -UCHAR tos; -USHORT tot_len; -USHORT id; - -# define IP_OFFMASK 0x1fff -USHORT frag_off; - -UCHAR ttl; - -# define IPPROTO_UDP 17/* UDP protocol */ -# define IPPROTO_TCP 6/* TCP protocol */ -# define IPPROTO_ICMP 1/* ICMP protocol */ -# define IPPROTO_IGMP 2/* IGMP protocol */ -UCHAR protocol; - -USHORT check; -ULONG saddr; -ULONG daddr; -/* The options start here. */ -}IPHDR ; - -//----------- -// UDP header -//----------- - -typedef struct { -USHORT source; -USHORT dest; -USHORT len; -USHORT check; -}UDPHDR ; - -//-------------------------- -// TCP header, per RFC 793. -//-------------------------- - -typedef struct { -USHORT source;/* source port */ -USHORT dest;/* destination port */ -ULONG seq;/* sequence number */ -ULONG ack_seq;/* acknowledgement number */ - -# define TCPH_GET_DOFF (d) (((d) & 0xF0) >> 2) -UCHAR doff_res; - -# define TCPH_FIN_MASK (1<<0) -# define TCPH_SYN_MASK (1<<1) -# define TCPH_RST_MASK (1<<2) -# define TCPH_PSH_MASK (1<<3) -# define TCPH_ACK_MASK (1<<4) -# define TCPH_URG_MASK (1<<5) -# define TCPH_ECE_MASK (1<<6) -# define TCPH_CWR_MASK (1<<7) -UCHAR flags; - -USHORT window; -USHORT check; -USHORT urg_ptr; -}TCPHDR ; - -#define TCPOPT_EOL 0 -#define TCPOPT_NOP 1 -#define TCPOPT_MAXSEG 2 -#define TCPOLEN_MAXSEG 4 - -//------------ -// IPv6 Header -//------------ - -typedef struct { -UCHAR version_prio; -UCHAR flow_lbl[3 ]; -USHORT payload_len; -# define IPPROTO_ICMPV6 0x3a/* ICMP protocol v6 */ -UCHAR nexthdr; -UCHAR hop_limit; -IPV6ADDR saddr; -IPV6ADDR daddr; -}IPV6HDR ; - -//-------------------------------------------- -// IPCMPv6 NS/NA Packets (RFC4443 and RFC4861) -//-------------------------------------------- - -// Neighbor Solictiation - RFC 4861, 4.3 -// (this is just the ICMPv6 part of the packet) -typedef struct { -UCHAR type; -# define ICMPV6_TYPE_NS 135 // neighbour solicitation -UCHAR code; -# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA -USHORT checksum; -ULONG reserved; -IPV6ADDR target_addr; -}ICMPV6_NS ; - -// Neighbor Advertisement - RFC 4861, 4.4 + 4.6/4.6.1 -// (this is just the ICMPv6 payload) -typedef struct { -UCHAR type; -# define ICMPV6_TYPE_NA 136 // neighbour advertisement -UCHAR code; -# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA -USHORT checksum; -UCHAR rso_bits;// Router(0), Solicited(2), Ovrrd(4) -UCHAR reserved[3 ]; -IPV6ADDR target_addr; -// always include "Target Link-layer Address" option (RFC 4861 4.6.1) -UCHAR opt_type; -#define ICMPV6_OPTION_TLLA 2 -UCHAR opt_length; -#define ICMPV6_LENGTH_TLLA 1 // multiplied by 8 -> 1 = 8 bytes -MACADDR target_macaddr; -}ICMPV6_NA ; - -// this is the complete packet with Ethernet and IPv6 headers -typedef struct { -ETH_HEADER eth; -IPV6HDR ipv6; -ICMPV6_NA icmpv6; -}ICMPV6_NA_PKT ; - -#pragma pack()tap-win32/prototypes.h deleted +0
-260@@ -1,260 +0,0 @@ -/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. -* -* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. -* -* This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc., -* and is released under the GPL version 2 (see below). -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program (see the file COPYING included with this -* distribution); if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef TAP_PROTOTYPES_DEFINED -#define TAP_PROTOTYPES_DEFINED - -NTSTATUS DriverEntry - ( - IN PDRIVER_OBJECT p_DriverObject, - IN PUNICODE_STRING p_RegistryPath - ); - -VOID TapDriverUnload - ( - IN PDRIVER_OBJECT p_DriverObject - ); - -NDIS_STATUS AdapterCreate - ( - OUT PNDIS_STATUS p_ErrorStatus, - OUT PUINT p_MediaIndex, - IN PNDIS_MEDIUM p_Media, - IN UINT p_MediaCount, - IN NDIS_HANDLE p_AdapterHandle, - IN NDIS_HANDLE p_ConfigurationHandle - ); - -VOID AdapterHalt - ( - IN NDIS_HANDLE p_AdapterContext - ); - -VOID AdapterFreeResources - ( -TapAdapterPointer p_Adapter - ); - -NDIS_STATUS AdapterReset - ( - OUT PBOOLEAN p_AddressingReset, - IN NDIS_HANDLE p_AdapterContext - ); - -NDIS_STATUS AdapterQuery - ( - IN NDIS_HANDLE p_AdapterContext, - IN NDIS_OID p_OID, - IN PVOID p_Buffer, - IN ULONG p_BufferLength, - OUT PULONG p_BytesWritten, - OUT PULONG p_BytesNeeded - ); - -NDIS_STATUS AdapterModify - ( - IN NDIS_HANDLE p_AdapterContext, - IN NDIS_OID p_OID, - IN PVOID p_Buffer, - IN ULONG p_BufferLength, - OUT PULONG p_BytesRead, - OUT PULONG p_BytesNeeded - ); - -NDIS_STATUS AdapterTransmit - ( - IN NDIS_HANDLE p_AdapterContext, - IN PNDIS_PACKET p_Packet, - IN UINT p_Flags - ); - -NDIS_STATUS AdapterReceive - ( - OUT PNDIS_PACKET p_Packet, - OUT PUINT p_Transferred, - IN NDIS_HANDLE p_AdapterContext, - IN NDIS_HANDLE p_ReceiveContext, - IN UINT p_Offset, - IN UINT p_ToTransfer - ); - -NTSTATUS TapDeviceHook - ( - IN PDEVICE_OBJECT p_DeviceObject, - IN PIRP p_IRP - ); - -NDIS_STATUS CreateTapDevice - ( -TapExtensionPointer p_Extension, -const char *p_Name - ); - -VOID DestroyTapDevice - ( -TapExtensionPointer p_Extension - ); - -VOID TapDeviceFreeResources - ( -TapExtensionPointer p_Extension - ); - -NTSTATUS CompleteIRP - ( - IN PIRP p_IRP, - IN TapPacketPointer p_PacketBuffer, - IN CCHAR PriorityBoost - ); - -VOID CancelIRPCallback - ( - IN PDEVICE_OBJECT p_DeviceObject, - IN PIRP p_IRP - ); - -VOID CancelIRP - ( -TapExtensionPointer p_Extension, - IN PIRP p_IRP, -BOOLEAN callback - ); - -VOID FlushQueues - ( -TapExtensionPointer p_Extension - ); - -VOID ResetTapAdapterState - ( -TapAdapterPointer p_Adapter - ); - -BOOLEAN ProcessARP - ( -TapAdapterPointer p_Adapter, -const PARP_PACKET src, -const IPADDR adapter_ip, -const IPADDR ip_network, -const IPADDR ip_netmask, -const MACADDR mac - ); - -VOID SetMediaStatus - ( -TapAdapterPointer p_Adapter, -BOOLEAN state - ); - -VOID InjectPacketDeferred - ( -TapAdapterPointer p_Adapter, -UCHAR *packet, -const unsigned int len - ); - -VOID InjectPacketNow - ( -TapAdapterPointer p_Adapter, -UCHAR *packet, -const unsigned int len - ); - -// for KDEFERRED_ROUTINE and Static Driver Verifier -//#include <wdm.h> -//KDEFERRED_ROUTINE InjectPacketDpc; - -VOID InjectPacketDpc - ( -KDPC *Dpc, -PVOID DeferredContext, -PVOID SystemArgument1, -PVOID SystemArgument2 - ); - -VOID CheckIfDhcpAndTunMode - ( -TapAdapterPointer p_Adapter - ); - -VOID HookDispatchFunctions (); - -#if ENABLE_NONADMIN - -#if DDKVER_MAJOR <5600 -/* -* Better solution for use on Vista DDK, but possibly not compatible with -* earlier DDKs: -* -* Eliminate the definition of SECURITY_DESCRIPTOR (and even ZwSetSecurityObject), -* and at the top of tapdrv.c change: -* -* #include <ndis.h> -* #include <ntstrsafe.h> -* #include <ntddk.h> -* -* To -* -* #include <ntifs.h> -* #include <ndis.h> -* #include <ntstrsafe.h> -*/ -typedef struct _SECURITY_DESCRIPTOR { -unsigned char opaque[64 ]; -}SECURITY_DESCRIPTOR ; - -NTSYSAPI -NTSTATUS -NTAPI -ZwSetSecurityObject ( - IN HANDLE Handle, - IN SECURITY_INFORMATION SecurityInformation, - IN PSECURITY_DESCRIPTOR SecurityDescriptor); - -#endif - -VOID AllowNonAdmin (TapExtensionPointer p_Extension); - -#endif - -struct WIN2K_NDIS_MINIPORT_BLOCK -{ -unsigned char opaque[16 ]; -UNICODE_STRING MiniportName;// how mini-port refers to us -}; - -#if PACKET_TRUNCATION_CHECK - -VOID IPv4PacketSizeVerify - (Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
1.7.3.4
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Part of the diff is not shown here. View the raw message.
PATCH 20/52 cleanup: rename tap-windows function from win32 to win
In reply to Alon Bar-Lev--- configure.ac | 18 +++--- errlevel.h | 2 +- error.c | 6 +- forward.c | 2 +- options.c | 8 +- service-win32/service.h | 2 +- sig.c | 2 +- tap-windows.h | 34 ++++++------ tun.c | 142 +++++++++++++++++++++++----------------------- tun.h | 6 +- version.m4 | 6 +- win/autodefs.h.in | 6 +- win/openvpn.nsi | 8 +- 13 files changed, 121 insertions(+), 121 deletions(-)
configure.ac +9 -9
@@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then ) fi -TAP_COMPONENT_ID="PRODUCT_TAP_ID" -TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR" -TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR" -AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id]) -AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES]) -AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES]) -AC_SUBST([TAP_COMPONENT_ID]) -AC_SUBST([TAP_WIN32_MIN_MAJOR]) -AC_SUBST([TAP_WIN32_MIN_MINOR]) +TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID" +TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR" +TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR" +AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id]) +AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN]) +AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN]) +AC_SUBST([TAP_WIN_COMPONENT_ID]) +AC_SUBST([TAP_WIN_MIN_MAJOR]) +AC_SUBST([TAP_WIN_MIN_MINOR]) win32datadir="\${datadir}/${PACKAGE}-win32" AC_SUBST(win32datadir)
errlevel.h +1 -1
@@ -113,7 +113,7 @@#define D_LINK_RW LOGLEV(6, 69, M_DEBUG)/* show TCP/UDP reads/writes (terse) */ #define D_TUN_RW LOGLEV(6, 69, M_DEBUG)/* show TUN/TAP reads/writes */ -#define D_TAP_WIN32_DEBUG LOGLEV(6, 69, M_DEBUG)/* show TAP-Win32 driver debug info */ +#define D_TAP_WIN_DEBUG LOGLEV(6, 69, M_DEBUG)/* show TAP-Windows driver debug info */ #define D_CLIENT_NAT LOGLEV(6, 69, M_DEBUG)/* show client NAT debug info */ #define D_SHOW_KEYS LOGLEV(7, 70, M_DEBUG)/* show data channel encryption keys */
error.c +3 -3
@@ -614,8 +614,8 @@ x_check_status (int status, } }#elif defined(WIN32) -/* get possible driver error from TAP-Win32 driver */ - extended_msg =tap_win32_getinfo (tt, &gc); +/* get possible driver error from TAP-Windows driver */ + extended_msg =tap_win_getinfo (tt, &gc);#endif if (!ignore_sys_error (my_errno)) {
@@ -741,7 +741,7 @@ strerror_win32 (DWORD errnum, struct gc_arena *gc)#if 1 switch (errnum) {/* -* When the TAP-Win32 driver returns STATUS_UNSUCCESSFUL, this code +* When the TAP-Windows driver returns STATUS_UNSUCCESSFUL, this code * gets returned to user space. */ case ERROR_GEN_FAILURE :
forward.c +1 -1
@@ -1292,7 +1292,7 @@ pre_select (struct context *c) c->c2.timeval.tv_usec =0 ;#if defined(WIN32 ) -if (check_debug_level (D_TAP_WIN32_DEBUG )) +if (check_debug_level (D_TAP_WIN_DEBUG )) { c->c2.timeval.tv_sec =1 ;if (tuntap_defined (c->c1.tuntap))
options.c +4 -4
@@ -657,7 +657,7 @@ static const char usage_message[] ="Windows Specific:\n" "--win-sys path : Pathname of Windows system directory. Default is the pathname\n" " from SystemRoot environment variable.\n" -"--ip-win32 method : When using --ifconfig on Windows, set TAP-Win32 adapter\n" +"--ip-win32 method : When using --ifconfig on Windows, set TAP-Windows adapter\n" " IP address using method = manual, netsh, ipapi,\n" " dynamic, or adaptive (default = adaptive).\n" " Dynamic method allows two optional parameters:\n"
@@ -673,7 +673,7 @@ static const char usage_message[] =" adaptive (default) -- Try ipapi then fall back to exe.\n" " ipapi -- Use IP helper API.\n" " exe -- Call the route.exe shell command.\n" -"--dhcp-option type [parm] : Set extended TAP-Win32 properties, must\n" +"--dhcp-option type [parm] : Set extended TAP-Windows properties, must\n" " be used with --ip-win32 dynamic. For options\n" " which allow multiple addresses,\n" " --dhcp-option must be repeated.\n"
@@ -704,7 +704,7 @@ static const char usage_message[] =" after TAP adapter is up and routes have been added.\n" "Windows Standalone Options:\n" "\n" -"--show-adapters : Show all TAP-Win32 adapters.\n" +"--show-adapters : Show all TAP-Windows adapters.\n" "--show-net : Show " PACKAGE_NAME "'s view of routing table and net adapter list.\n" "--show-valid-subnets : Show valid subnets for --dev tun emulation.\n" "--allow-nonadmin [TAP-adapter] : Allow " PACKAGE_NAME " running without admin privileges\n"
@@ -6046,7 +6046,7 @@ add_option (struct options *options,else if (streq (p[0 ],"show-adapters" )) {VERIFY_PERMISSION (OPT_P_GENERAL ); -show_tap_win32_adapters (M_INFO |M_NOPREFIX ,M_WARN |M_NOPREFIX ); +show_tap_win_adapters (M_INFO |M_NOPREFIX ,M_WARN |M_NOPREFIX );openvpn_exit (OPENVPN_EXIT_STATUS_GOOD );/* exit point */ }else if (streq (p[0 ],"show-net" ))
service-win32/service.h +1 -1
@@ -69,7 +69,7 @@ extern "C" {// displayed name of the service #define SZSERVICEDISPLAYNAME PACKAGE_NAME " Service"// list of service dependencies - "dep1\0dep2\0\0" -#define SZDEPENDENCIES TAP_ID "\0Dhcp\0\0" +#define SZDEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"//////////////////////////////////////////////////////////////////////////////
sig.c +1 -1
@@ -268,7 +268,7 @@ print_status (const struct context *c, struct status_output *so)#ifdef WIN32 if (tuntap_defined (c->c1.tuntap))status_printf (so,"TAP-WIN32 driver status,\"%s\"" , -tap_win32_getinfo (c->c1.tuntap, &gc)); +tap_win_getinfo (c->c1.tuntap, &gc));#endif status_printf (so,"END" );
tap-windows.h +17 -17
@@ -1,6 +1,6 @@/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. +* TAP-Windows -- A kernel driver to provide virtual tap +* device functionality on Windows. * * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. *
@@ -21,32 +21,32 @@* distribution); if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __TAP_H -#define __TAP_H +#ifndef __TAP_WIN_H +#define __TAP_WIN_H//============= // TAP IOCTLs //============= -#define TAP_CONTROL_CODE (request,method) \ +#define TAP_WIN_CONTROL_CODE (request,method) \ CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)// Present in 8.1 -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)// Added in 8.2 -/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */ -#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED) +/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */ +#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)//================= // Registry keys
@@ -63,6 +63,6 @@#define USERMODEDEVICEDIR "\\\\.\\Global\\"#define SYSDEVICEDIR "\\Device\\"#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" +#define TAP_WIN_SUFFIX ".tap"#endif
tun.c +71 -71
448 lines not on this page · raw message
tun.h +3 -3
@@ -164,7 +164,7 @@ struct tuntapULONG ipapi_instance;in_addr_t adapter_netmask; -/* Windows adapter index for TAP-Win32 adapter, +/* Windows adapter index for TAP-Windows adapter, ~0 if undefined */ DWORD adapter_index;
@@ -333,13 +333,13 @@ DWORD adapter_index_of_ip (const IP_ADAPTER_INFO *list,int *count, in_addr_t *netmask); -void show_tap_win32_adapters (int msglev,int warnlev); +void show_tap_win_adapters (int msglev,int warnlev);void show_adapters (int msglev);void tap_allow_nonadmin_access (const char *dev_node);void show_valid_win32_tun_subnets (void ); -const char *tap_win32_getinfo (const struct tuntap *tt,struct gc_arena *gc); +const char *tap_win_getinfo (const struct tuntap *tt,struct gc_arena *gc);void tun_show_debug (struct tuntap *tt);bool dhcp_release_by_adapter_index (const DWORD adapter_index);
version.m4 +3 -3
@@ -1,6 +1,6 @@ dnl define the OpenVPN version define(PRODUCT_VERSION,[2.3_alpha1]) dnl define the TAP version -define(PRODUCT_TAP_ID,[tap0901]) -define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9]) -define(PRODUCT_TAP_WIN32_MIN_MINOR,[9]) +define(PRODUCT_TAP_WIN_COMPONENT_ID,[tap0901]) +define(PRODUCT_TAP_WIN_MIN_MAJOR,[9]) +define(PRODUCT_TAP_WIN_MIN_MINOR,[9])
win/autodefs.h.in +3 -3
@@ -6,9 +6,9 @@ * * The TAP-Win32 version number is defined in tap-win32/SOURCES */ -#define TAP_COMPONENT_ID "@PRODUCT_TAP_ID@" -#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ -#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ +#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@" +#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@ +#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@ /* Friendly name for TAP driver */ #define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"
win/openvpn.nsi +4 -4
@@ -44,7 +44,7 @@ SetCompressor lzma !define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}" -!define TAP "${PRODUCT_TAP_ID}" +!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}" !define TAPDRV "${TAP}.sys" ; Default service settings
@@ -409,7 +409,7 @@ Section "TAP Virtual Ethernet Adapter" SecTAP File "${GEN}\amd64\${TAPDRV}" # Don't try to install TAP driver signature if it does not exist. - File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_ID}.cat" + File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat" goto tapend
@@ -425,7 +425,7 @@ tap-32bit: File "${GEN}\i386\${TAPDRV}" # Don't try to install TAP driver signature if it does not exist. - File /nonfatal "${GEN}\i386\${PRODUCT_TAP_ID}.cat" + File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat" tapend:
@@ -778,7 +778,7 @@ Section "Uninstall" Delete "$INSTDIR\log\README.txt" Delete "$INSTDIR\driver\OemWin2k.inf" - Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat" + Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat" Delete "$INSTDIR\driver\${TAPDRV}" Delete "$INSTDIR\bin\openssl.exe"
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 20/52] cleanup: rename tap-windows function from win32 to win
As is said on tap-win32/common.h and in many other places:
"TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap device functionality on Windows."
So, it's not 32-bit only. Thus converting "tap-win32" into "tap-win" makes sense.
ACK.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 833 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 18 +++--- errlevel.h | 2 +- error.c | 6 +- forward.c | 2 +- options.c | 8 +- service-win32/service.h | 2 +- sig.c | 2 +- tap-windows.h | 34 ++++++------ tun.c | 142 +++++++++++++++++++++++----------------------- tun.h | 6 +- version.m4 | 6 +- win/autodefs.h.in | 6 +- win/openvpn.nsi | 8 +- 13 files changed, 121 insertions(+), 121 deletions(-)configure.ac +9
-9@@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then ) fi -TAP_COMPONENT_ID="PRODUCT_TAP_ID" -TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR" -TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR" -AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id]) -AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES]) -AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES]) -AC_SUBST([TAP_COMPONENT_ID]) -AC_SUBST([TAP_WIN32_MIN_MAJOR]) -AC_SUBST([TAP_WIN32_MIN_MINOR]) +TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID" +TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR" +TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR" +AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id]) +AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN]) +AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN]) +AC_SUBST([TAP_WIN_COMPONENT_ID]) +AC_SUBST([TAP_WIN_MIN_MAJOR]) +AC_SUBST([TAP_WIN_MIN_MINOR]) win32datadir="\${datadir}/${PACKAGE}-win32" AC_SUBST(win32datadir)errlevel.h +1
-1@@ -113,7 +113,7 @@#define D_LINK_RW LOGLEV(6, 69, M_DEBUG)/* show TCP/UDP reads/writes (terse) */ #define D_TUN_RW LOGLEV(6, 69, M_DEBUG)/* show TUN/TAP reads/writes */ -#define D_TAP_WIN32_DEBUG LOGLEV(6, 69, M_DEBUG)/* show TAP-Win32 driver debug info */ +#define D_TAP_WIN_DEBUG LOGLEV(6, 69, M_DEBUG)/* show TAP-Windows driver debug info */ #define D_CLIENT_NAT LOGLEV(6, 69, M_DEBUG)/* show client NAT debug info */ #define D_SHOW_KEYS LOGLEV(7, 70, M_DEBUG)/* show data channel encryption keys */ error.c +3
-3@@ -614,8 +614,8 @@ x_check_status (int status, } }#elif defined(WIN32) -/* get possible driver error from TAP-Win32 driver */ - extended_msg =tap_win32_getinfo (tt, &gc); +/* get possible driver error from TAP-Windows driver */ + extended_msg =tap_win_getinfo (tt, &gc);#endif if (!ignore_sys_error (my_errno)) {@@ -741,7 +741,7 @@ strerror_win32 (DWORD errnum, struct gc_arena *gc)#if 1 switch (errnum) {/* -* When the TAP-Win32 driver returns STATUS_UNSUCCESSFUL, this code +* When the TAP-Windows driver returns STATUS_UNSUCCESSFUL, this code * gets returned to user space. */ case ERROR_GEN_FAILURE :forward.c +1
-1@@ -1292,7 +1292,7 @@ pre_select (struct context *c) c->c2.timeval.tv_usec =0 ;#if defined(WIN32 ) -if (check_debug_level (D_TAP_WIN32_DEBUG )) +if (check_debug_level (D_TAP_WIN_DEBUG )) { c->c2.timeval.tv_sec =1 ;if (tuntap_defined (c->c1.tuntap))options.c +4
-4@@ -657,7 +657,7 @@ static const char usage_message[] ="Windows Specific:\n" "--win-sys path : Pathname of Windows system directory. Default is the pathname\n" " from SystemRoot environment variable.\n" -"--ip-win32 method : When using --ifconfig on Windows, set TAP-Win32 adapter\n" +"--ip-win32 method : When using --ifconfig on Windows, set TAP-Windows adapter\n" " IP address using method = manual, netsh, ipapi,\n" " dynamic, or adaptive (default = adaptive).\n" " Dynamic method allows two optional parameters:\n" @@ -673,7 +673,7 @@ static const char usage_message[] =" adaptive (default) -- Try ipapi then fall back to exe.\n" " ipapi -- Use IP helper API.\n" " exe -- Call the route.exe shell command.\n" -"--dhcp-option type [parm] : Set extended TAP-Win32 properties, must\n" +"--dhcp-option type [parm] : Set extended TAP-Windows properties, must\n" " be used with --ip-win32 dynamic. For options\n" " which allow multiple addresses,\n" " --dhcp-option must be repeated.\n" @@ -704,7 +704,7 @@ static const char usage_message[] =" after TAP adapter is up and routes have been added.\n" "Windows Standalone Options:\n" "\n" -"--show-adapters : Show all TAP-Win32 adapters.\n" +"--show-adapters : Show all TAP-Windows adapters.\n" "--show-net : Show " PACKAGE_NAME "'s view of routing table and net adapter list.\n" "--show-valid-subnets : Show valid subnets for --dev tun emulation.\n" "--allow-nonadmin [TAP-adapter] : Allow " PACKAGE_NAME " running without admin privileges\n" @@ -6046,7 +6046,7 @@ add_option (struct options *options,else if (streq (p[0 ],"show-adapters" )) {VERIFY_PERMISSION (OPT_P_GENERAL ); -show_tap_win32_adapters (M_INFO |M_NOPREFIX ,M_WARN |M_NOPREFIX ); +show_tap_win_adapters (M_INFO |M_NOPREFIX ,M_WARN |M_NOPREFIX );openvpn_exit (OPENVPN_EXIT_STATUS_GOOD );/* exit point */ }else if (streq (p[0 ],"show-net" ))service-win32/service.h +1
-1@@ -69,7 +69,7 @@ extern "C" {// displayed name of the service #define SZSERVICEDISPLAYNAME PACKAGE_NAME " Service"// list of service dependencies - "dep1\0dep2\0\0" -#define SZDEPENDENCIES TAP_ID "\0Dhcp\0\0" +#define SZDEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"////////////////////////////////////////////////////////////////////////////// sig.c +1
-1@@ -268,7 +268,7 @@ print_status (const struct context *c, struct status_output *so)#ifdef WIN32 if (tuntap_defined (c->c1.tuntap))status_printf (so,"TAP-WIN32 driver status,\"%s\"" , -tap_win32_getinfo (c->c1.tuntap, &gc)); +tap_win_getinfo (c->c1.tuntap, &gc));#endif status_printf (so,"END" );tap-windows.h +17
-17@@ -1,6 +1,6 @@/* -* TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap -* device functionality on Windows. +* TAP-Windows -- A kernel driver to provide virtual tap +* device functionality on Windows. * * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. * @@ -21,32 +21,32 @@* distribution); if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __TAP_H -#define __TAP_H +#ifndef __TAP_WIN_H +#define __TAP_WIN_H//============= // TAP IOCTLs //============= -#define TAP_CONTROL_CODE (request,method) \ +#define TAP_WIN_CONTROL_CODE (request,method) \ CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)// Present in 8.1 -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) +#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)// Added in 8.2 -/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */ -#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED) +/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */ +#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)//================= // Registry keys @@ -63,6 +63,6 @@#define USERMODEDEVICEDIR "\\\\.\\Global\\"#define SYSDEVICEDIR "\\Device\\"#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" +#define TAP_WIN_SUFFIX ".tap"#endif tun.c +71
-71@@ -1176,7 +1176,7 @@ do_ifconfig (struct tuntap *tt,break ;case IPW32_SET_NETSH :if (!strcmp (actual,"NULL" )) -msg (M_FATAL ,"Error: When using --ip-win32 netsh, if you have more than one TAP-Win32 adapter, you must also specify --dev-node" ); +msg (M_FATAL ,"Error: When using --ip-win32 netsh, if you have more than one TAP-Windows adapter, you must also specify --dev-node" ); netsh_ifconfig (&tt->options, actual,@@ -1195,7 +1195,7 @@ do_ifconfig (struct tuntap *tt,char * saved_actual;if (!strcmp (actual,"NULL" )) -msg (M_FATAL ,"Error: When using --tun-ipv6, if you have more than one TAP-Win32 adapter, you must also specify --dev-node" ); +msg (M_FATAL ,"Error: When using --tun-ipv6, if you have more than one TAP-Windows adapter, you must also specify --dev-node" );/* example: netsh interface ipv6 set address MyTap 2001:608:8003::d store=active */ argv_printf (&argv,@@ -2786,7 +2786,7 @@ get_tap_reg (struct gc_arena *gc)if (status ==ERROR_SUCCESS && data_type ==REG_SZ ) { -if (!strcmp (component_id,TAP_COMPONENT_ID )) +if (!strcmp (component_id,TAP_WIN_COMPONENT_ID )) {struct tap_reg *reg; ALLOC_OBJ_CLEAR_GC (reg, struct tap_reg, gc);@@ -2953,7 +2953,7 @@ void show_valid_win32_tun_subnets (void)int col =0 ;printf ("On Windows, point-to-point IP support (i.e. --dev tun)\n" ); -printf ("is emulated by the TAP-Win32 driver. The major limitation\n" ); +printf ("is emulated by the TAP-Windows driver. The major limitation\n" );printf ("imposed by this approach is that the --ifconfig local and\n" );printf ("remote endpoints must be part of the same 255.255.255.252\n" );printf ("subnet. The following list shows examples of endpoint\n" );@@ -2978,7 +2978,7 @@ void show_valid_win32_tun_subnets (void) }void -show_tap_win32_adapters (int msglev,int warnlev) +show_tap_win_adapters (int msglev,int warnlev) {struct gc_arena gc =gc_new ();@@ -2997,7 +2997,7 @@ show_tap_win32_adapters (int msglev, int warnlev)msg (msglev,"Available TAP-WIN32 adapters [name, GUID]:" ); -/* loop through each TAP-Win32 adapter registry entry */ +/* loop through each TAP-Windows adapter registry entry */ for (tr = tap_reg; tr !=NULL ; tr = tr->next) { links =0 ;@@ -3025,7 +3025,7 @@ show_tap_win32_adapters (int msglev, int warnlev) } } -/* check for TAP-Win32 adapter duplicated GUIDs */ +/* check for TAP-Windows adapter duplicated GUIDs */ for (tr = tap_reg; tr !=NULL ; tr = tr->next) {for (tr1 = tap_reg; tr1 !=NULL ; tr1 = tr1->next)@@ -3037,22 +3037,22 @@ show_tap_win32_adapters (int msglev, int warnlev)/* warn on registry inconsistencies */ if (warn_tap_dup) -msg (warnlev,"WARNING: Some TAP-Win32 adapters have duplicate GUIDs" ); +msg (warnlev,"WARNING: Some TAP-Windows adapters have duplicate GUIDs" );if (warn_panel_dup) -msg (warnlev,"WARNING: Some TAP-Win32 adapters have duplicate links from the Network Connections control panel" ); +msg (warnlev,"WARNING: Some TAP-Windows adapters have duplicate links from the Network Connections control panel" );if (warn_panel_null) -msg (warnlev,"WARNING: Some TAP-Win32 adapters have no link from the Network Connections control panel" ); +msg (warnlev,"WARNING: Some TAP-Windows adapters have no link from the Network Connections control panel" );gc_free (&gc); }/* -* Confirm that GUID is a TAP-Win32 adapter. +* Confirm that GUID is a TAP-Windows adapter. */ static bool -is_tap_win32 (const char *guid,const struct tap_reg *tap_reg) +is_tap_win (const char *guid,const struct tap_reg *tap_reg) {const struct tap_reg *tr;@@ -3086,7 +3086,7 @@ name_to_guid (const char *name, const struct tap_reg *tap_reg, const struct panefor (pr = panel_reg; pr !=NULL ; pr = pr->next) { -if (name && !strcmp (pr->name, name) &&is_tap_win32 (pr->guid, tap_reg)) +if (name && !strcmp (pr->name, name) &&is_tap_win (pr->guid, tap_reg))return pr->guid; }@@ -3094,10 +3094,10 @@ name_to_guid (const char *name, const struct tap_reg *tap_reg, const struct pane }static void -at_least_one_tap_win32 (const struct tap_reg *tap_reg) +at_least_one_tap_win (const struct tap_reg *tap_reg) {if (!tap_reg) -msg (M_FATAL ,"There are no TAP-Win32 adapters on this system. You should be able to create a TAP-Win32 adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Win32 virtual ethernet adapter." ); +msg (M_FATAL ,"There are no TAP-Windows adapters on this system. You should be able to create a TAP-Windows adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Windows virtual ethernet adapter." ); }/* @@ -3181,7 +3181,7 @@ get_device_guid (const char *name, }/* Check if GUID was explicitly specified as --dev-node parameter */ -if (is_tap_win32 (name, tap_reg)) +if (is_tap_win (name, tap_reg)) {const char *act =guid_to_name (name, panel_reg);buf_printf (&ret,"%s" , name);@@ -3767,7 +3767,7 @@ show_adapters (int msglev) }/* -* Set a particular TAP-Win32 adapter (or all of them if +* Set a particular TAP-Windows adapter (or all of them if * adapter_name == NULL) to allow it to be opened from * a non-admin account. This setting will only persist * for the lifetime of the device object. @@ -3789,7 +3789,7 @@ tap_allow_nonadmin_access_handle (const char *device_path, HANDLE hand) }else { -msg (M_INFO |M_NOPREFIX ,"TAP-Win32 device: %s [Non-admin access allowed]" , device_path); +msg (M_INFO |M_NOPREFIX ,"TAP-Windows device: %s [Non-admin access allowed]" , device_path); } }@@ -3804,7 +3804,7 @@ tap_allow_nonadmin_access (const char *dev_node)char actual_buffer[256 ];char device_path[256 ]; -at_least_one_tap_win32 (tap_reg); +at_least_one_tap_win (tap_reg);if (dev_node) {@@ -3812,13 +3812,13 @@ tap_allow_nonadmin_access (const char *dev_node) device_guid =get_device_guid (dev_node, actual_buffer,sizeof (actual_buffer), tap_reg, panel_reg, &gc);if (!device_guid) -msg (M_FATAL ,"TAP-Win32 adapter '%s' not found" , dev_node); +msg (M_FATAL ,"TAP-Windows adapter '%s' not found" , dev_node); -/* Open Windows TAP-Win32 adapter */ +/* Open Windows TAP-Windows adapter */ openvpn_snprintf (device_path,sizeof (device_path),"%s%s%s" ,USERMODEDEVICEDIR , device_guid, -TAPSUFFIX ); +TAP_WIN_SUFFIX ); hand = CreateFile ( device_path,@@ -3853,11 +3853,11 @@ tap_allow_nonadmin_access (const char *dev_node)if (!device_guid)break ; -/* Open Windows TAP-Win32 adapter */ +/* Open Windows TAP-Windows adapter */ openvpn_snprintf (device_path,sizeof (device_path),"%s%s%s" ,USERMODEDEVICEDIR , device_guid, -TAPSUFFIX ); +TAP_WIN_SUFFIX ); hand = CreateFile ( device_path,@@ -3902,7 +3902,7 @@ dhcp_release_by_adapter_index(const DWORD adapter_index) ret = true; }else -msg (M_WARN ,"NOTE: Release of DHCP-assigned IP address lease on TAP-Win32 adapter failed: %s (code=%u)" , +msg (M_WARN ,"NOTE: Release of DHCP-assigned IP address lease on TAP-Windows adapter failed: %s (code=%u)" ,strerror_win32 (status, &gc), (unsigned int )status); }@@ -3936,7 +3936,7 @@ dhcp_renew_by_adapter_index (const DWORD adapter_index) ret = true; }else -msg (M_WARN ,"WARNING: Failed to renew DHCP IP address lease on TAP-Win32 adapter: %s (code=%u)" , +msg (M_WARN ,"WARNING: Failed to renew DHCP IP address lease on TAP-Windows adapter: %s (code=%u)" ,strerror_win32 (status, &gc), (unsigned int )status); }@@ -4281,7 +4281,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)struct buffer actual =alloc_buf_gc (256 , gc);const char *guid; -at_least_one_tap_win32 (tap_reg); +at_least_one_tap_win (tap_reg);if (dev_node) {@@ -4291,7 +4291,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc) { guid =get_unspecified_device_guid (0 ,BPTR (&actual),BCAP (&actual), tap_reg, panel_reg, gc); -if (get_unspecified_device_guid (1 ,NULL ,0 , tap_reg, panel_reg, gc))/* ambiguous if more than one TAP-Win32 adapter */ +if (get_unspecified_device_guid (1 ,NULL ,0 , tap_reg, panel_reg, gc))/* ambiguous if more than one TAP-Windows adapter */ guid =NULL ; }@@ -4304,7 +4304,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc) }/* -* Called iteratively on TAP-Win32 wait-for-initialization polling loop +* Called iteratively on TAP-Windows wait-for-initialization polling loop */ void tun_standby_init (struct tuntap *tt)@@ -4535,7 +4535,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuconst struct panel_reg *panel_reg =get_panel_reg (&gc);char actual_buffer[256 ]; -at_least_one_tap_win32 (tap_reg); +at_least_one_tap_win (tap_reg);if (dev_node) {@@ -4543,13 +4543,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu device_guid =get_device_guid (dev_node, actual_buffer,sizeof (actual_buffer), tap_reg, panel_reg, &gc);if (!device_guid) -msg (M_FATAL ,"TAP-Win32 adapter '%s' not found" , dev_node); +msg (M_FATAL ,"TAP-Windows adapter '%s' not found" , dev_node); -/* Open Windows TAP-Win32 adapter */ +/* Open Windows TAP-Windows adapter */ openvpn_snprintf (device_path,sizeof (device_path),"%s%s%s" ,USERMODEDEVICEDIR , device_guid, -TAPSUFFIX ); +TAP_WIN_SUFFIX ); tt->hand = CreateFile ( device_path,@@ -4579,13 +4579,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu &gc);if (!device_guid) -msg (M_FATAL ,"All TAP-Win32 adapters on this system are currently in use." ); +msg (M_FATAL ,"All TAP-Windows adapters on this system are currently in use." ); -/* Open Windows TAP-Win32 adapter */ +/* Open Windows TAP-Windows adapter */ openvpn_snprintf (device_path,sizeof (device_path),"%s%s%s" ,USERMODEDEVICEDIR , device_guid, -TAPSUFFIX ); +TAP_WIN_SUFFIX ); tt->hand = CreateFile ( device_path,@@ -4618,20 +4618,20 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu {ULONG info[3 ];CLEAR (info); -if (DeviceIoControl (tt->hand,TAP_IOCTL_GET_VERSION , +if (DeviceIoControl (tt->hand,TAP_WIN_IOCTL_GET_VERSION , &info,sizeof (info), &info,sizeof (info), &len,NULL )) { -msg (D_TUNTAP_INFO ,"TAP-Win32 Driver Version %d.%d %s" , +msg (D_TUNTAP_INFO ,"TAP-Windows Driver Version %d.%d %s" , (int ) info[0 ], (int ) info[1 ], (info[2 ] ?"(DEBUG)" :"" )); } -if (!(info[0 ] ==TAP_WIN32_MIN_MAJOR && info[1 ] >=TAP_WIN32_MIN_MINOR )) -msg (M_FATAL ,"ERROR: This version of " PACKAGE_NAME " requires a TAP-Win32 driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver." , -TAP_WIN32_MIN_MAJOR , -TAP_WIN32_MIN_MINOR ); +if (!(info[0 ] ==TAP_WIN_MIN_MAJOR && info[1 ] >=TAP_WIN_MIN_MINOR )) +msg (M_FATAL ,"ERROR: This version of " PACKAGE_NAME " requires a TAP-Windows driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver." , +TAP_WIN_MIN_MAJOR , +TAP_WIN_MIN_MINOR );/* usage of numeric constants is ugly, but this is really tied to * *this* version of the driver @@ -4655,17 +4655,17 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu/* get driver MTU */ {ULONG mtu; -if (DeviceIoControl (tt->hand,TAP_IOCTL_GET_MTU , +if (DeviceIoControl (tt->hand,TAP_WIN_IOCTL_GET_MTU , &mtu,sizeof (mtu), &mtu,sizeof (mtu), &len,NULL )) { tt->post_open_mtu = (int ) mtu; -msg (D_MTU_INFO ,"TAP-Win32 MTU=%d" , (int ) mtu); +msg (D_MTU_INFO ,"TAP-Windows MTU=%d" , (int ) mtu); } }/* -* Preliminaries for setting TAP-Win32 adapter TCP/IP +* Preliminaries for setting TAP-Windows adapter TCP/IP * properties via --ip-win32 dynamic or --ip-win32 adaptive. */ if (tt->did_ifconfig_setup)@@ -4718,11 +4718,11 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu ep[1 ] =htonl (tt->local & tt->remote_netmask); ep[2 ] =htonl (tt->remote_netmask); - status =DeviceIoControl (tt->hand,TAP_IOCTL_CONFIG_TUN , + status =DeviceIoControl (tt->hand,TAP_WIN_IOCTL_CONFIG_TUN , ep,sizeof (ep), ep,sizeof (ep), &len,NULL ); - msg (status ? M_INFO : M_FATAL, "Set TAP-Win32 TUN subnet mode network/local/netmask = %s/%s/%s [%s]", + msg (status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet mode network/local/netmask = %s/%s/%s [%s]", print_in_addr_t (ep[1], IA_NET_ORDER, &gc), print_in_addr_t (ep[0], IA_NET_ORDER, &gc), print_in_addr_t (ep[2], IA_NET_ORDER, &gc),@@ -4734,14 +4734,14 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu ep[0 ] =htonl (tt->local); ep[1 ] =htonl (tt->remote_netmask); -if (!DeviceIoControl (tt->hand,TAP_IOCTL_CONFIG_POINT_TO_POINT , +if (!DeviceIoControl (tt->hand,TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT , ep,sizeof (ep), ep,sizeof (ep), &len,NULL )) -msg (M_FATAL ,"ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun" ); +msg (M_FATAL ,"ERROR: The TAP-Windows driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun" ); } } -/* should we tell the TAP-Win32 driver to masquerade as a DHCP server as a means +/* should we tell the TAP-Windows driver to masquerade as a DHCP server as a means of setting the adapter address? */ if (dhcp_masq) {@@ -4776,12 +4776,12 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuASSERT (ep[3 ] >0 );#ifndef SIMULATE_DHCP_FAILED /* this code is disabled to simulate bad DHCP negotiation */ -if (!DeviceIoControl (tt->hand,TAP_IOCTL_CONFIG_DHCP_MASQ , +if (!DeviceIoControl (tt->hand,TAP_WIN_IOCTL_CONFIG_DHCP_MASQ , ep,sizeof (ep), ep,sizeof (ep), &len,NULL )) -msg (M_FATAL ,"ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set TAP_IOCTL_CONFIG_DHCP_MASQ mode" ); +msg (M_FATAL ,"ERROR: The TAP-Windows driver rejected a DeviceIoControl call to set TAP_WIN_IOCTL_CONFIG_DHCP_MASQ mode" ); - msg (M_INFO, "Notified TAP-Win32 driver to set a DHCP IP/netmask of %s/%s on interface %s [DHCP-serv: %s, lease-time: %d]", + msg (M_INFO, "Notified TAP-Windows driver to set a DHCP IP/netmask of %s/%s on interface %s [DHCP-serv: %s, lease-time: %d]", print_in_addr_t (tt->local, 0, &gc), print_in_addr_t (tt->adapter_netmask, 0, &gc), device_guid,@@ -4796,10 +4796,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuif (build_dhcp_options_string (&buf, &tt->options)) {msg (D_DHCP_OPT ,"DHCP option string: %s" ,format_hex (BPTR (&buf),BLEN (&buf),0 , &gc)); -if (!DeviceIoControl (tt->hand,TAP_IOCTL_CONFIG_DHCP_SET_OPT , +if (!DeviceIoControl (tt->hand,TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT ,BPTR (&buf),BLEN (&buf),BPTR (&buf),BLEN (&buf), &len,NULL )) -msg (M_FATAL ,"ERROR: The TAP-Win32 driver rejected a TAP_IOCTL_CONFIG_DHCP_SET_OPT DeviceIoControl call" ); +msg (M_FATAL ,"ERROR: The TAP-Windows driver rejected a TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT DeviceIoControl call" ); }else msg (M_WARN ,"DHCP option string not set due to error" );@@ -4811,10 +4811,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu/* set driver media status to 'connected' */ {ULONG status = TRUE; -if (!DeviceIoControl (tt->hand,TAP_IOCTL_SET_MEDIA_STATUS , +if (!DeviceIoControl (tt->hand,TAP_WIN_IOCTL_SET_MEDIA_STATUS , &status,sizeof (status), &status,sizeof (status), &len,NULL )) -msg (M_WARN ,"WARNING: The TAP-Win32 driver rejected a TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call." ); +msg (M_WARN ,"WARNING: The TAP-Windows driver rejected a TAP_WIN_IOCTL_SET_MEDIA_STATUS DeviceIoControl call." ); }/* possible wait for adapter to come up */ @@ -4849,7 +4849,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu }/* -* If the TAP-Win32 driver is masquerading as a DHCP server +* If the TAP-Windows driver is masquerading as a DHCP server * make sure the TCP/IP properties for the adapter are * set correctly. */ @@ -4857,7 +4857,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu {/* check dhcp enable status */ if (dhcp_status (index) ==DHCP_STATUS_DISABLED ) -msg (M_WARN ,"WARNING: You have selected '--ip-win32 dynamic', which will not work unless the TAP-Win32 TCP/IP properties are set to 'Obtain an IP address automatically'" ); +msg (M_WARN ,"WARNING: You have selected '--ip-win32 dynamic', which will not work unless the TAP-Windows TCP/IP properties are set to 'Obtain an IP address automatically'" );/* force an explicit DHCP lease renewal on TAP adapter? */ if (tt->options.dhcp_pre_release)@@ -4883,7 +4883,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu/* check dhcp enable status */ if (dhcp_status (index) ==DHCP_STATUS_DISABLED ) -msg (M_WARN ,"NOTE: You have selected (explicitly or by default) '--ip-win32 ipapi', which has a better chance of working correctly if the TAP-Win32 TCP/IP properties are set to 'Obtain an IP address automatically'" ); +msg (M_WARN ,"NOTE: You have selected (explicitly or by default) '--ip-win32 ipapi', which has a better chance of working correctly if the TAP-Windows TCP/IP properties are set to 'Obtain an IP address automatically'" );/* delete previously added IP addresses which were not correctly deleted */ @@ -4917,13 +4917,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu }const char * -tap_win32_getinfo (const struct tuntap *tt,struct gc_arena *gc) +tap_win_getinfo (const struct tuntap *tt,struct gc_arena *gc) {if (tt && tt->hand !=NULL ) {struct buffer out =alloc_buf_gc (256 , gc);DWORD len; -if (DeviceIoControl (tt->hand,TAP_IOCTL_GET_INFO , +if (DeviceIoControl (tt->hand,TAP_WIN_IOCTL_GET_INFO ,BSTR (&out),BCAP (&out),BSTR (&out),BCAP (&out), &len,NULL ))@@ -4941,12 +4941,12 @@ tun_show_debug (struct tuntap *tt) {struct buffer out =alloc_buf (1024 );DWORD len; -while (DeviceIoControl (tt->hand,TAP_IOCTL_GET_LOG_LINE , +while (DeviceIoControl (tt->hand,TAP_WIN_IOCTL_GET_LOG_LINE ,BSTR (&out),BCAP (&out),BSTR (&out),BCAP (&out), &len,NULL )) { -msg (D_TAP_WIN32_DEBUG ,"TAP-Win32: %s" ,BSTR (&out)); +msg (D_TAP_WIN_DEBUG ,"TAP-Windows: %s" ,BSTR (&out)); }free_buf (&out); }@@ -4986,7 +4986,7 @@ close_tun (struct tuntap *tt)DWORD status;if ((status =DeleteIPAddress (tt->ipapi_context)) !=NO_ERROR ) { -msg (M_WARN ,"Warning: DeleteIPAddress[%u] failed on TAP-Win32 adapter, status=%u : %s" , +msg (M_WARN ,"Warning: DeleteIPAddress[%u] failed on TAP-Windows adapter, status=%u : %s" , (unsigned int )tt->ipapi_context, (unsigned int )status,strerror_win32 (status, &gc));@@ -4999,22 +4999,22 @@ close_tun (struct tuntap *tt)if (tt->hand !=NULL ) { -dmsg (D_WIN32_IO_LOW ,"Attempting CancelIO on TAP-Win32 adapter" ); +dmsg (D_WIN32_IO_LOW ,"Attempting CancelIO on TAP-Windows adapter" );if (!CancelIo (tt->hand)) -msg (M_WARN |M_ERRNO ,"Warning: CancelIO failed on TAP-Win32 adapter" ); +msg (M_WARN |M_ERRNO ,"Warning: CancelIO failed on TAP-Windows adapter" ); } -dmsg (D_WIN32_IO_LOW ,"Attempting close of overlapped read event on TAP-Win32 adapter" ); +dmsg (D_WIN32_IO_LOW ,"Attempting close of overlapped read event on TAP-Windows adapter" );overlapped_io_close (&tt->reads); -dmsg (D_WIN32_IO_LOW ,"Attempting close of overlapped write event on TAP-Win32 adapter" ); +dmsg (D_WIN32_IO_LOW ,"Attempting close of overlapped write event on TAP-Windows adapter" );overlapped_io_close (&tt->writes);if (tt->hand !=NULL ) { -dmsg (D_WIN32_IO_LOW ,"Attempting CloseHandle on TAP-Win32 adapter" ); +dmsg (D_WIN32_IO_LOW ,"Attempting CloseHandle on TAP-Windows adapter" );if (!CloseHandle (tt->hand)) -msg (M_WARN |M_ERRNO ,"Warning: CloseHandle failed on TAP-Win32 adapter" ); +msg (M_WARN |M_ERRNO ,"Warning: CloseHandle failed on TAP-Windows adapter" ); }if (tt->actual_name)tun.h +3
-3@@ -164,7 +164,7 @@ struct tuntapULONG ipapi_instance;in_addr_t adapter_netmask; -/* Windows adapter index for TAP-Win32 adapter, +/* Windows adapter index for TAP-Windows adapter, ~0 if undefined */ DWORD adapter_index;@@ -333,13 +333,13 @@ DWORD adapter_index_of_ip (const IP_ADAPTER_INFO *list,int *count, in_addr_t *netmask); -void show_tap_win32_adapters (int msglev,int warnlev); +void show_tap_win_adapters (int msglev,int warnlev);void show_adapters (int msglev);void tap_allow_nonadmin_access (const char *dev_node);void show_valid_win32_tun_subnets (void ); -const char *tap_win32_getinfo (const struct tuntap *tt,struct gc_arena *gc); +const char *tap_win_getinfo (const struct tuntap *tt,struct gc_arena *gc);void tun_show_debug (struct tuntap *tt);bool dhcp_release_by_adapter_index (const DWORD adapter_index);version.m4 +3
-3@@ -1,6 +1,6 @@ dnl define the OpenVPN version define(PRODUCT_VERSION,[2.3_alpha1]) dnl define the TAP version -define(PRODUCT_TAP_ID,[tap0901]) -define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9]) -define(PRODUCT_TAP_WIN32_MIN_MINOR,[9]) +define(PRODUCT_TAP_WIN_COMPONENT_ID,[tap0901]) +define(PRODUCT_TAP_WIN_MIN_MAJOR,[9]) +define(PRODUCT_TAP_WIN_MIN_MINOR,[9])win/autodefs.h.in +3
-3@@ -6,9 +6,9 @@ * * The TAP-Win32 version number is defined in tap-win32/SOURCES */ -#define TAP_COMPONENT_ID "@PRODUCT_TAP_ID@" -#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ -#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ +#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@" +#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@ +#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@ /* Friendly name for TAP driver */ #define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"win/openvpn.nsi +4
-5@@ -44,7 +44,7 @@ SetCompressor lzma !define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}" -!define TAP "${PRODUCT_TAP_ID}" +!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}" !define TAPDRV "${TAP}.sys" ; Default service settings@@ -409,7 +409,7 @@ Section "TAP Virtual Ethernet Adapter" SecTAP File "${GEN}\amd64\${TAPDRV}" # Don't try to install TAP driver signature if it does not exist. - File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_ID}.cat" + File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat" goto tapend@@ -425,7 +425,7 @@ tap-32bit: File "${GEN}\i386\${TAPDRV}" # Don't try to install TAP driver signature if it does not exist. - File /nonfatal "${GEN}\i386\${PRODUCT_TAP_ID}.cat" + File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat" tapend:@@ -778,7 +778,7 @@ Section "Uninstall" Delete "$INSTDIR\log\README.txt" Delete "$INSTDIR\driver\OemWin2k.inf" - Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat" + Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat" Delete "$INSTDIR\driver\${TAPDRV}" Delete "$INSTDIR\bin\openssl.exe" --1.7.3.4
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH 21/52 build: remove windows specific build system
In reply to Alon Bar-LevIt will be completely re-written in future
--- Makefile.am | 8 +- doclean | 73 ----- domake-win | 138 -------- msvc/autodefs.h.in | 20 -- msvc/config.py | 93 ------ msvc/msvc.mak | 52 --- service-win32/msvc.mak | 30 -- win/autodefs.h.in | 31 -- win/build.py | 23 -- win/build_all.py | 69 ---- win/build_ddk.py | 55 ---- win/build_exe.py | 15 - win/config.h.in | 363 --------------------- win/config.py | 21 -- win/config_all.py | 13 - win/config_tap.py | 35 -- win/config_ti.py | 18 - win/js.py | 10 - win/make_dist.py | 107 ------- win/msvc.mak.in | 69 ---- win/openvpn.nsi | 822 ------------------------------------------------ win/setpath.nsi | 231 -------------- win/settings.in | 100 ------ win/show.py | 9 - win/sign.py | 23 -- win/tap_span.py | 129 -------- win/wb.py | 322 ------------------- 27 files changed, 2 insertions(+), 2877 deletions(-) delete mode 100755 doclean delete mode 100644 domake-win delete mode 100644 msvc/autodefs.h.in delete mode 100644 msvc/config.py delete mode 100644 msvc/msvc.mak delete mode 100644 service-win32/msvc.mak delete mode 100644 win/__init__.py delete mode 100644 win/autodefs.h.in delete mode 100644 win/build.py delete mode 100644 win/build_all.py delete mode 100644 win/build_ddk.py delete mode 100644 win/build_exe.py delete mode 100644 win/config.h.in delete mode 100644 win/config.py delete mode 100644 win/config_all.py delete mode 100644 win/config_tap.py delete mode 100644 win/config_ti.py delete mode 100644 win/js.py delete mode 100644 win/make_dist.py delete mode 100644 win/msvc.mak.in delete mode 100755 win/openvpn.nsi delete mode 100755 win/setpath.nsi delete mode 100644 win/settings.in delete mode 100644 win/show.py delete mode 100644 win/sign.py delete mode 100644 win/tap_span.py delete mode 100644 win/wb.py
Makefile.am +2 -6
@@ -46,8 +46,7 @@ EXTRA_DIST = \ suse \ contrib \ debug \ - plugins \ - win + plugins SUBDIRS = service-win32
@@ -59,8 +58,6 @@ dist_doc_DATA = \ dist_noinst_SCRIPTS = \ $(TESTS) \ - doclean \ - domake-win \ t_cltsrv-down.sh \ configure_h.awk configure_log.awk
@@ -68,8 +65,7 @@ dist_noinst_DATA = \ openvpn.spec \ COPYRIGHT.GPL \ PORTS \ - INSTALL-win32.txt \ - service-win32/msvc.mak + INSTALL-win32.txt openvpn_SOURCES = \ base64.c base64.h \
doclean deleted +0 -73
73 lines not on this page · raw message
domake-win deleted +0 -138
138 lines not on this page · raw message
msvc/autodefs.h.in deleted +0 -20
@@ -1,20 +0,0 @@ -/* - * Minimum TAP-Win32 version number expected by userspace - * - * The TAP-Win32 version number is defined in tap-win32/SOURCES - */ -#define TAP_ID "@PRODUCT_TAP_ID@" -#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ -#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ - -/* Name of package */ -#define PACKAGE "@PRODUCT_UNIX_NAME@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PRODUCT_NAME@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PRODUCT_VERSION@"
msvc/config.py deleted +0 -93
93 lines not on this page · raw message
msvc/msvc.mak deleted +0 -52
52 lines not on this page · raw message
service-win32/msvc.mak deleted +0 -30
@@ -1,30 +0,0 @@ -# This makefile builds the OpenVPN service wrapper for Windows in the -# Visual Studio 2008 environment. - -# Some of these libs may not be needed -LIBS = ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib -EXE = openvpnserv.exe - -CPP=cl.exe -CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE /FD /c -I".." -CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG - -LINK32=link.exe -LINK32_FLAGS=/nologo /subsystem:console /incremental:no - -OBJS = \ - openvpnserv.obj \ - service.obj - -openvpnserv : $(OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) "/out:$(EXE)" $(LIBS) $(OBJS) -<< - -clean : - del /Q $(OBJS) $(EXE) *.idb *.pdb - -.c.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<<
win/__init__.py deleted +0 -0
win/autodefs.h.in deleted +0 -31
@@ -1,31 +0,0 @@ -#ifndef AUTODEFS_H -#define AUTODEFS_H - -/* - * Minimum TAP-Win32 version number expected by userspace - * - * The TAP-Win32 version number is defined in tap-win32/SOURCES - */ -#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@" -#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@ -#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@ - -/* Friendly name for TAP driver */ -#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@" - -/* Version number of DDK/WDK used to build TAP driver */ -#define DDKVER_MAJOR @DDKVER_MAJOR@ - -/* Name of package */ -#define PACKAGE "@PRODUCT_UNIX_NAME@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PRODUCT_NAME@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PRODUCT_VERSION@" - -#endif
win/build.py deleted +0 -23
@@ -1,23 +0,0 @@ -import os, sys -from wb import system, config, home_fn, cd_home, cd_service_win32, run_in_vs_shell - -def main(): - """Build openvpn.exe and openvpnserv.exe""" - cd_home() - run_in_vs_shell("nmake /f %s" % (home_fn('msvc.mak'),)) - cd_service_win32() - run_in_vs_shell("nmake /f %s" % ('msvc.mak')) - -def clean(): - """Clean up after openvpn.exe and openvpnserv.exe build""" - cd_home() - run_in_vs_shell("nmake /f %s clean" % (home_fn('msvc.mak'),)) - os.chdir("service-win32") - run_in_vs_shell("nmake /f %s clean" % ('msvc.mak')) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - if len(sys.argv) == 2 and sys.argv[1] == 'clean': - clean() - else: - main()
win/build_all.py deleted +0 -69
69 lines not on this page · raw message
win/build_ddk.py deleted +0 -55
55 lines not on this page · raw message
win/build_exe.py deleted +0 -15
@@ -1,15 +0,0 @@ -from config import main as config_main -from build import main as build_openvpn -from build_ddk import main as build_ddk -from sign import main as sign -from make_dist import main as make_dist - -def main(config): - config_main(config) - build_openvpn() - make_dist(config, tap=False) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)
win/config.h.in deleted +0 -363
363 lines not on this page · raw message
win/config.py deleted +0 -21
@@ -1,21 +0,0 @@ -from wb import preprocess, autogen, mod_fn, home_fn, build_config_h, build_configure_h, build_version_m4_vars, build_autodefs, make_headers_objs, dict_def - -def main(config): - build_config_h(config) - build_configure_h(config, mod_fn(home_fn('configure.h')), head_comment='/* %s */\n\n' % autogen) - build_version_m4_vars(mod_fn(mod_fn('version_m4_vars.tmp')), head_comment='/* %s */\n\n' % autogen) - build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h')) - ho = make_headers_objs(home_fn('Makefile.am')) - - preprocess(dict_def(config, [('HEADERS_OBJS', ho)]), - in_fn=mod_fn('msvc.mak.in'), - out_fn=home_fn('msvc.mak'), - quote_begin='@', - quote_end='@', - if_prefix='!', - head_comment='# %s\n\n' % autogen) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)
win/config_all.py deleted +0 -13
@@ -1,13 +0,0 @@ -from config import main as config_main -from config_tap import main as config_tap -from config_ti import main as config_ti - -def main(config): - config_main(config) - config_tap(config) - config_ti(config) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)
win/config_tap.py deleted +0 -35
@@ -1,35 +0,0 @@ -import os -from wb import preprocess, home_fn, autogen, dict_def - -def main(config): - preprocess(config, - in_fn=home_fn('tap-win32/SOURCES.in'), - out_fn=home_fn('tap-win32/SOURCES'), - quote_begin='@@', - quote_end='@@', - head_comment='# %s\n\n' % autogen) - - preprocess(config, - in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), - out_fn=home_fn('tap-win32/i386/OemWin2k.inf'), - quote_begin='@@', - quote_end='@@', - if_prefix='!', - head_comment='; %s\n\n' % autogen) - - try: - os.mkdir(home_fn('tap-win32/amd64')) - except: - pass - preprocess(dict_def(config, [('AMD64', '1')]), - in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), - out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'), - quote_begin='@@', - quote_end='@@', - if_prefix='!', - head_comment='; %s\n\n' % autogen) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)
win/config_ti.py deleted +0 -18
@@ -1,18 +0,0 @@ -import os, shutil -from wb import preprocess, home_fn, autogen - -def main(config): - src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR']) - dest = home_fn('tapinstall') - shutil.rmtree(dest, ignore_errors=True) - shutil.copytree(src, dest) - preprocess(config, - in_fn=os.path.join(src, 'sources'), - out_fn=os.path.join(dest, 'sources'), - if_prefix='!', - head_comment='# %s\n\n' % autogen) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)
win/js.py deleted +0 -10
@@ -1,10 +0,0 @@ -import json - -# usage: -# print JSON().encode(kv) - -class JSON(json.JSONEncoder): - def __init__(self, **kwargs): - args = dict(sort_keys=True, indent=2) - args.update(kwargs) - json.JSONEncoder.__init__(self, **args)
win/make_dist.py deleted +0 -107
107 lines not on this page · raw message
win/msvc.mak.in deleted +0 -69
69 lines not on this page · raw message
win/openvpn.nsi deleted +0 -822
822 lines not on this page · raw message
win/setpath.nsi deleted +0 -231
231 lines not on this page · raw message
win/settings.in deleted +0 -100
100 lines not on this page · raw message
win/show.py deleted +0 -9
@@ -1,9 +0,0 @@ -from wb import get_config -from js import JSON - -def main(): - print JSON().encode(get_config()) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - main()
win/sign.py deleted +0 -23
@@ -1,23 +0,0 @@ -import sys -from wb import config, choose_arch, home_fn - -if 'SIGNTOOL' in config: - sys.path.append(home_fn(config['SIGNTOOL'])) - -def main(conf, arch, tap_dir): - from signtool import SignTool - st = SignTool(conf, tap_dir) - for x64 in choose_arch(arch): - st.sign_verify(x64=x64) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - if len(sys.argv) >= 2: - if len(sys.argv) >= 3: - tap_dir = home_fn(sys.argv[2]) - else: - tap_dir = None - main(config, sys.argv[1], tap_dir) - else: - print "usage: sign <x64|x86|all> [tap-dir]" - sys.exit(2)
win/tap_span.py deleted +0 -129
129 lines not on this page · raw message
win/wb.py deleted +0 -322
322 lines not on this page · raw message
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 21/52] build: remove windows specific build system
There goes all the sweat and tears I poured onto that buildsystem :).
I say let it burn. ACK.
Samuli
Quoted 3,136 lines
It will be completely re-written in future
Signed-off-by Alon Bar-Lev <[email protected]...>--- Makefile.am | 8 +- doclean | 73 ----- domake-win | 138 -------- msvc/autodefs.h.in | 20 -- msvc/config.py | 93 ------ msvc/msvc.mak | 52 --- service-win32/msvc.mak | 30 -- win/autodefs.h.in | 31 -- win/build.py | 23 -- win/build_all.py | 69 ---- win/build_ddk.py | 55 ---- win/build_exe.py | 15 - win/config.h.in | 363 --------------------- win/config.py | 21 -- win/config_all.py | 13 - win/config_tap.py | 35 -- win/config_ti.py | 18 - win/js.py | 10 - win/make_dist.py | 107 ------- win/msvc.mak.in | 69 ---- win/openvpn.nsi | 822 ------------------------------------------------ win/setpath.nsi | 231 -------------- win/settings.in | 100 ------ win/show.py | 9 - win/sign.py | 23 -- win/tap_span.py | 129 -------- win/wb.py | 322 ------------------- 27 files changed, 2 insertions(+), 2877 deletions(-) delete mode 100755 doclean delete mode 100644 domake-win delete mode 100644 msvc/autodefs.h.in delete mode 100644 msvc/config.py delete mode 100644 msvc/msvc.mak delete mode 100644 service-win32/msvc.mak delete mode 100644 win/__init__.py delete mode 100644 win/autodefs.h.in delete mode 100644 win/build.py delete mode 100644 win/build_all.py delete mode 100644 win/build_ddk.py delete mode 100644 win/build_exe.py delete mode 100644 win/config.h.in delete mode 100644 win/config.py delete mode 100644 win/config_all.py delete mode 100644 win/config_tap.py delete mode 100644 win/config_ti.py delete mode 100644 win/js.py delete mode 100644 win/make_dist.py delete mode 100644 win/msvc.mak.in delete mode 100755 win/openvpn.nsi delete mode 100755 win/setpath.nsi delete mode 100644 win/settings.in delete mode 100644 win/show.py delete mode 100644 win/sign.py delete mode 100644 win/tap_span.py delete mode 100644 win/wb.pyMakefile.am +2
-6@@ -46,8 +46,7 @@ EXTRA_DIST = \ suse \ contrib \ debug \ - plugins \ - win + plugins SUBDIRS = service-win32@@ -59,8 +58,6 @@ dist_doc_DATA = \ dist_noinst_SCRIPTS = \ $(TESTS) \ - doclean \ - domake-win \ t_cltsrv-down.sh \ configure_h.awk configure_log.awk@@ -68,8 +65,7 @@ dist_noinst_DATA = \ openvpn.spec \ COPYRIGHT.GPL \ PORTS \ - INSTALL-win32.txt \ - service-win32/msvc.mak + INSTALL-win32.txt openvpn_SOURCES = \ base64.c base64.h \doclean deleted +0
-73@@ -1,73 +0,0 @@ -#!/bin/sh - -# Let's have a fresh start. Remove all -# generated files. -# -# Run this script, then: -# autoreconf -i -v -# ./configure -# make -# make install - -if ! [ "$KEEPAUTODEFS" = "yes" ]; then - rm -rf autodefs -fi - -rm -f \ - *.o \ - service-win32/*.o \ - service-win32/*.exe \ - *.exe \ - openvpn \ - config.cache \ - configure \ - Makefile \ - Makefile.in \ - stamp-h* \ - config.guess \ - config.sub \ - depcomp \ - missing \ - mkinstalldirs \ - config.log \ - config.status \ - config.h \ - config.h.in \ - aclocal.m4 \ - openvpn.spec \ - install-sh \ - openvpn.8.html \ - install-win32/*.exe \ - install-win32/makensis.log \ - install-win32/settings \ - install-win32/Makefile \ - install-win32/Makefile.in \ - images/Makefile \ - images/Makefile.in \ - service-win32/Makefile \ - service-win32/Makefile.in - -rm -rf \ - autom4te*.cache \ - .deps \ - */.deps \ - windest \ - gen \ - tapinstall \ - install-win32/tmp - -rm -rf \ - tap-win32/objfre_w2k_x86 \ - tap-win32/dist \ - tap-win32/SOURCES \ - tap-win32/tapdrvr.cod \ - tap-win32/buildfre_wnet_amd64.wrn \ - tap-win32/buildfre_w2k_x86.wrn \ - tap-win32/objfre_wnet_amd64 \ - tap-win32/buildfre_wnet_amd64.log \ - tap-win32/buildfre_w2k_x86.log \ - tap-win32/amd64 \ - tap-win32/i386/tap0901.pdb \ - tap-win32/i386/OemWin2k.inf \ - tap-win32/i386/tap0901.map \ - tap-win32/i386/tap0901.sysdomake-win deleted +0
-138@@ -1,138 +0,0 @@ -#!/bin/sh - -# This is the master OpenVPN build script for Windows. -# This script will build OpenVPN, the TAP driver, and -# the installer from source, targeting x86 on Windows -# 2000 and higher, and x64 on Windows 2003 and higher. -# For quick start options, see pre-built notes below. -# -# Note that if you are only looking to build the -# openvpn user-space binaries (openvpn.exe -# and openvpnserv.exe) you can use the -# provided autoconf/automake build environment. -# -# If you are building from an expanded .tar.gz file, -# make sure to run "./doclean" before "./domake-win". -# -# See top-level build configuration and settings in: -# -# version.m4 -# install-win32/settings.in -# -# Mandatory prerequisites: -# -# MinGW -- for GNU C compiler -# MSYS -- for bash -# msysDTK -- for perl -# NSIS -- for building installer -# -# The following additional prerequisites may be omitted -# when building in pre-built mode (see note below). -# -# svn -- for checking out source code (or TortoiseSVN) -# Windows Driver Kit (6001_17121_HyperV_WDK.iso) -- for building -# TAP driver + tapinstall -# -# Required libraries (must be prebuilt) -# -# OpenSSL -- define OPENSSL_DIR in settings.in -# LZO -- define LZO_DIR in settings.in -# PKCS11-HELPER -- define PKCS11_HELPER_DIR -# -# Optional OpenVPN GUI binary (prebuilt) -# -- define OPENVPN_GUI_DIR and OPENVPN_GUI in settings.in -# -# Required source code not included in OpenVPN SVN repository -# because of MS licensing restrictions: -# -# ../tapinstall -- This is based on 'devcon' which is found in the -# Windows Driver Kit (formerly known as DDK). -# Copy the 'devcon' source tree to ../tapinstall -# Edit 'sources' and modify TARGETNAME=tapinstall - -# Note that all variables referenced here such as GENOUT, -# GENOUT_PREBUILT, and CLEAN are defined in install-win32/settings.in - -# SPECIAL NOTES ON PRE-BUILT MODE -# Setting up a complete tool chain to build OpenVPN and all -# dependencies on Windows can be an onerous task, so the capability -# is provided to reference a directory of pre-built components during -# the build process. When dependencies are missing to build a given -# component (such as the TAP driver), the build script will auto-detect -# this and use the pre-built version instead. This would allow you, for -# example, to build an OpenVPN installer with custom edits to -# install-win32/settings.in, but then avoid needing to build all other -# components (such as OpenSSL, LZO, Pkcs11-helper, TAP driver, Windows -# service, etc.). The procedure is as follows. First Download and expand -# the pre-built binaries from: -# -# http://openvpn.net/prebuilt/ (choose the most recent -prebuilt .tbz file) -# -# After expanding the .tbz file, cd to the top level directory and -# expand an OpenVPN source distribution taken from either the subversion -# repository or a source .tar.gz file. It's best to use an OpenVPN source -# version that is the same or slightly later than the pre-built binaries -# file. So now you have a directory containing something that looks like -# this: -# -# gen-prebuilt -> from prebuilt .tbz file -# lzo-2.02 -> from prebuilt .tbz file -# openssl-0.9.8i -> from prebuilt .tbz file -# pkcs11-helper -> from prebuilt .tbz file -# openvpn-2.1_rc13.tar.gz -> downloaded from openvpn.net -# openvpn-2.1_rc13 -> directory expanded from above file -# -# Now cd to your expanded source tree (openvpn-2.1_rc13 in the -# example above), make edits to install-win32/settings.in (or even -# patch the OpenVPN source code directly), and run this script: -# -# ./domake-win -# -# If everything runs correctly, you should have a custom installer -# written to ./gen/install - -# First build the autodefs directory, containing C, sh, and NSIS versions -# of global settings, using install-win32/settings.in as source. -# These settings will then drive the rest of the build process. -install-win32/winconfig - -# clean all generated files -install-win32/doclean - -# Load a pre-built GENOUT directory if GENOUT_PREBUILT is defined -# and the GENOUT directory is non-existing -install-win32/getprebuilt - -# Each of the scripts below build, get, and/or possibly sign a different -# OpenVPN component, placing the generated files in GENOUT. Each of these -# steps is fully indepedent, and can be executed in any order or omitted. -# The exception is the last script which gathers together all files from -# GENOUT and builds the installer. - -# Make the OpenVPN user-space components (OpenVPN and service) -install-win32/makeopenvpn - -# Make the OpenVPN TAP driver -install-win32/maketap - -# Make the tapinstall utility, used to install the TAP driver -install-win32/maketapinstall - -# Get the OpenSSL libraries from a pre-build OpenSSL tree -install-win32/getopenssl - -# Get the PKCS-11 helper library from a pre-built OpenSSL tree -install-win32/getpkcs11helper - -# Get the OpenVPN GUI (must be prebuilt) -install-win32/getgui - -# Get the OpenVPN XML-based GUI (must be prebuilt) -install-win32/getxgui - -# Produce the license text, install README, and sample config files -install-win32/maketext - -# This final step builds the OpenVPN installer using generated -# files from GENOUT -install-win32/buildinstallermsvc/autodefs.h.in deleted +0
-20@@ -1,20 +0,0 @@ -/* - * Minimum TAP-Win32 version number expected by userspace - * - * The TAP-Win32 version number is defined in tap-win32/SOURCES - */ -#define TAP_ID "@PRODUCT_TAP_ID@" -#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ -#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ - -/* Name of package */ -#define PACKAGE "@PRODUCT_UNIX_NAME@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PRODUCT_NAME@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PRODUCT_VERSION@"msvc/config.py deleted +0
-93@@ -1,93 +0,0 @@ -# build autodefs.h and - -import re - -autogen = "Automatically generated by config.py" - -def parse_version_m4(kv, version_m4): - r = re.compile(r'^define\((\w+),\[(.*)\]\)$') - f = open(version_m4) - for line in f: - line = line.rstrip() - m = re.match(r, line) - if m: - g = m.groups() - kv[g[0]] = g[1] - f.close() - -def parse_settings_in(kv, settings_in): - r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)$') - f = open(settings_in) - for line in f: - line = line.rstrip() - m = re.match(r, line) - if m: - g = m.groups() - kv[g[0]] = g[1] or '' - f.close() - -def build_autodefs(kv, autodefs_in, autodefs_out): - def repfn(m): - var, = m.groups() - return kv.get(var, '') - - r = re.compile(r'@(\w+)@') - fin = open(autodefs_in) - fout = open(autodefs_out, 'w') - fout.write("/* %s */\n\n" % autogen) - for line in fin: - newline = re.sub(r, repfn, line) - fout.write(newline) - fin.close() - fout.close() - -def print_key_values(kv): - for k, v in sorted(kv.items()): - print "%s%s%s" % (k, ' '*(32-len(k)), repr(v)) - -def get_sources(makefile_am): - c = set() - h = set() - f = open(makefile_am) - state = False - for line in f: - line = line.rstrip() - if line == 'openvpn_SOURCES = \\': - state = True - elif not line: - state = False - elif state: - for sf in line.split(): - if sf.endswith('.c'): - c.add(sf[:-2]) - elif sf.endswith('.h'): - h.add(sf[:-2]) - elif sf == '\\': - pass - else: - print >>sys.stderr, "Unrecognized filename:", sf - f.close() - return [ sorted(list(s)) for s in (c, h) ] - -def output_mak_list(out, title, srclist, ext): - out.write("%s =" % (title,)) - for x in srclist: - out.write(" \\\n\t%s.%s" % (x, ext)) - out.write('\n\n') - -def output_mak(makefile_am, outfile): - c, h = get_sources(makefile_am) - out = open(outfile, 'w') - out.write("# %s\n\n" % autogen) - output_mak_list(out, 'HEADERS', h, 'h') - output_mak_list(out, 'OBJS', c, 'obj') - out.close() - -def main(): - kv = {} - parse_version_m4(kv, 'version.m4') - parse_settings_in(kv, 'install-win32/settings.in') - build_autodefs(kv, 'msvc/autodefs.h.in', 'autodefs.h') - output_mak('Makefile.am', 'head_obj.mak') - -main()msvc/msvc.mak deleted +0
-52@@ -1,52 +0,0 @@ -# This makefile builds the user-mode component -# of OpenVPN for Windows in the Visual Studio 2008 environment. - -# To build: -# python msvc\config.py -# nmake /f msvc\msvc.mak - -# Each of the OPENSSL and LZO dirs should have 'lib' and 'include' -# directories under them. - -OPENSSL = \src\openssl -OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib - -LZO = \src\lzo -LZO_DYNAMIC = lzo2.lib - -INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include - -LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib - -LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib - -EXE = openvpn.exe - -CPP=cl.exe -CPP_ARG_COMMON=/nologo /W3 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c -# release: -CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG -# debug: -#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG - -LINK32=link.exe -# release: -LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)" -# debug: -#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)" - -# HEADERS and OBJS definitions, automatically generated -!INCLUDE head_obj.mak - -openvpn : $(OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OBJS) -<< - -clean : - del /Q $(OBJS) $(EXE) *.idb *.pdb - -.c.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<<service-win32/msvc.mak deleted +0
-30@@ -1,30 +0,0 @@ -# This makefile builds the OpenVPN service wrapper for Windows in the -# Visual Studio 2008 environment. - -# Some of these libs may not be needed -LIBS = ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib -EXE = openvpnserv.exe - -CPP=cl.exe -CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE /FD /c -I".." -CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG - -LINK32=link.exe -LINK32_FLAGS=/nologo /subsystem:console /incremental:no - -OBJS = \ - openvpnserv.obj \ - service.obj - -openvpnserv : $(OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) "/out:$(EXE)" $(LIBS) $(OBJS) -<< - -clean : - del /Q $(OBJS) $(EXE) *.idb *.pdb - -.c.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<<win/__init__.py deleted +0
-0win/autodefs.h.in deleted +0
-31@@ -1,31 +0,0 @@ -#ifndef AUTODEFS_H -#define AUTODEFS_H - -/* - * Minimum TAP-Win32 version number expected by userspace - * - * The TAP-Win32 version number is defined in tap-win32/SOURCES - */ -#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@" -#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@ -#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@ - -/* Friendly name for TAP driver */ -#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@" - -/* Version number of DDK/WDK used to build TAP driver */ -#define DDKVER_MAJOR @DDKVER_MAJOR@ - -/* Name of package */ -#define PACKAGE "@PRODUCT_UNIX_NAME@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PRODUCT_NAME@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PRODUCT_VERSION@" - -#endifwin/build.py deleted +0
-23@@ -1,23 +0,0 @@ -import os, sys -from wb import system, config, home_fn, cd_home, cd_service_win32, run_in_vs_shell - -def main(): - """Build openvpn.exe and openvpnserv.exe""" - cd_home() - run_in_vs_shell("nmake /f %s" % (home_fn('msvc.mak'),)) - cd_service_win32() - run_in_vs_shell("nmake /f %s" % ('msvc.mak')) - -def clean(): - """Clean up after openvpn.exe and openvpnserv.exe build""" - cd_home() - run_in_vs_shell("nmake /f %s clean" % (home_fn('msvc.mak'),)) - os.chdir("service-win32") - run_in_vs_shell("nmake /f %s clean" % ('msvc.mak')) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - if len(sys.argv) == 2 and sys.argv[1] == 'clean': - clean() - else: - main()win/build_all.py deleted +0
-69@@ -1,69 +0,0 @@ -import getopt, sys -from config_all import main as config_all -from build import main as build_openvpn -from build_ddk import main as build_ddk -from make_dist import main as make_dist - -def Usage(): - '''Show usage information''' - print "Usage: build_all.py [OPTIONS]..." - print "Build OpenVPN using Visual Studio tools" - print - print " -h, --help Show this help" - print " -u, --unsigned Do not sign the TAP drivers" - print " -n, --notap Don't build the TAP driver" - sys.exit(1) - -def main(config): - - # Do a signed build by default - signedBuild=True - - # Build the TAP driver by default - tap=True - - # Parse the command line argument(s) - try: - opts, args = getopt.getopt(sys.argv[1:], "hun", ["help", "unsigned", "notap"]) - except getopt.GetoptError: - Usage() - - for o, a in opts: - if o in ("-h","--help"): - Usage() - if o in ("-u", "--unsigned"): - signedBuild=False - if o in ("-n", "--notap"): - tap=False - - # Check if the SignTool module is present. This avoids ImportErrors popping - # up annoyingly _after_ the build. - if signedBuild: - try: - from signtool import SignTool - except (ImportError): - print "ERROR: SignTool python module not found! Can't do a signed build." - sys.exit(1) - else: - print "Doing an unsigned build as requested" - - # Start the build - config_all(config) - build_openvpn() - - if tap: - build_ddk(config, 'tap', 'all') - build_ddk(config, 'tapinstall', 'all') - if signedBuild: - sign(config, 'all') - make_dist(config,tap=True) - - else: - if 'TAP_PREBUILT' in config: - print "Using prebuilt TAP driver" - make_dist(config,tap=False) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/build_ddk.py deleted +0
-55@@ -1,55 +0,0 @@ -import os -from wb import system, home_fn, choose_arch - -def build_ddk(config, dir, x64): - ddk_path = config['DDK_PATH'] - ddk_major = int(config['DDKVER_MAJOR']) - debug = 'PRODUCT_TAP_DEBUG' in config - return build_tap(ddk_path, ddk_major, debug, dir, x64) - -def build_tap(ddk_path, ddk_major, debug, dir, x64): - """Build drivers using WinDDK tools""" - setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat')) - target = 'chk' if debug else 'fre' - if x64: - target += ' x64' - else: - target += ' x86' - if ddk_major >= 7600: - if x64: - target += ' wlh' # vista - else: - target += ' wnet' # server 2003 - else: - if x64: - target += ' wnet' # server 2003 - else: - target += ' w2k' # 2000 - - system('cmd /c "%s %s %s && cd %s && build -cef"' % ( - setenv_bat, - os.path.realpath(ddk_path), - target, - dir - )) - -def main(config, proj, arch): - if proj == 'tap': - dir = home_fn('tap-win32') - elif proj == 'tapinstall': - dir = home_fn('tapinstall') - else: - raise ValueError("unknown project: %s" % (proj,)) - - for x64 in choose_arch(arch): - build_ddk(config, dir, x64) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - import sys - from wb import config - if len(sys.argv) >= 3: - main(config, sys.argv[1], sys.argv[2]) - else: - print "usage: build <tap|tapinstall> <x64|x86|all>" - sys.exit(2)win/build_exe.py deleted +0
-15@@ -1,15 +0,0 @@ -from config import main as config_main -from build import main as build_openvpn -from build_ddk import main as build_ddk -from sign import main as sign -from make_dist import main as make_dist - -def main(config): - config_main(config) - build_openvpn() - make_dist(config, tap=False) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/config.h.in deleted +0
-363@@ -1,363 +0,0 @@ -/* - * OpenVPN -- An application to securely tunnel IP networks - * over a single UDP port, with support for SSL/TLS-based - * session authentication and key exchange, - * packet encryption, packet authentication, and - * packet compression. - * - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING included with this - * distribution); if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Configuration header for Win32 using the MSVC environment. - */ - -#ifndef OPENVPN_CONFIG_H -#define OPENVPN_CONFIG_H - -#include <windows.h> -#include <winsock2.h> -#include "autodefs.h" /* machine generated */ - -//#define sleep(x) Sleep((x)*1000) - -//#define random rand -//#define srandom srand - -typedef unsigned long in_addr_t; - -#ifndef _SSIZE_T_ -#define _SSIZE_T_ - typedef unsigned int ssize_t; -#endif - -/* Append a label to program startup title */ -/*#define DEBUG_LABEL "DEBUG1"*/ - -/* Should we print debug info from driver? */ -#ifdef PRODUCT_TAP_DEBUG -#define TAP_WIN32_DEBUG -#endif - -/* Enable reading credentials from a file */ -#if @ENABLE_PASSWORD_SAVE@ != 0 -#define ENABLE_PASSWORD_SAVE @ENABLE_PASSWORD_SAVE@ -#endif - -/* Enable client/server capability */ -#if @ENABLE_CLIENT_SERVER@ != 0 -#define ENABLE_CLIENT_SERVER @ENABLE_CLIENT_SERVER@ -#endif - -/* Enable client capability only */ -#if @ENABLE_CLIENT_ONLY@ != 0 -#define ENABLE_CLIENT_ONLY @ENABLE_CLIENT_ONLY@ -#endif - -/* Enable management server capability */ -#if @ENABLE_MANAGEMENT@ != 0 -#define ENABLE_MANAGEMENT @ENABLE_MANAGEMENT@ -#endif - -/* Enable PKCS#11 support */ -#if @USE_PKCS11@ != 0 -#define USE_PKCS11 1 -#endif - -/* Enable HTTP proxy support */ -#if @ENABLE_HTTP_PROXY@ != 0 -#define ENABLE_HTTP_PROXY @ENABLE_HTTP_PROXY@ -#endif - -/* Enable Socks proxy support */ -#if @ENABLE_SOCKS@ != 0 -#define ENABLE_SOCKS @ENABLE_SOCKS@ -#endif - -/* Enable internal fragmentation support */ -#if @ENABLE_FRAGMENT@ != 0 -#define ENABLE_FRAGMENT @ENABLE_FRAGMENT@ -#endif - -/* Enable smaller executable size */ -/* #undef ENABLE_SMALL */ - -/* Enable debugging support */ -#if @ENABLE_DEBUG@ != 0 -#define ENABLE_DEBUG @ENABLE_DEBUG@ -#endif - -/* if defined, will allow usage of the --plugin directive */ -#define USE_LOAD_LIBRARY - -/* Dimension size to use for empty array declaration */ -#define EMPTY_ARRAY_SIZE 0 - -/* Define to 1 if you have the `getsockname' function. */ -#define HAVE_GETSOCKNAME 1 - -/* Define to 1 if you have the <openssl/engine.h> header file. */ -#define HAVE_OPENSSL_ENGINE_H 1 - -/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ -#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 - -/* Define to 1 if you have the `ENGINE_register_all_complete' function. */ -#define HAVE_ENGINE_REGISTER_ALL_COMPLETE 1 - -/* Define to 1 if you have the `ENGINE_cleanup' function. */ -#define HAVE_ENGINE_CLEANUP 1 - -/* gettimeofday() is implemented in otime.c for Windows */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the 'chsize' function. */ -#define HAVE_CHSIZE 1 - -/* Define to 1 if you have the `chdir' function. */ -#define HAVE_CHDIR 1 - -/* Define to 1 if your compiler supports GNU GCC-style variadic macros */ -#ifndef _MSC_VER /* Defines MSFT compiler version. Defined as 1200 for MSVC++ 6.0. */ -#define HAVE_CPP_VARARG_MACRO_GCC 1 -#endif - -/* Define to 1 if you have the <ctype.h> header file. */ -#define HAVE_CTYPE_H 1 - -/* Define to 1 if you have the <errno.h> header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the `EVP_CIPHER_CTX_set_key_length' function. */ -#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1 - -/* Define to 1 if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `getsockopt' function. */ -#define HAVE_GETSOCKOPT 1 - -/* Define to 1 if you have the `inet_ntoa' function. */ -#define HAVE_INET_NTOA 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the `setsockopt' function. */ -#define HAVE_SETSOCKOPT 1 - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 - -/* Define to 1 if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#ifndef _MSC_VER -#define HAVE_STDINT_H 1 -#endif - -/* Define to 1 if you have the <stdio.h> header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `system' function. */ -#define HAVE_SYSTEM 1 - -/* Define to 1 if you have the <sys/file.h> header file. */ -#ifndef _MSC_VER -#define HAVE_SYS_FILE_H 1 -#endif - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/time.h> header file. */ -#ifndef _MSC_VER -#define HAVE_SYS_TIME_H 1 -#endif - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the `time' function. */ -#define HAVE_TIME 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#ifndef _MSC_VER -#define HAVE_UNISTD_H 1 -#endif - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Special Windows version of getpass() defined in io.c */ -#define HAVE_GETPASS 1 - - -/* The POSIX access() function is available, but requires - * _CRT_NONSTDC_NO_WARNINGS and _CRT_SECURE_NO_WARNINGS - * to be defined - */ -#define HAVE_ACCESS 1 - -/* Macros used by the POSIX access() function might not be available on Windows. - * Based on information found here: - * http://msdn.microsoft.com/en-us/library/1w06ktdy%28v=vs.80%29.aspx - */ -#ifndef R_OK -#define R_OK 4 -#endif - -#ifndef W_OK -#define W_OK 2 -#endif - -#ifndef X_OK -#define X_OK 0 -#endif - -#ifndef F_OK -#define F_OK 0 -#endif - - -/* Define to the full name and version of this package. */ -#ifdef DEBUG_LABEL -#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL -#else -#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION -#endif - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* The size of a `unsigned int', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_INT 4 - -/* The size of a `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* A string representing our target */ -#ifdef _MSC_VER -#define TARGET_ALIAS "Win32-MSVC++" -#else -#define TARGET_ALIAS "Win32-MinGW" -#endif - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#ifndef _MSC_VER -#define TIME_WITH_SYS_TIME 1 -#endif - -/* Use the PolarSSL crypto library */ -#if @USE_POLARSSL@ != 0 -#define USE_POLARSSL 1 -#endif - -/* Use the OpenSSL crypto library */ -#if @USE_OPENSSL@ != 0 -#define USE_OPENSSL 1 -#endif - -/* Use the crypto library */ -#define USE_CRYPTO 1 - -/* Use LZO compression library */ -#define USE_LZO 1 - -/* LZO version number */ -#define LZO_VERSION_NUM "2" - -/* Use lzo/ directory prefix for LZO header files (for LZO 2.0) */ -#define LZO_HEADER_DIR 1 - -/* Use the SSL library */ -#define USE_SSL 1 - -/* Version number of package */ -#define VERSION PACKAGE_VERSION - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#define inline __inline - -/* type to use in place of socklen_t if not defined */ -/*#define socklen_t unsigned int*/ - -#ifndef __MINGW32__ -/* 32-bit unsigned type */ -#define uint32_t unsigned int - -/* 16-bit unsigned type */ -#define uint16_t unsigned short - -/* 8-bit unsigned type */ -#define uint8_t unsigned char -#endif /* __MINGW32__ */ - -/* Route command */ -#define ROUTE_PATH "route" - -#ifdef _MSC_VER -/* MSVC++ hacks */ -#pragma warning(disable:4244) // conversion from 'foo' to 'bar', possible loss of data -#pragma warning(disable:4018) // signed/unsigned mismatch -#include <io.h> -#include <direct.h> -//#define vsnprintf _vsnprintf -//#define vsnwprintf _vsnwprintf -#define snwprintf _snwprintf -#define write _write -#define open _open -#define read _read -#define close _close -#define lseek _lseek -#define chdir _chdir -#define strdup _strdup -#define strcasecmp _stricmp -#define chsize _chsize -#define S_IRUSR 0 -#define S_IWUSR 0 -#define TV_SEC_CAST (long) -#define TV_USEC_CAST (long) -typedef int intptr_t; -/* Visual Studio 2005 supports vararg macros */ -#if _MSC_VER >= 1400 -#define HAVE_CPP_VARARG_MACRO_ISO 1 -#endif -#endif - -#endif /* OPENVPN_CONFIG_H */win/config.py deleted +0
-21@@ -1,21 +0,0 @@ -from wb import preprocess, autogen, mod_fn, home_fn, build_config_h, build_configure_h, build_version_m4_vars, build_autodefs, make_headers_objs, dict_def - -def main(config): - build_config_h(config) - build_configure_h(config, mod_fn(home_fn('configure.h')), head_comment='/* %s */\n\n' % autogen) - build_version_m4_vars(mod_fn(mod_fn('version_m4_vars.tmp')), head_comment='/* %s */\n\n' % autogen) - build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h')) - ho = make_headers_objs(home_fn('Makefile.am')) - - preprocess(dict_def(config, [('HEADERS_OBJS', ho)]), - in_fn=mod_fn('msvc.mak.in'), - out_fn=home_fn('msvc.mak'), - quote_begin='@', - quote_end='@', - if_prefix='!', - head_comment='# %s\n\n' % autogen) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/config_all.py deleted +0
-13@@ -1,13 +0,0 @@ -from config import main as config_main -from config_tap import main as config_tap -from config_ti import main as config_ti - -def main(config): - config_main(config) - config_tap(config) - config_ti(config) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/config_tap.py deleted +0
-35@@ -1,35 +0,0 @@ -import os -from wb import preprocess, home_fn, autogen, dict_def - -def main(config): - preprocess(config, - in_fn=home_fn('tap-win32/SOURCES.in'), - out_fn=home_fn('tap-win32/SOURCES'), - quote_begin='@@', - quote_end='@@', - head_comment='# %s\n\n' % autogen) - - preprocess(config, - in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), - out_fn=home_fn('tap-win32/i386/OemWin2k.inf'), - quote_begin='@@', - quote_end='@@', - if_prefix='!', - head_comment='; %s\n\n' % autogen) - - try: - os.mkdir(home_fn('tap-win32/amd64')) - except: - pass - preprocess(dict_def(config, [('AMD64', '1')]), - in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), - out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'), - quote_begin='@@', - quote_end='@@', - if_prefix='!', - head_comment='; %s\n\n' % autogen) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/config_ti.py deleted +0
-18@@ -1,18 +0,0 @@ -import os, shutil -from wb import preprocess, home_fn, autogen - -def main(config): - src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR']) - dest = home_fn('tapinstall') - shutil.rmtree(dest, ignore_errors=True) - shutil.copytree(src, dest) - preprocess(config, - in_fn=os.path.join(src, 'sources'), - out_fn=os.path.join(dest, 'sources'), - if_prefix='!', - head_comment='# %s\n\n' % autogen) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/js.py deleted +0
-10@@ -1,10 +0,0 @@ -import json - -# usage: -# print JSON().encode(kv) - -class JSON(json.JSONEncoder): - def __init__(self, **kwargs): - args = dict(sort_keys=True, indent=2) - args.update(kwargs) - json.JSONEncoder.__init__(self, **args)win/make_dist.py deleted +0
-107@@ -1,107 +0,0 @@ -import os -from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename, run_in_vs_shell - -def main(config, tap=True): - dist = config['DIST'] - assert dist - dist = home_fn(dist) - bin = os.path.join(dist, 'bin') - i386 = os.path.join(dist, 'i386') - amd64 = os.path.join(dist, 'amd64') - samples = os.path.join(dist, 'samples') - - # build dist and subdirectories - rm_rf(dist) - mkdir(dist) - mkdir(bin) - mkdir(i386) - mkdir(amd64) - mkdir(samples) - - # copy openvpn.exe, openvpnserv.exe and their manifests - cp(home_fn('openvpn.exe'), bin) - cp(home_fn('openvpn.exe.manifest'), bin) - cp(home_fn('service-win32/openvpnserv.exe'), bin) - cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin) - - # copy openvpn-gui - cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin) - - # copy DLL dependencies - cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin) - cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin) - cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin) - cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin) - cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin) - cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin) - - # copy OpenSSL utilities (=openvpn.exe) - cp(home_fn(config['OPENSSL_DIR']+'/bin/openssl.exe'), bin) - - # copy sample config files; renaming is necessary due to openvpn.nsi script - cp(home_fn('install-win32/sample.ovpn'), samples) - cp(home_fn('sample-config-files/client.conf'), samples) - cp(home_fn('sample-config-files/server.conf'), samples) - rename(os.path.join(samples,'client.conf'), os.path.join(samples, 'client.ovpn')) - rename(os.path.join(samples,'server.conf'), os.path.join(samples, 'server.ovpn')) - - # embed manifests to executables and DLLs - for f in [ "openvpn.exe", "openvpnserv.exe", "lzo2.dll", "libpkcs11-helper-1.dll" ]: - - outputresource = os.path.join(bin,f) - manifest = outputresource+".manifest" - - # EXEs and DLLs require slightly different treatment - if f.endswith(".exe"): - type = "1" - elif f.endswith(".dll"): - type = "2" - else: - print "ERROR: Could not embed manifest to "+outputresouce+", bailing out." - sys.exit(1) - - # Embed the manifest - run_in_vs_shell('mt.exe -manifest %s -outputresource:%s;%s' % (manifest, outputresource, type)) - - # copy MSVC CRT - cp_a(home_fn(config['MSVC_CRT']), bin) - - # TAP-driver and tapinstall.exe were built, so copy those over - if tap: - drv_dir = 'tap-win32' - ti_dir = 'tapinstall' - - # we're using prebuilt TAP-driver and tapinstall.exe - elif 'TAP_PREBUILT' in config: - drv_dir = config['TAP_PREBUILT'] - ti_dir = config['TAP_PREBUILT'] - - else: - print "ERROR: Could not find prebuilt TAP-drivers or tapinstall.exe. Please check win/settings.in" - sys.exit(1) - - # copy TAP drivers - for dir_name, dest in (('amd64', amd64), ('i386', i386)): - dir = home_fn(os.path.join(drv_dir, dir_name)) - for dirpath, dirnames, filenames in os.walk(dir): - for f in filenames: - root, ext = os.path.splitext(f) - if ext in ('.inf', '.cat', '.sys'): - cp(os.path.join(dir, f), dest) - break - - # Copy tapinstall.exe (usually known as devcon.exe) - dest = {'amd64' : amd64, 'i386' : i386} - for dirpath, dirnames, filenames in os.walk(home_fn(ti_dir)): - for f in filenames: - if f in ( 'devcon.exe', 'tapinstall.exe' ): - dir_name = os.path.basename(dirpath) - src = os.path.join(dirpath, f) - dst = os.path.join(dest[dir_name],'tapinstall.exe') - if dir_name in dest: - cp(src, dst, dest_is_dir=False) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - from wb import config - main(config)win/msvc.mak.in deleted +0
-69@@ -1,69 +0,0 @@ -# This makefile builds the user-mode component of OpenVPN for Windows in the -# Visual Studio 2008 environment. Note that this file is basis for the real -# makefile (..\msvc.mak) but unusable as is. The real makefile is automatically -# generated during the build process by the Python build scripts. -# -# A few details are in order: -# -# - Everything between @<< and << is inserted into a s.c. "in-line file". This -# file drives the linker (link.exe). -# - HEADERS_OBJS is expanded to all all header and source files listed in -# ..\Makefile.am -# - OPENSSL_DIR and LZO_DIR are dynamically created from settings.in - -OPENSSL = @OPENSSL_DIR@ -!ifdef INCLUDE_OPENSSL -OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib -!endif - -POLARSSL = @POLARSSL_DIR@ -!ifdef INCLUDE_POLARSSL -POLARSSL_DYNAMIC = polarssl.lib -!endif - -PKCS11_HELPER = @PKCS11_HELPER_DIR@ -!ifdef INCLUDE_PKCS11 -PKCS11_HELPER_DYNAMIC = pkcs11-helper.lib -!endif - -LZO = @LZO_DIR@ -LZO_DYNAMIC = lzo2.lib - -INCLUDE_DIRS = -I$(OPENSSL)/include -I$(POLARSSL)/include -I$(LZO)/include -I$(PKCS11_HELPER)/include - -LIBS = $(OPENSSL_DYNAMIC) $(POLARSSL_DYNAMIC) $(PKCS11_HELPER_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib shell32.lib - -LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(POLARSSL)\build\library -LIBPATH:$(PKCS11_HELPER)\lib -LIBPATH:$(LZO)\lib - -EXE = openvpn.exe - -CPP=cl.exe -CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c - -LINK32=link.exe - -!ifdef PRODUCT_OPENVPN_DEBUG -# debug: -CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7 -LINK32_FLAGS=/nologo /subsystem:console /incremental:no /opt:ref /opt:icf /debug -!else -# release: -CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG -LINK32_FLAGS=/nologo /subsystem:console /incremental:no -!endif - -# HEADERS and OBJS definitions, automatically generated from ../Makefile.am [email protected]...@ - -openvpn : $(OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) "/out:$(EXE)" $(LIB_DIRS) $(LIBS) $(OBJS) -<< - -clean : - del /Q $(OBJS) $(EXE) *.idb *.pdb - -.c.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<<win/openvpn.nsi deleted +0
-822@@ -1,822 +0,0 @@ -; **************************************************************************** -; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. * -; * This program is free software; you can redistribute it and/or modify * -; * it under the terms of the GNU General Public License version 2 * -; * as published by the Free Software Foundation. * -; **************************************************************************** - -; OpenVPN install script for Windows, using NSIS - -; Start menu entries don't get uninstalled properly on Windows Vista/7 unless we -; explicitly state that the installer requires admin privileges. This is -; caused by backwards compatibility tricks used on those platforms. For details, -; see http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista -RequestExecutionLevel admin - -SetCompressor lzma - -!include "MUI.nsh" - -# Include basic build settings -!include "settings.in" - -# Include variables generated dynamically from version.m4 by wb.py -!include "version_m4_vars.tmp" - -;!include "guidefs.nsi" -!include "setpath.nsi" - -!ifdef EXTRACT_FILES -!include "MultiFileExtract.nsi" -!endif - -!define GEN "..\dist" -!define BIN "${GEN}\bin" -!define EASYRSA "..\easy-rsa" - -!define PRODUCT_ICON "icon.ico" - -!ifdef PRODUCT_TAP_DEBUG -!define DBG_POSTFIX "-DBG" -!else -!define DBG_POSTFIX "" -!endif - -!define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}" - -!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}" -!define TAPDRV "${TAP}.sys" - -; Default service settings -!define SERV_CONFIG_DIR "$INSTDIR\config" -!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}" -!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" -!define SERV_LOG_DIR "$INSTDIR\log" -!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS" -!define SERV_LOG_APPEND "0" - -;-------------------------------- -;Configuration - - ;General - - OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe" - - ShowInstDetails show - ShowUninstDetails show - - ;Folder selection page - InstallDir "$PROGRAMFILES\${PRODUCT_NAME}" - - ;Remember install folder - InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" "" - -;-------------------------------- -;Modern UI Configuration - - Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}" - - !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} only runs on XP, or higher.\r\n\r\n\r\n" - - !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally." - - !define MUI_COMPONENTSPAGE_SMALLDESC - !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt" - !define MUI_FINISHPAGE_NOAUTOCLOSE - !define MUI_ABORTWARNING - !define MUI_ICON "..\images\${PRODUCT_ICON}" - !define MUI_UNICON "..\images\${PRODUCT_ICON}" - !define MUI_HEADERIMAGE - !define MUI_HEADERIMAGE_BITMAP "..\images\install-whirl.bmp" - !define MUI_UNFINISHPAGE_NOAUTOCLOSE - - !insertmacro MUI_PAGE_WELCOME - !insertmacro MUI_PAGE_LICENSE "..\COPYRIGHT.GPL" - !insertmacro MUI_PAGE_COMPONENTS - !insertmacro MUI_PAGE_DIRECTORY - !insertmacro MUI_PAGE_INSTFILES - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - !insertmacro MUI_UNPAGE_FINISH - - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" - -;-------------------------------- -;Language Strings - - LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe." - -!ifdef USE_GUI - LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman" -!endif - - LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management." - - LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)." - - LangString DESC_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)." - - LangString DESC_SecLZO2DLLs ${LANG_ENGLISH} "Install LZO2 DLLs locally (may be omitted if DLLs are already installed globally)." - - LangString DESC_SecMSVCR90DLL ${LANG_ENGLISH} "Install Microsoft Visual C 9.0 Runtime (may be omitted if it is already installed globally)." - - LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE." - - LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)" - - LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)." - - LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH." - - LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu." - - LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})" - -;-------------------------------- -;Reserve Files - - ;Things that need to be extracted on first (keep these lines before any File command!) - ;Only useful for BZIP2 compression - - ReserveFile "..\images\install-whirl.bmp" - -;-------------------------------- -;Macros - -!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE -Push $R0 -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}" -StrCmp $R0 "" +1 +2 -WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}' -Pop $R0 -!macroend - -!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE -Push $R0 -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}" -StrCmp $R0 '${VALUE}' +1 +2 -DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}" -Pop $R0 -!macroend - -!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE -Push $R0 -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "" -StrCmp $R0 '${VALUE}' +1 +2 -DeleteRegKey "${ROOT}" "${SUBKEY}" -Pop $R0 -!macroend - -!macro DelRegKeyIfEmpty ROOT SUBKEY -Push $R0 -EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1 -StrCmp $R0 "" +1 +2 -DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}" -Pop $R0 -!macroend - -;------------------------------------------ -;Set reboot flag based on tapinstall return - -Function CheckReboot - IntCmp $R0 1 "" noreboot noreboot - IntOp $R0 0 & 0 - SetRebootFlag true - DetailPrint "REBOOT flag set" - noreboot: -FunctionEnd - -;-------------------------------- -;Installer Sections - -Function .onInit - ClearErrors - -# Verify that user has admin privs - UserInfo::GetName - IfErrors ok - Pop $R0 - UserInfo::GetAccountType - Pop $R1 - StrCmp $R1 "Admin" ok - Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]" - Abort - ok: - -# Delete previous start menu - RMDir /r $SMPROGRAMS\${PRODUCT_NAME} - -# FIXME: reimplement Windows version checking code that was located here, but -# disabled intentionally to avoid Windows 7 issues. This should do it: -# -# http://nsis.sourceforge.net/Get_Windows_version -# -# Blacklisting should be safer than whitelisting used originally. - -FunctionEnd - -!ifndef SF_SELECTED -!define SF_SELECTED 1 -!endif - -;-------------------- -;Pre-install section - -Section -pre - - ; Stop OpenVPN if currently running - DetailPrint "Previous Service REMOVE (if exists)" - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove' - Pop $R0 # return value/error/timeout - - Sleep 3000 - - # Fix for Trac ticket 120. Remove after 2.3 has been released. - !ifdef USE_GUI - SetShellVarContext current - Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk" - !endif - -SectionEnd - -Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - - File "${BIN}\${PRODUCT_UNIX_NAME}.exe" - -SectionEnd - -!ifdef USE_GUI -Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - - File "${BIN}\${OPENVPN_GUI}" - -SectionEnd -!endif - -Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA - - SetOverwrite on - SetOutPath "$INSTDIR\easy-rsa" - - # FIXME: the easy-rsa directory would need cleaning up - - # Original nsi script looked for ${EASYRSA}\2.0\openssl.cnf.sample. A newer - # openssl.cnf is needed on OpenVPN 2.2+. - File "${EASYRSA}\2.0\openssl-1.0.0.cnf" - - File "${EASYRSA}\Windows\vars.bat.sample" - - File "${EASYRSA}\Windows\init-config.bat" - - File "${EASYRSA}\Windows\README.txt" - File "${EASYRSA}\Windows\build-ca.bat" - File "${EASYRSA}\Windows\build-dh.bat" - File "${EASYRSA}\Windows\build-key-server.bat" - File "${EASYRSA}\Windows\build-key.bat" - File "${EASYRSA}\Windows\build-key-pkcs12.bat" - File "${EASYRSA}\Windows\clean-all.bat" - File "${EASYRSA}\Windows\index.txt.start" - File "${EASYRSA}\Windows\revoke-full.bat" - File "${EASYRSA}\Windows\serial.start" - -SectionEnd - -Section "${PRODUCT_NAME} Service" SecService - - SetOverwrite on - - SetOutPath "$INSTDIR\bin" - File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe" - - SetOutPath "$INSTDIR\config" - - FileOpen $R0 "$INSTDIR\config\README.txt" w - FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n" - FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n" - FileWrite $R0 "$\r$\n" - FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n" - FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n" - FileClose $R0 - - SetOutPath "$INSTDIR\sample-config" - File "${GEN}\samples\sample.${SERV_CONFIG_EXT}" - File "${GEN}\samples\client.${SERV_CONFIG_EXT}" - File "${GEN}\samples\server.${SERV_CONFIG_EXT}" - - CreateDirectory "$INSTDIR\log" - FileOpen $R0 "$INSTDIR\log\README.txt" w - FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n" - FileWrite $R0 "sessions which are being run as a service.$\r$\n" - FileClose $R0 - -SectionEnd - -Section "${PRODUCT_NAME} File Associations" SecFileAssociation -SectionEnd - -Section "OpenSSL DLLs" SecOpenSSLDLLs - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - File "${BIN}\libeay32.dll" - File "${BIN}\ssleay32.dll" - -SectionEnd - -Section "OpenSSL Utilities" SecOpenSSLUtilities - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - File "${BIN}\openssl.exe" - -SectionEnd - -Section "PKCS#11 DLLs" SecPKCS11DLLs - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - File "${BIN}\libpkcs11-helper-1.dll" - -SectionEnd - -Section "LZO2 DLLs" SecLZO2DLLs - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - File "${BIN}\lzo2.dll" - -SectionEnd - -Section "Microsoft Visual C 9.0 Runtime DLL" SecMSVCR90DLL - - SetOverwrite on - SetOutPath "$INSTDIR\bin" - File "${BIN}\Microsoft.VC90.CRT\msvcr90.dll" - File "${BIN}\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest" - -SectionEnd - - - - -Section "TAP Virtual Ethernet Adapter" SecTAP - - SetOverwrite on - - # Generate TAP driver install script dynamically - FileOpen $R0 "$INSTDIR\bin\addtap.bat" w - FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n" - FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n' - FileWrite $R0 "pause$\r$\n" - FileClose $R0 - - # Generate TAP driver removal script dynamically - FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w - FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n" - FileWrite $R0 "pause$\r$\n" - FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n' - FileWrite $R0 "pause$\r$\n" - FileClose $R0 - - ; Check if we are running on a 64 bit system. - System::Call "kernel32::GetCurrentProcess() i .s" - System::Call "kernel32::IsWow64Process(i s, *i .r0)" - IntCmp $0 0 tap-32bit - -; tap-64bit: - - DetailPrint "We are running on a 64-bit system." - - SetOutPath "$INSTDIR\bin" - - File "${GEN}\amd64\tapinstall.exe" - - SetOutPath "$INSTDIR\driver" - - File "${GEN}\amd64\OemWin2k.inf" - File "${GEN}\amd64\${TAPDRV}" - - # Don't try to install TAP driver signature if it does not exist. - File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat" - -goto tapend - -tap-32bit: - - DetailPrint "We are running on a 32-bit system." - - SetOutPath "$INSTDIR\bin" - File "${GEN}\i386\tapinstall.exe" - - SetOutPath "$INSTDIR\driver" - File "${GEN}\i386\OemWin2k.inf" - File "${GEN}\i386\${TAPDRV}" - - # Don't try to install TAP driver signature if it does not exist. - File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat" - - tapend: - -SectionEnd - -Section "Add ${PRODUCT_NAME} to PATH" SecAddPath - - ; remove previously set path (if any) - Push "$INSTDIR\bin" - Call RemoveFromPath - - ; append our bin directory to end of current user path - Push "$INSTDIR\bin" - Call AddToPath - -SectionEnd - -Section "Add Shortcuts to Start Menu" SecAddShortcuts - - ; Required to handle shortcuts properly on Vista/7 - SetShellVarContext all - SetOverwrite on - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation" - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html" - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html" - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html" - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/" - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe" - -SectionEnd - -;-------------------- -;Post-install section - -Section -post - - SetOverwrite on - - ; delete old tapinstall.exe - ;Delete "$INSTDIR\bin\tapinstall.exe" - - ; Store README, license, icon - SetOverwrite on - SetOutPath $INSTDIR - File "..\INSTALL-win32.txt" - File "..\COPYRIGHT.GPL" - File "..\images\${PRODUCT_ICON}" - - ; store sample config files - !ifdef SAMPCONF_DIR - SetOverwrite on - SetOutPath "$INSTDIR\config" - !ifdef SAMPCONF_CONF - File "${GEN}\conf\${SAMPCONF_CONF}" - !endif - !ifdef SAMPCONF_CONF2 - File "${GEN}\conf\${SAMPCONF_CONF2}" - !endif - !ifdef SAMPCONF_P12 - File "${GEN}\conf\${SAMPCONF_P12}" - !endif - !ifdef SAMPCONF_TA - File "${GEN}\conf\${SAMPCONF_TA}" - !endif - !ifdef SAMPCONF_CA - File "${GEN}\conf\${SAMPCONF_CA}" - !endif - !ifdef SAMPCONF_CRT - File "${GEN}\conf\${SAMPCONF_CRT}" - !endif - !ifdef SAMPCONF_KEY - File "${GEN}\conf\${SAMPCONF_KEY}" - !endif - !ifdef SAMPCONF_DH - File "${GEN}\conf\${SAMPCONF_DH}" - !endif - !endif - - ; Try to extract files if present - !ifdef EXTRACT_FILES - Push "$INSTDIR" - Call MultiFileExtract - Pop $R0 - IntCmp $R0 0 +3 +1 +1 - DetailPrint "MultiFileExtract Failed status=$R0" - goto +2 - DetailPrint "MultiFileExtract Succeeded" - !endif - - ; - ; install/upgrade TAP driver if selected, using tapinstall.exe - ; - SectionGetFlags ${SecTAP} $R0 - IntOp $R0 $R0 & ${SF_SELECTED} - IntCmp $R0 ${SF_SELECTED} "" notap notap - ; TAP install/update was selected. - ; Should we install or update? - ; If tapinstall error occurred, $5 will - ; be nonzero. - IntOp $5 0 & 0 - nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}' - Pop $R0 # return value/error/timeout - IntOp $5 $5 | $R0 - DetailPrint "tapinstall hwids returned: $R0" - - ; If tapinstall output string contains "${TAP}" we assume - ; that TAP device has been previously installed, - ; therefore we will update, not install. - Push "${TAP}" - Call StrStr - Pop $R0 - - IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error - IntCmp $R0 -1 tapinstall - - ;tapupdate: - DetailPrint "TAP UPDATE" - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}' - Pop $R0 # return value/error/timeout - Call CheckReboot - IntOp $5 $5 | $R0 - DetailPrint "tapinstall update returned: $R0" - Goto tapinstall_check_error - - tapinstall: - DetailPrint "TAP REMOVE OLD TAP" - - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801' - Pop $R0 # return value/error/timeout - DetailPrint "tapinstall remove TAP0801 returned: $R0" - - DetailPrint "TAP INSTALL (${TAP})" - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}' - Pop $R0 # return value/error/timeout - Call CheckReboot - IntOp $5 $5 | $R0 - DetailPrint "tapinstall install returned: $R0" - - tapinstall_check_error: - DetailPrint "tapinstall cumulative status: $5" - IntCmp $5 0 notap - MessageBox MB_OK "An error occurred installing the TAP device driver." - - notap: - - ; Store install folder in registry - WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR - - ; install as a service if requested - SectionGetFlags ${SecService} $R0 - IntOp $R0 $R0 & ${SF_SELECTED} - IntCmp $R0 ${SF_SELECTED} "" noserv noserv - - ; set registry parameters for openvpnserv - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}" - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}" - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}" - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}" - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}" - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}" - - ; install openvpnserv as a service (to be started manually from service control manager) - DetailPrint "Service INSTALL" - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install' - Pop $R0 # return value/error/timeout - - noserv: - - ; Create file association if requested - fileass: - SectionGetFlags ${SecFileAssociation} $R0 - IntOp $R0 $R0 & ${SF_SELECTED} - IntCmp $R0 ${SF_SELECTED} "" noass noass - WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File" - WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File" - WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open" - WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0" - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"' - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file" - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"' - - ; Create start menu folders - noass: - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities" - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts" - - ; Create start menu and desktop shortcuts to OpenVPN GUI - !ifdef USE_GUI - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" "" - CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" - !endif - - ; Create start menu shortcuts to addtap.bat and deltapall.bat - tryaddtap: - IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" "" - - trydeltap: - IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" "" - - ; Create start menu shortcuts for config and log directories - config_shortcut: - IfFileExists "$INSTDIR\config" "" log_shortcut - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" "" - - log_shortcut: - IfFileExists "$INSTDIR\log" "" samp_shortcut - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" "" - - samp_shortcut: - IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" "" - - genkey_shortcut: - IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts - IfFileExists "$INSTDIR\config" "" noshortcuts - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 0 - - noshortcuts: - ; Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - - ; Show up in Add/Remove programs - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}" - WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}" - - ; Advise a reboot - ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP driver installation/upgrade (this is an informational message only, pressing OK will not reboot)." - -SectionEnd - -;-------------------------------- -;Descriptions - -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace) - !ifdef USE_GUI - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI) - !endif - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA) - !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP) - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities) - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs) - !insertmacro MUI_DESCRIPTION_TEXT ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs) - !insertmacro MUI_DESCRIPTION_TEXT ${SecLZO2DLLs} $(DESC_SecLZO2DLLs) - !insertmacro MUI_DESCRIPTION_TEXT ${SecMSVCR90DLL} $(DESC_SecMSVCR90DLL) - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath) - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts) - - !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService) - !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation) -!insertmacro MUI_FUNCTION_DESCRIPTION_END - -;-------------------------------- -;Uninstaller Section - -Function un.onInit - ClearErrors - UserInfo::GetName - IfErrors ok - Pop $R0 - UserInfo::GetAccountType - Pop $R1 - StrCmp $R1 "Admin" ok - Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]" - Abort - ok: -FunctionEnd - -Section "Uninstall" - - ; Required to handle shortcuts properly on Vista/7 - SetShellVarContext all - - ; Stop OpenVPN if currently running - - DetailPrint "Service REMOVE" - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove' - Pop $R0 # return value/error/timeout - - Sleep 3000 - - DetailPrint "TAP REMOVE" - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}' - Pop $R0 # return value/error/timeout - DetailPrint "tapinstall remove returned: $R0" - - Push "$INSTDIR\bin" - Call un.RemoveFromPath - - RMDir /r $SMPROGRAMS\${PRODUCT_NAME} - - ; delete sample config files - !ifdef SAMPCONF_DIR - !ifdef SAMPCONF_CONF - Delete "$INSTDIR\config\${SAMPCONF_CONF}" - !endif - !ifdef SAMPCONF_CONF2 - Delete "$INSTDIR\config\${SAMPCONF_CONF2}" - !endif - !ifdef SAMPCONF_P12 - Delete "$INSTDIR\config\${SAMPCONF_P12}" - !endif - !ifdef SAMPCONF_TA - Delete "$INSTDIR\config\${SAMPCONF_TA}" - !endif - !ifdef SAMPCONF_CA - Delete "$INSTDIR\config\${SAMPCONF_CA}" - !endif - !ifdef SAMPCONF_CRT - Delete "$INSTDIR\config\${SAMPCONF_CRT}" - !endif - !ifdef SAMPCONF_KEY - Delete "$INSTDIR\config\${SAMPCONF_KEY}" - !endif - !ifdef SAMPCONF_DH - Delete "$INSTDIR\config\${SAMPCONF_DH}" - !endif - !endif - - !ifdef USE_GUI - Delete "$INSTDIR\bin\${OPENVPN_GUI}" - Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk" - !endif - - # Files installed by openvpn-2.2-beta5 and earlier - Delete "$INSTDIR\easy-rsa\openssl.cnf.sample" - Delete "$INSTDIR\license" - Delete "$INSTDIR\bin\libssl32.dll" - - Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" - Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" - Delete "$INSTDIR\bin\libeay32.dll" - Delete "$INSTDIR\bin\ssleay32.dll" - Delete "$INSTDIR\bin\libpkcs11-helper-1.dll" - Delete "$INSTDIR\bin\lzo2.dll" - Delete "$INSTDIR\bin\msvcr90.dll" - Delete "$INSTDIR\bin\Microsoft.VC90.CRT.manifest" - Delete "$INSTDIR\bin\tapinstall.exe" - Delete "$INSTDIR\bin\addtap.bat" - Delete "$INSTDIR\bin\deltapall.bat" - - Delete "$INSTDIR\config\README.txt" - Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt" - - Delete "$INSTDIR\log\README.txt" - - Delete "$INSTDIR\driver\OemWin2k.inf" - Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat" - Delete "$INSTDIR\driver\${TAPDRV}" - - Delete "$INSTDIR\bin\openssl.exe" - - Delete "$INSTDIR\INSTALL-win32.txt" - Delete "$INSTDIR\${PRODUCT_ICON}" - Delete "$INSTDIR\COPYRIGHT.GPL" - Delete "$INSTDIR\Uninstall.exe" - - Delete "$INSTDIR\easy-rsa\openssl.cnf" - Delete "$INSTDIR\easy-rsa\vars.bat.sample" - Delete "$INSTDIR\easy-rsa\init-config.bat" - Delete "$INSTDIR\easy-rsa\README.txt" - Delete "$INSTDIR\easy-rsa\build-ca.bat" - Delete "$INSTDIR\easy-rsa\build-dh.bat" - Delete "$INSTDIR\easy-rsa\build-key-server.bat" - Delete "$INSTDIR\easy-rsa\build-key.bat" - Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat" - Delete "$INSTDIR\easy-rsa\clean-all.bat" - Delete "$INSTDIR\easy-rsa\index.txt.start" - Delete "$INSTDIR\easy-rsa\revoke-key.bat" - Delete "$INSTDIR\easy-rsa\revoke-full.bat" - Delete "$INSTDIR\easy-rsa\serial.start" - - Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}" - - RMDir "$INSTDIR\bin" - RMDir "$INSTDIR\config" - RMDir "$INSTDIR\driver" - RMDir "$INSTDIR\easy-rsa" - RMDir "$INSTDIR\sample-config" - RMDir /r "$INSTDIR\log" - RMDir "$INSTDIR" - - !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File" - DeleteRegKey HKCR "${PRODUCT_NAME}File" - DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME} - DeleteRegKey HKCU "Software\${PRODUCT_NAME}" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" - -SectionEndwin/setpath.nsi deleted +0
-231@@ -1,231 +0,0 @@ -; Modify the user's PATH variable. -; -; Modified by JY to have both a RemoveFromPath -; and an un.RemoveFromPath which are basically -; copies of each other. Why does NSIS demand -; this nonsense? -; -; Modified Feb 14, 2005 by Mathias Sundman: -; Added code to remove the semicolon at the end of the path -; when uninstalling. -; -; Added code to make sure we don't insert an extra semicolon -; before our path if there already exist one at the end of -; the original path. -; -; Removed duplicated "un. and install" functions and made -; macros to duplicate the code instead. - -; example usage -; -;Section "Add to path" -; Push $INSTDIR -; Call AddToPath -;SectionEnd -; -;# ... -; -;Section "uninstall" -; # ... -; Push $INSTDIR -; Call un.RemoveFromPath -; # ... -;SectionEnd - -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 - -;==================================================== -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot -;==================================================== -Function AddToPath - Exch $0 - Push $1 - Push $2 - - Call IsNT - Pop $1 - StrCmp $1 1 AddToPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 0 END - GetFullPathName /SHORT $0 $0 - FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n" - FileClose $1 - Goto AddToPath_done - - AddToPath_NT: - ReadRegStr $1 HKCU "Environment" "PATH" - StrCpy $2 $1 1 -1 # copy last char - StrCmp $2 ";" 0 +2 # if last char == ; - StrCpy $1 $1 -1 # remove last char - - StrCmp $1 "" AddToPath_NTdoIt - StrCpy $0 "$1;$0" - Goto AddToPath_NTdoIt - AddToPath_NTdoIt: - WriteRegExpandStr HKCU "Environment" "PATH" $0 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - AddToPath_done: - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -;==================================================== -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack -;==================================================== -!macro RemoveFromPath un -Function ${un}RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - - Call ${un}IsNT - Pop $1 - StrCmp $1 1 RemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - SetRebootFlag true - Goto RemoveFromPath_dosLoop - - RemoveFromPath_dosLoop: - FileRead $1 $3 - StrCmp $3 "$0$\r$\n" RemoveFromPath_dosLoop - StrCmp $3 "$0$\n" RemoveFromPath_dosLoop - StrCmp $3 "$0" RemoveFromPath_dosLoop - StrCmp $3 "" RemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto RemoveFromPath_dosLoop - - RemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto RemoveFromPath_done - - RemoveFromPath_NT: - StrLen $2 $0 - ReadRegStr $1 HKCU "Environment" "PATH" - Push $1 - Push $0 - Call ${un}StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 RemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - - StrCpy $5 $3 1 -1 # copy last char - StrCmp $5 ";" 0 +2 # if last char == ; - StrCpy $3 $3 -1 # remove last char - - WriteRegExpandStr HKCU "Environment" "PATH" $3 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - RemoveFromPath_done: - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd -!macroend -!insertmacro RemoveFromPath "" -!insertmacro RemoveFromPath "un." - - -;==================================================== -; StrStr - Finds a given string in another given string. -; Returns -1 if not found and the pos if found. -; Input: head of the stack - string to find -; second in the stack - string to find in -; Output: head of the stack -;==================================================== -!macro StrStr un -Function ${un}StrStr - Push $0 - Exch - Pop $0 ; $0 now have the string to find - Push $1 - Exch 2 - Pop $1 ; $1 now have the string to find in - Exch - Push $2 - Push $3 - Push $4 - Push $5 - - StrCpy $2 -1 - StrLen $3 $0 - StrLen $4 $1 - IntOp $4 $4 - $3 - - StrStr_loop: - IntOp $2 $2 + 1 - IntCmp $2 $4 0 0 StrStrReturn_notFound - StrCpy $5 $1 $3 $2 - StrCmp $5 $0 StrStr_done StrStr_loop - - StrStrReturn_notFound: - StrCpy $2 -1 - - StrStr_done: - Pop $5 - Pop $4 - Pop $3 - Exch $2 - Exch 2 - Pop $0 - Pop $1 -FunctionEnd -!macroend -!insertmacro StrStr "" -!insertmacro StrStr "un." - -;==================================================== -; IsNT - Returns 1 if the current system is NT, 0 -; otherwise. -; Output: head of the stack -;==================================================== -!macro IsNT un -Function ${un}IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." -win/settings.in deleted +0
-100@@ -1,100 +0,0 @@ -# Version numbers, settings, and dependencies -# for Windows OpenVPN installer. -# -# Note that some variables are parsed by wb.py from version.m4 and are not -# stored in this file. This is done to allow using the old and new Windows build -# systems side-by-side - -# Features to include. DO NOT comment these out, use 1 to enable and 0 to -# disable. -!define ENABLE_PASSWORD_SAVE 1 - -# ENABLE_CLIENT_SERVER enables the point-to-multipoint support. Normally you -# want to have this enabled. -!define ENABLE_CLIENT_SERVER 1 - -# ENABLE_CLIENT_ONLY removes server-side point-to-multipoint features. This -# depends on ENABLE_CLIENT_SERVER being set to 1. -!define ENABLE_CLIENT_ONLY 0 - -!define ENABLE_MANAGEMENT 1 -!define ENABLE_HTTP_PROXY 1 -!define ENABLE_SOCKS 1 -!define ENABLE_FRAGMENT 1 -!define ENABLE_DEBUG 1 - -# Branding -!define PRODUCT_NAME "OpenVPN" -!define PRODUCT_UNIX_NAME "openvpn" -!define PRODUCT_FILE_EXT "ovpn" - -# Include the OpenVPN GUI exe in the installer. Comment out USE_GUI to disable. -!define USE_GUI -!define OPENVPN_GUI_DIR "../openvpn-gui" -!define OPENVPN_GUI "openvpn-gui-1.0.3.exe" - -# Use either PolarSSL or OpenSSL. Only one may be active at a time -!define USE_POLARSSL 0 -!define USE_OPENSSL 1 - -# The same as above, but for library inclusion (must be defined/undefined due to build system) -;!define INCLUDE_POLARSSL -!define INCLUDE_OPENSSL - -# Uncomment to use the PKCS#11 helper library -!define USE_PKCS11 0 -;!define INCLUDE_PKCS11 - -# Prebuilt libraries. DMALLOC is optional. -!define OPENSSL_DIR "../openssl" -!define POLARSSL_DIR "../polarssl" -!define LZO_DIR "../lzo" -!define PKCS11_HELPER_DIR "../pkcs11-helper" - -# write output files here -!define DIST "dist" - -# tapinstall.exe (a.k.a. devcon.exe) source code. Not needed if DRVBINSRC is -# defined (or if using pre-built mode). -!define TISRC "../tapinstall" - -# TAP adapter icon -- visible=0x81 or hidden=0x89 -!define PRODUCT_TAP_CHARACTERISTICS 0x81 - -# TAP adapter metadata. Version information in ../version.m4. -!define PRODUCT_TAP_RELDATE "04/19/2010" -!define PRODUCT_TAP_DEVICE_DESCRIPTION "TAP-Win32 Adapter V9" -!define PRODUCT_TAP_PROVIDER "TAP-Win32 Provider V9" - -# Build debugging version of TAP driver -;!define PRODUCT_TAP_DEBUG - -# Build debugging version of openvpn.exe -;!define PRODUCT_OPENVPN_DEBUG - -# DDK path -- currently Windows 7 WDK -!define DDK_PATH "c:/winddk/7600.16385.1" -;!define DDK_PATH "c:/winddk/6001.18002" - -# output path for tap_span.py -!define TAP_DIST "tap_dist" - -# Visual studio path -!define MSVC "C:/Program Files/Microsoft Visual Studio 9.0" - -# Visual studio C run-time library path -!define MSVC_CRT "../Microsoft.VC90.CRT" - -# Code Signing. -# If undefined, don't sign any files. -!define SIGNTOOL "../signtool" -!define PRODUCT_SIGN_CN "openvpn" - -# Directory with prebuilt TAP drivers and tapinstall.exes -!define TAP_PREBUILT "../tap-prebuilt" - -; DEBUGGING -- set to something like "-DBG2" -!define OUTFILE_LABEL "" - -; DEBUGGING -- set to something like "DEBUG2" -!define TITLE_LABEL ""win/show.py deleted +0
-9@@ -1,9 +0,0 @@ -from wb import get_config -from js import JSON - -def main(): - print JSON().encode(get_config()) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - main()win/sign.py deleted +0
-23@@ -1,23 +0,0 @@ -import sys -from wb import config, choose_arch, home_fn - -if 'SIGNTOOL' in config: - sys.path.append(home_fn(config['SIGNTOOL'])) - -def main(conf, arch, tap_dir): - from signtool import SignTool - st = SignTool(conf, tap_dir) - for x64 in choose_arch(arch): - st.sign_verify(x64=x64) - -# if we are run directly, and not loaded as a module -if __name__ == "__main__": - if len(sys.argv) >= 2: - if len(sys.argv) >= 3: - tap_dir = home_fn(sys.argv[2]) - else: - tap_dir = None - main(config, sys.argv[1], tap_dir) - else: - print "usage: sign <x64|x86|all> [tap-dir]" - sys.exit(2)win/tap_span.py deleted +0
-129@@ -1,129 +0,0 @@ -import sys, os, shutil -from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp -if 'SIGNTOOL' in config: - sys.path.append(home_fn(config['SIGNTOOL'])) -from signtool import SignTool -from build_ddk import build_tap - -ti_dir = "c:/src/tapinstall" -hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64")) -low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",)) -dest_top = home_fn('tap_build') -dist = home_fn(config['TAP_DIST']) - -def copy_tap(src, dest, x64): - dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64]) - mkdir_silent(dest) - for dirpath, dirnames, filenames in os.walk(dir): - for f in filenames: - root, ext = os.path.splitext(f) - if ext in ('.inf', '.cat', '.sys'): - cp(os.path.join(dir, f), dest) - break - -def copy_tapinstall(src, dest, x64): - base = { False : 'i386', True: 'amd64' }[x64] - mkdir_silent(dest) - for dirpath, dirnames, filenames in os.walk(home_fn(src)): - for f in filenames: - if f == 'devcon.exe': - dir_name = os.path.basename(dirpath) - s = os.path.join(dirpath, f) - if dir_name == base: - cp(s, dest) - -def main(): - rm_rf(dest_top) - os.mkdir(dest_top) - - rm_rf(dist) - os.mkdir(dist) - - for ver in hi, low: - top = os.path.join(dest_top, str(ver[1])) - os.mkdir(top) - tap_dest = os.path.join(top, "tap-win32") - ti_dest = os.path.join(top, "tapinstall") - ti_src = os.path.join(ti_dir, str(ver[2])) - shutil.copytree(home_fn("tap-win32"), tap_dest) - shutil.copytree(ti_src, ti_dest) - - i386 = os.path.join(tap_dest, "i386") - amd64 = os.path.join(tap_dest, "amd64") - - build_amd64 = (len(ver[3]) >= 2) - - build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h')) - - st = SignTool(config, tap_dest) - - preprocess(config, - in_fn=os.path.join(tap_dest, 'SOURCES.in'), - out_fn=os.path.join(tap_dest, 'SOURCES'), - quote_begin='@@', - quote_end='@@', - head_comment='# %s\n\n' % autogen) - - preprocess(config, - in_fn=os.path.join(i386, 'OemWin2k.inf.in'), - out_fn=os.path.join(i386, 'OemWin2k.inf'), - quote_begin='@@', - quote_end='@@', - if_prefix='!', - head_comment='; %s\n\n' % autogen) - - preprocess(config, - in_fn=os.path.join(ti_dest, 'sources.in'), - out_fn=os.path.join(ti_dest, 'sources'), - if_prefix='!', - head_comment='# %s\n\n' % autogen) - - build_tap(ddk_path=ver[0], - ddk_major=ver[1], - debug=False, - dir=tap_dest, - x64=False) - - st.sign_verify(x64=False) - - build_tap(ddk_path=ver[0], - ddk_major=ver[1], - debug=False, - dir=ti_dest, - x64=False) - - tap_dist = os.path.join(dist, ver[3][0]) - - copy_tap(tap_dest, tap_dist, x64=False) - copy_tapinstall(ti_dest, tap_dist, x64=False) - - if build_amd64: - os.mkdir(amd64) - preprocess(dict_def(config, [('AMD64', '1')]), - in_fn=os.path.join(i386, 'OemWin2k.inf.in'), - out_fn=os.path.join(amd64, 'OemWin2k.inf'), - quote_begin='@@', - quote_end='@@', - if_prefix='!', - head_comment='; %s\n\n' % autogen) - - build_tap(ddk_path=ver[0], - ddk_major=ver[1], - debug=False, - dir=tap_dest, - x64=True) - - build_tap(ddk_path=ver[0], - ddk_major=ver[1], - debug=False, - dir=ti_dest, - x64=True) - - st.sign_verify(x64=True) - - tap_dist_x64 = os.path.join(dist, ver[3][1]) - - copy_tap(tap_dest, tap_dist_x64, x64=True) - copy_tapinstall(ti_dest, tap_dist_x64, x64=True) - -main()win/wb.py deleted +0
-323@@ -1,322 +0,0 @@ -# Python module containing general build functions -# for OpenVPN on Windows - -import os, re, shutil, stat - -autogen = "Automatically generated by OpenVPN Windows build system" - -def get_config(): - kv = {} - parse_version_m4(kv, home_fn('version.m4')) - parse_settings_in(kv, mod_fn('settings.in')) - - # config fixups - kv['DDKVER'] = os.path.basename(kv['DDK_PATH']) - kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0] - - if 'VERSION_SUFFIX' in kv: - kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX'] - - return kv - -def get_build_params(): - kv = {} - parse_build_params(kv,mod_fn('settings.in')) - - return kv - -def mod_fn(fn, src=__file__, real=True): - p = os.path.join(os.path.dirname(src), os.path.normpath(fn)) - if real: - p = os.path.realpath(p) - return p - -def home_fn(fn, real=True): - return mod_fn(os.path.join('..', fn), real=real) - -def cd_home(): - os.chdir(os.path.join(os.path.dirname(__file__), '..')) - -def cd_service_win32(): - os.chdir(os.path.join(os.path.dirname(__file__), '../service-win32')) - -def system(cmd): - print "RUN:", cmd - os.system(cmd) - -def run_in_vs_shell(cmd): - """Make sure environment variables are setup before running command""" - os.environ['PATH'] += ";%s\\VC" % (os.path.normpath(config['MSVC']),) - system('cmd /c "vcvarsall.bat x86 && %s"' % (cmd,)) - -def parse_version_m4(kv, version_m4): - '''Parse define lines in version.m4''' - r = re.compile(r'^define\((\w+),\[(.*)\]\)$') - f = open(version_m4) - for line in f: - line = line.rstrip() - m = re.match(r, line) - - if m: - g = m.groups() - - # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or - # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra - # variables, PRODUCT_TAP_MAJOR_VER and PRODUCT_TAP_MINOR_VER with - # the same contents. This is necessary because tap-win32/tapdrv.c - # build depends on those. - if g[0] == 'PRODUCT_TAP_WIN32_MIN_MAJOR': - kv['PRODUCT_TAP_MAJOR_VER'] = g[1] - elif g[0] == 'PRODUCT_TAP_WIN32_MIN_MINOR': - kv['PRODUCT_TAP_MINOR_VER'] = g[1] - - # Add the variable to build configuration - kv[g[0]] = g[1] - f.close() - -def parse_settings_in(kv, settings_in): - r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)?$') - f = open(settings_in) - for line in f: - line = line.rstrip() - m = re.match(r, line) - if m: - g = m.groups() - kv[g[0]] = g[1] or '' - f.close() - -def parse_build_params(kv, settings_in): - r = re.compile(r'^!define\s+(ENABLE_\w+)\s+(\w+)') - - f = open(settings_in) - - for line in f: - line = line.rstrip() - - # Check if this is a #define line starts with ENABLE_ - m = re.match(r, line) - - if m: - g = m.groups() - kv[g[0]] = g[1] or '' - f.close() - -def dict_def(dict, newdefs): - ret = dict.copy() - ret.update(newdefs) - return ret - -def build_autodefs(kv, autodefs_in, autodefs_out): - preprocess(kv, - in_fn=autodefs_in, - out_fn=autodefs_out, - quote_begin='@', - quote_end='@', - head_comment='/* %s */\n\n' % autogen) - -def build_config_h(kv): - """Generate static win/config.h to config.h to mimic autotools behavior""" - preprocess(kv, - in_fn=mod_fn('config.h.in'), - out_fn=home_fn('config.h'), - quote_begin='@', - quote_end='@', - head_comment='/* %s */\n\n' % autogen) - -def build_configure_h(kv, configure_h_out, head_comment): - """Generate a configure.h dynamically""" - fout = open(configure_h_out, 'w') - - # These two variables are required to view build parameters during runtime - configure_defines='#define CONFIGURE_DEFINES \"' - configure_call='#define CONFIGURE_CALL \" config_all.py \"' - - # Initialize the list of enabled features - features = '' - - # Write the header - fout.write(head_comment) - - dict = get_build_params() - - for key, value in dict.iteritems(): - # Add enabled features - features = features + "#define " + key + " " + value + "\n" - - # Add each enabled feature to CONFIGURE_DEFINES list - configure_defines = configure_defines + " " + key + "=" + value + "," - - configure_defines = configure_defines + "\"" + "\n" - - fout.write(features) - fout.write(configure_defines) - fout.write(configure_call) - - - fout.close() - -def build_version_m4_vars(version_m4_vars_out, head_comment): - """Generate a temporary file containing variables from version.m4 in -win/settings.in format. This done to allow importing them in win/openvpn.nsi""" - - fout = open(version_m4_vars_out, 'w') - fout.write(head_comment) - - kv = {} - parse_version_m4(kv, home_fn('version.m4')) - - for key, value in kv.iteritems(): - line = "!define " + key + "\t" + "\"" + value + "\"" + "\n" - fout.write(line) - - fout.close() - -def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None): - def repfn(m): - var, = m.groups() - return kv.get(var, '') - - re_macro = re_ifdef = None - - if quote_begin and quote_end: - re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end))) - - if if_prefix: - re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),)) - re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),)) - re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),)) - - if_stack = [] - fin = open(in_fn) - fout = open(out_fn, 'w') - if head_comment: - fout.write(head_comment) - for line in fin: - if re_ifdef: - m = re.match(re_ifdef, line) - if m: - var, = m.groups() - if_stack.append(int(var in kv)) - continue - elif re.match(re_else, line): - if_stack[-1] ^= 1 - continue - elif re.match(re_endif, line): - if_stack.pop() - continue - if not if_stack or min(if_stack): - if re_macro: - line = re.sub(re_macro, repfn, line) - fout.write(line) - assert not if_stack - fin.close() - fout.close() - -def print_key_values(kv): - for k, v in sorted(kv.items()): - print "%s%s%s" % (k, ' '*(32-len(k)), repr(v)) - -def get_sources(makefile_am): - """Parse ../Makefile.am to obtain a list of .h and .c files""" - c = set() - h = set() - f = open(makefile_am) - state = False - for line in f: - line = line.rstrip() - if line == 'openvpn_SOURCES = \\': - state = True - elif not line: - state = False - elif state: - for sf in line.split(): - if sf.endswith('.c'): - c.add(sf[:-2]) - elif sf.endswith('.h'): - h.add(sf[:-2]) - elif sf == '\\': - pass - else: - print >>sys.stderr, "Unrecognized filename:", sf - f.close() - return [ sorted(list(s)) for s in (c, h) ] - -def output_mak_list(title, srclist, ext): - ret = "%s =" % (title,) - for x in srclist: - ret += " \\\n\t%s.%s" % (x, ext) - ret += '\n\n' - return ret - -def make_headers_objs(makefile_am): - """Generate HEADER and OBJS entries dynamically from ../Makefile.am""" - c, h = get_sources(makefile_am) - ret = output_mak_list('HEADERS', h, 'h') - ret += output_mak_list('OBJS', c, 'obj') - return ret - -def choose_arch(arch_name): - if arch_name == 'x64': - return (True,) - elif arch_name == 'x86': - return (False,) - elif arch_name == 'all': - return (True, False) - else: - raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,)) - -def rm_rf(dir): - print "REMOVE", dir - shutil.rmtree(dir, ignore_errors=True) - -def mkdir(dir): - print "MKDIR", dir - os.mkdir(dir) - -def cp_a(src, dest, dest_is_dir=True): - if dest_is_dir: - dest = os.path.join(dest, os.path.basename(src)) - print "COPY_DIR %s %s" % (src, dest) - shutil.copytree(src, dest) - -def cp(src, dest, dest_is_dir=True): - if dest_is_dir: - dest = os.path.join(dest, os.path.basename(src)) - print "COPY %s %s" % (src, dest) - shutil.copyfile(src, dest) - -def rename(src, dest): - print "RENAME %s %s" % (src, dest) - shutil.move(src, dest) - -def rm_rf(path): - try: - shutil.rmtree(path, onerror=onerror) - except: - pass - -def onerror(func, path, exc_info): - """ - Error handler for ``shutil.rmtree``. - - If the error is due to an access error (read only file) - it attempts to add write permission and then retries. - - If the error is for another reason it re-raises the error. - - Usage : ``shutil.rmtree(path, onerror=onerror)`` - """ - if not os.access(path, os.W_OK): - # Is the error an access error ? - os.chmod(path, stat.S_IWUSR) - func(path) - else: - raise - -def mkdir_silent(dir): - try: - os.mkdir(dir) - except: - pass - -config = get_config() --1.7.3.4
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH 22/52 build: split acinclude.m4 into m4/*
In reply to Alon Bar-Levax_emptyarray.m4 ax_openvpn_lib.m4 ax_socklen_t.m4 ax_varargs.m4
--- Makefile.am | 1 + acinclude.m4 | 131 -------------------------------------------------- configure.ac | 1 + m4/ax_emptyarray.m4 | 27 ++++++++++ m4/ax_openvpn_lib.m4 | 4 ++ m4/ax_socklen_t.m4 | 50 +++++++++++++++++++ m4/ax_varargs.m4 | 43 ++++++++++++++++ 7 files changed, 126 insertions(+), 131 deletions(-) delete mode 100644 acinclude.m4 create mode 100644 m4/.keep create mode 100644 m4/ax_emptyarray.m4 create mode 100644 m4/ax_openvpn_lib.m4 create mode 100644 m4/ax_socklen_t.m4 create mode 100644 m4/ax_varargs.m4
Makefile.am +1 -0
@@ -28,6 +28,7 @@ LDADD = @LIBOBJS@ # This option prevents autoreconf from overriding our COPYING and # INSTALL targets: AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \ config.log config.status \
acinclude.m4 deleted +0 -131
131 lines not on this page · raw message
configure.ac +1 -0
@@ -32,6 +32,7 @@ AC_CONFIG_SRCDIR(syshead.h) dnl Guess host type. AC_CANONICAL_HOST +AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE(openvpn, [$PACKAGE_VERSION]) AC_ARG_WITH(cygwin-native,
m4/.keep new file +0 -0
m4/ax_emptyarray.m4 new file +27 -0
@@ -0,0 +1,27 @@ +dnl @synopsis AX_EMPTY_ARRAY +dnl +dnl Define EMPTY_ARRAY_SIZE to be either "0" +dnl or "" depending on which syntax the compiler +dnl prefers for empty arrays in structs. +dnl +dnl @version +dnl @author James Yonan <[email protected]...> +AC_DEFUN([AX_EMPTY_ARRAY], [ + AC_MSG_RESULT([checking for C compiler empty array support]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [ + struct { int foo; int bar[[0]]; } mystruct; + ])], [ + AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration]) + ], [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [ + struct { int foo; int bar[[]]; } mystruct; + ])], [ + AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration]) + ], [ + AC_MSG_ERROR([C compiler is unable to creaty empty arrays]) + ]) + ]) + ] +)
m4/ax_openvpn_lib.m4 new file +4 -0
@@ -0,0 +1,4 @@ +dnl OPENVPN_ADD_LIBS(LIB) +AC_DEFUN([OPENVPN_ADD_LIBS], [ + LIBS="$1 $LIBS" +])
m4/ax_socklen_t.m4 new file +50 -0
50 lines not on this page · raw message
m4/ax_varargs.m4 new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 23/52 build: m4/ax_varargs.m4: cleanup
In reply to Alon Bar-Lev--- m4/ax_varargs.m4 | 78 ++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 55 insertions(+), 23 deletions(-)
m4/ax_varargs.m4 +55 -23
@@ -6,18 +6,34 @@ dnl dnl @version dnl @author James Yonan <[email protected]...>, Matthias Andree <[email protected]...> AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl - AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_gcc])dnl - AC_CACHE_CHECK([for GNU GCC vararg macro support], VAR, [dnl - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - #define macro(a, b...) func(a, b) - int func(int a, int b, int c); - int test() { return macro(1, 2, 3); } - ])], [ VAR=yes ], [VAR=no])]) - if test $VAR = yes ; then - AC_DEFINE([HAVE_CPP_VARARG_MACRO_GCC], 1, - [Define to 1 if your compiler supports GNU GCC-style variadic macros]) - fi - AS_VAR_POPDEF([VAR])dnl + AS_VAR_PUSHDEF([VAR], [ax_cv_cpp_vararg_macro_gcc])dnl + AC_CACHE_CHECK( + [for GNU GCC vararg macro support], + [VAR], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + , + [[ +#define macro(a, b...) func(a, b) +int func(int a, int b, int c); +int test() { return macro(1, 2, 3); } + ]] + )], + [VAR=yes], + [VAR=no] + )] + )dnl + + AS_VAR_IF( + [VAR], + [yes], + [AC_DEFINE( + [HAVE_CPP_VARARG_MACRO_GCC], + [1], + [Define to 1 if your compiler supports GNU GCC-style variadic macros] + )] + )dnl + AS_VAR_POPDEF([VAR])dnl ]) dnl @synopsis AX_CPP_VARARG_MACRO_ISO
@@ -28,16 +44,32 @@ dnl dnl @version dnl @author James Yonan <[email protected]...>, Matthias Andree <[email protected]...> AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl - AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl - AC_CACHE_CHECK([for ISO C 1999 vararg macro support], VAR, [dnl - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl + AC_CACHE_CHECK( + [for ISO C 1999 vararg macro support], + [VAR], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + , + [[ #define macro(a, ...) func(a, __VA_ARGS__) - int func(int a, int b, int c); - int test() { return macro(1, 2, 3); } - ])], [ VAR=yes ], [VAR=no])]) - if test $VAR = yes ; then - AC_DEFINE([HAVE_CPP_VARARG_MACRO_ISO], 1, - [Define to 1 if your compiler supports ISO C99 variadic macros]) - fi - AS_VAR_POPDEF([VAR])dnl +int func(int a, int b, int c); +int test() { return macro(1, 2, 3); } + ]] + )], + [VAR=yes], + [VAR=no] + )] + )dnl + + AS_VAR_IF( + [VAR], + [yes], + [AC_DEFINE( + [HAVE_CPP_VARARG_MACRO_ISO], + [1], + [Define to 1 if your compiler supports ISO C99 variadic macros] + )] + )dnl + AS_VAR_POPDEF([VAR])dnl ])
Signature · 1 line
1.7.3.4
PATCH 24/52 build: m4/ax_emptyarray.m4: cleanup
In reply to Alon Bar-Lev--- m4/ax_emptyarray.m4 | 49 +++++++++++++++++++++++++++++++------------------ 1 files changed, 31 insertions(+), 18 deletions(-)
m4/ax_emptyarray.m4 +31 -18
@@ -7,21 +7,34 @@ dnl dnl @version dnl @author James Yonan <[email protected]...> AC_DEFUN([AX_EMPTY_ARRAY], [ - AC_MSG_RESULT([checking for C compiler empty array support]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE( - [ - struct { int foo; int bar[[0]]; } mystruct; - ])], [ - AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration]) - ], [ - AC_COMPILE_IFELSE([AC_LANG_SOURCE( - [ - struct { int foo; int bar[[]]; } mystruct; - ])], [ - AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration]) - ], [ - AC_MSG_ERROR([C compiler is unable to creaty empty arrays]) - ]) - ]) - ] -) + AS_VAR_PUSHDEF([VAR],[ax_cv_c_empty_array])dnl + AC_CACHE_CHECK( + [for C compiler empty array size], + [VAR], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + , + [[ +struct { int foo; int bar[0]; } mystruct; + ]] + )], + [VAR=0], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + , + [[ +struct { int foo; int bar[]; } mystruct; + ]] + )], + [VAR=], + [AC_MSG_ERROR([C compiler is unable to creaty empty arrays])] + )] + )] + )dnl + AC_DEFINE_UNQUOTED( + [EMPTY_ARRAY_SIZE], + [$VAR], + [Dimension to use for empty array declaration] + )dnl + AS_VAR_POPDEF([VAR])dnl +])
Signature · 1 line
1.7.3.4
PATCH 25/52 build: m4/ax_socklen_t.m4: cleanup
In reply to Alon Bar-Lev--- configure.ac | 2 +- m4/ax_socklen_t.m4 | 97 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 57 insertions(+), 42 deletions(-)
configure.ac +1 -1
@@ -381,10 +381,10 @@ AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T -TYPE_SOCKLEN_T AC_HEADER_TIME AX_CPP_VARARG_MACRO_ISO AX_CPP_VARARG_MACRO_GCC +AX_TYPE_SOCKLEN_T AX_EMPTY_ARRAY dnl Check for more header files.
m4/ax_socklen_t.m4 +56 -41
106 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 26/52 build: autotools: first pass of trivial autotools changes
In reply to Alon Bar-Lev--- Makefile.am | 22 +- compat.m4 | 70 +++ configure.ac | 1249 ++++++++++++++++++++++++++----------------------------- lladdr.c | 2 +- misc.c | 30 +-- misc.h | 2 +- openvpn.spec.in | 11 +- options.c | 12 +- route.c | 18 +- sig.c | 4 + socket.c | 2 +- syshead.h | 45 +-- tun.c | 6 +- version.m4 | 11 +- win32.h | 11 - 15 files changed, 738 insertions(+), 757 deletions(-) create mode 100644 compat.m4
Makefile.am +14 -8
@@ -23,11 +23,9 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -LDADD = @LIBOBJS@ - # This option prevents autoreconf from overriding our COPYING and # INSTALL targets: -AUTOMAKE_OPTIONS = foreign +AUTOMAKE_OPTIONS = foreign 1.9 ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \
@@ -62,11 +60,22 @@ dist_noinst_SCRIPTS = \ t_cltsrv-down.sh \ configure_h.awk configure_log.awk +dist_doc_DATA = \ + COPYRIGHT.GPL \ + COPYING + dist_noinst_DATA = \ + .gitignore \ openvpn.spec \ - COPYRIGHT.GPL \ PORTS \ - INSTALL-win32.txt + README.IPv6 TODO.IPv6 \ + README.polarssl \ + +if WIN32 +dist_doc_DATA += INSTALL-win32.txt +else +dist_noinst_DATA += INSTALL-win32.txt +endif openvpn_SOURCES = \ base64.c base64.h \
@@ -154,9 +163,6 @@ configure.h: Makefile awk -f $(srcdir)/configure_h.awk config.h > $@ awk -f $(srcdir)/configure_log.awk config.log >> $@ -dist-hook: - cd $(distdir) && for i in $(EXTRA_DIST) $(SUBDIRS) ; do find $$i -name .svn -type d -prune -exec rm -rf '{}' ';' ; rm -f `find $$i -type f | grep -E '(^|\/)\.?\#|\~$$|\.s?o$$'` ; done - if WIN32 dist_noinst_DATA += openvpn.8 nodist_html_DATA = openvpn.8.html
compat.m4 new file +70 -0
70 lines not on this page · raw message
configure.ac +598 -651
1,467 lines not on this page · raw message
lladdr.c +1 -1
@@ -16,7 +16,7 @@ int set_lladdr(const char *ifname, const char *lladdr,return -1 ;#if defined(TARGET_LINUX ) -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE argv_printf (&argv,"%s link set addr %s dev %s" , iproute_path, lladdr, ifname);
misc.c +4 -26
@@ -39,7 +39,7 @@#include "memdbg.h" -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE const char *iproute_path =IPROUTE_PATH ;/* GLOBAL */ #endif
@@ -519,7 +519,7 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned iif (a && a->argv[0 ]) { -#if defined(ENABLE_EXECVE ) +#if defined(ENABLE_FEATURE_EXECVE )if (openvpn_execve_allowed (flags)) {if (script_method ==SM_EXECVE )
@@ -651,7 +651,7 @@ openvpn_popen (const struct argv *a, const struct env_set *es)if (a && a->argv[0 ]) { -#if defined(ENABLE_EXECVE ) +#if defined(ENABLE_FEATURE_EXECVE )if (script_security >=SSEC_BUILT_IN ) {const char *cmd = a->argv[0 ];
@@ -1785,28 +1785,6 @@ get_auth_challenge (const char *auth_challenge, struct gc_arena *gc)#if AUTO_USERID -static const char * -get_platform_prefix (void ) -{ -#if defined(TARGET_LINUX ) -return "L" ; -#elif defined(TARGET_SOLARIS ) -return "S" ; -#elif defined(TARGET_OPENBSD ) -return "O" ; -#elif defined(TARGET_DARWIN ) -return "M" ; -#elif defined(TARGET_NETBSD ) -return "N" ; -#elif defined(TARGET_FREEBSD ) -return "F" ; -#elif defined(WIN32 ) -return "W" ; -#else -return "X" ; -#endif -} -void get_user_pass_auto_userid (struct user_pass *up,const char *tag) {
@@ -1821,7 +1799,7 @@ get_user_pass_auto_userid (struct user_pass *up, const char *tag)CLEAR (*up);buf_set_write (&buf, (uint8_t *)up->username,USER_PASS_LEN ); -buf_printf (&buf,"%s" ,get_platform_prefix ()); +buf_printf (&buf,"%s" ,TARGET_PREFIX );if (get_default_gateway_mac_addr (macaddr)) {dmsg (D_AUTO_USERID ,"GUPAU: macaddr=%s" ,format_hex_ex (macaddr,sizeof (macaddr),0 ,1 ,":" , &gc));
misc.h +1 -1
@@ -396,7 +396,7 @@ void get_user_pass_auto_userid (struct user_pass *up, const char *tag);/* * /sbin/ip path, may be overridden */ -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE extern const char *iproute_path;#endif
openvpn.spec.in +2 -9
@@ -120,14 +120,7 @@ popd %install [ %{buildroot} != "/" ] && rm -rf %{buildroot} - -# Install man page -%__install -c -d -m 755 %{buildroot}%{_mandir}/man8 -%__install -c -m 755 %{name}.8 %{buildroot}%{_mandir}/man8 - -# Install binary -%__install -c -d -m 755 %{buildroot}%{_sbindir} -%__install -c -m 755 %{name} %{buildroot}%{_sbindir} +%__make install DESTDIR="%{buildroot}" # Install init script %if "%{VENDOR}" == "SuSE"
@@ -211,7 +204,7 @@ fi %files %defattr(-,root,root) %doc AUTHORS ChangeLog COPYING COPYRIGHT.GPL INSTALL NEWS PORTS README -%{_mandir}/man8/%{name}.8* +%{_mandir} %{_sbindir}/%{name} %{_datadir}/%{name} %dir /etc/%{name}
options.c +6 -6
@@ -181,7 +181,7 @@ static const char usage_message[] = "--lladdr hw : Set the link layer address of the tap device.\n" "--topology t : Set --dev tun topology: 'net30', 'p2p', or 'subnet'.\n" "--tun-ipv6 : Build tun link capable of forwarding IPv6 traffic.\n" -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE "--iproute cmd : Use this command instead of default " IPROUTE_PATH ".\n" #endif"--ifconfig l rn : TUN: configure device to use IP address l as a local\n"
@@ -292,7 +292,7 @@ static const char usage_message[] =" or --fragment max value, whichever is lower.\n" "--sndbuf size : Set the TCP/UDP send buffer size.\n" "--rcvbuf size : Set the TCP/UDP receive buffer size.\n" -#if defined(TARGET_LINUX ) && defined(HAVE_SO_MARK ) +#if defined(TARGET_LINUX ) &&HAVE_DECL_SO_MARK "--mark value : Mark encrypted packets being sent with value. The mark value\n" " can be matched in policy routing and packetfilter rules.\n"#endif
@@ -1506,7 +1506,7 @@ show_settings (const struct options *o)#endif SHOW_INT (rcvbuf);SHOW_INT (sndbuf); -#if defined(TARGET_LINUX ) && defined(HAVE_SO_MARK ) +#if defined(TARGET_LINUX ) &&HAVE_DECL_SO_MARK SHOW_INT (mark);#endif SHOW_INT (sockflags);
@@ -3188,7 +3188,7 @@ options_cmp_equal_safe (char *actual, const char *expected, size_t actual_n)if (actual_n >0 ) { actual[actual_n -1 ] =0 ; -#ifndef STRICT_OPTIONS_CHECK +#ifndef ENABLE_STRICT_OPTIONS_CHECK if (strncmp (actual, expected,2 )) {msg (D_SHOW_OCC ,"NOTE: Options consistency check may be skewed by version differences" );
@@ -4307,7 +4307,7 @@ add_option (struct options *options,VERIFY_PERMISSION (OPT_P_UP ); options->tun_ipv6 = true; } -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE else if (streq (p[0], "iproute") && p[1]) {VERIFY_PERMISSION (OPT_P_GENERAL );
@@ -4798,7 +4798,7 @@ add_option (struct options *options, }else if (streq (p[0 ],"mark" ) && p[1 ]) { -#if defined(TARGET_LINUX ) && defined(HAVE_SO_MARK ) +#if defined(TARGET_LINUX ) &&HAVE_DECL_SO_MARK VERIFY_PERMISSION (OPT_P_GENERAL ); options->mark =atoi (p[1 ]);#endif
route.c +9 -9
@@ -1308,8 +1308,8 @@ add_route (struct route *r, goto done;#if defined(TARGET_LINUX ) -#ifdef CONFIG_FEATURE_IPROUTE -/* FIXME -- add on-link support for CONFIG_FEATURE_IPROUTE */ +#ifdef ENABLE_IPROUTE +/* FIXME -- add on-link support for ENABLE_IPROUTE */ argv_printf (&argv, "%s route add %s/%d via %s", iproute_path, network,
@@ -1330,7 +1330,7 @@ add_route (struct route *r, else argv_printf_cat (&argv, "gw %s", gateway); -#endif /*CONFIG_FEATURE_IPROUTE*/ +#endif /*ENABLE_IPROUTE*/ argv_msg (D_ROUTE , &argv); status =openvpn_execve_check (&argv, es,0 ,"ERROR: Linux route add command failed" );
@@ -1566,7 +1566,7 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla*/ #if defined(TARGET_LINUX ) -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE argv_printf (&argv, "%s -6 route add %s/%d dev %s", iproute_path, network,
@@ -1583,7 +1583,7 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla device);if (r6->metric_defined)argv_printf_cat (&argv," metric %d" , r6->metric); -#endif /*CONFIG_FEATURE_IPROUTE*/ +#endif /*ENABLE_IPROUTE*/ argv_msg (D_ROUTE , &argv); status =openvpn_execve_check (&argv, es,0 ,"ERROR: Linux route -6/-A inet6 add command failed" );
@@ -1717,7 +1717,7 @@ delete_route (struct route *r, goto done;#if defined(TARGET_LINUX ) -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE argv_printf (&argv, "%s route del %s/%d", iproute_path, network,
@@ -1727,7 +1727,7 @@ delete_route (struct route *r,ROUTE_PATH , network, netmask); -#endif /*CONFIG_FEATURE_IPROUTE*/ +#endif /*ENABLE_IPROUTE*/ if (r->flags &RT_METRIC_DEFINED )argv_printf_cat (&argv,"metric %d" , r->metric);argv_msg (D_ROUTE , &argv);
@@ -1876,7 +1876,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsignemsg (M_INFO ,"delete_route_ipv6(%s/%d)" , network, r6->netbits );#if defined(TARGET_LINUX ) -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE argv_printf (&argv, "%s -6 route del %s/%d dev %s", iproute_path, network,
@@ -1888,7 +1888,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne network, r6->netbits, device); -#endif /*CONFIG_FEATURE_IPROUTE*/ +#endif /*ENABLE_IPROUTE*/ argv_msg (D_ROUTE , &argv);openvpn_execve_check (&argv, es,0 ,"ERROR: Linux route -6/-A inet6 del command failed" );
sig.c +4 -0
@@ -199,6 +199,7 @@ static int signal_mode; /* GLOBAL */void pre_init_signal_catch (void ) { +#ifndef WIN32 #ifdef HAVE_SIGNAL_H signal_mode =SM_PRE_INIT ;signal (SIGINT , signal_handler);
@@ -208,11 +209,13 @@ pre_init_signal_catch (void)signal (SIGUSR2 ,SIG_IGN );signal (SIGPIPE ,SIG_IGN );#endif /* HAVE_SIGNAL_H */ +#endif /* WIN32 */ }void post_init_signal_catch (void ) { +#ifndef WIN32 #ifdef HAVE_SIGNAL_H signal_mode =SM_POST_INIT ;signal (SIGINT , signal_handler);
@@ -222,6 +225,7 @@ post_init_signal_catch (void)signal (SIGUSR2 , signal_handler);signal (SIGPIPE ,SIG_IGN );#endif /* HAVE_SIGNAL_H */ +#endif }/* called after daemonization to retain signal settings */
socket.c +1 -1
@@ -782,7 +782,7 @@ socket_set_tcp_nodelay (int sd, int state)static inline void socket_set_mark (int sd,int mark) { -#if defined(TARGET_LINUX ) && defined(HAVE_SO_MARK ) +#if defined(TARGET_LINUX ) &&HAVE_DECL_SO_MARK if (mark &&setsockopt (sd,SOL_SOCKET ,SO_MARK , &mark,sizeof (mark)) !=0 )msg (M_WARN ,"NOTE: setsockopt SO_MARK=%d failed" , mark);#endif
syshead.h +18 -27
92 lines not on this page · raw message
tun.c +3 -3
@@ -673,7 +673,7 @@ do_ifconfig (struct tuntap *tt,#if defined(TARGET_LINUX ) -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE /* * Set the MTU for the device */
@@ -761,7 +761,7 @@ do_ifconfig (struct tuntap *tt, } tt->did_ifconfig = true; -#endif /*CONFIG_FEATURE_IPROUTE*/ +#endif /*ENABLE_IPROUTE*/ #elif defined(TARGET_SOLARIS)/* Solaris 2.6 (and 7?) cannot set all parameters in one go...
@@ -1574,7 +1574,7 @@ close_tun (struct tuntap *tt)struct gc_arena gc =gc_new ();argv_init (&argv); -#ifdef CONFIG_FEATURE_IPROUTE +#ifdef ENABLE_IPROUTE if (is_tun_p2p (tt)) { argv_printf (&argv,
version.m4 +7 -4
@@ -1,6 +1,9 @@ dnl define the OpenVPN version -define(PRODUCT_VERSION,[2.3_alpha1]) +define([PRODUCT_NAME], [OpenVPN]) +define([PRODUCT_TARNAME], [openvpn]) +define([PRODUCT_VERSION], [2.3_alpha1]) +define([PRODUCT_BUGREPORT], [[email protected]]) dnl define the TAP version -define(PRODUCT_TAP_WIN_COMPONENT_ID,[tap0901]) -define(PRODUCT_TAP_WIN_MIN_MAJOR,[9]) -define(PRODUCT_TAP_WIN_MIN_MINOR,[9]) +define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901]) +define([PRODUCT_TAP_WIN_MIN_MAJOR], [9]) +define([PRODUCT_TAP_WIN_MIN_MINOR], [9])
win32.h +0 -11
@@ -51,17 +51,6 @@ void uninit_win32 (void);void set_pause_exit_win32 (void ); -/* -* Use keyboard input or events -* to simulate incoming signals -*/ - -#define SIGUSR1 1 -#define SIGUSR2 2 -#define SIGHUP 3 -#define SIGTERM 4 -#define SIGINT 5 -struct security_attributes {SECURITY_ATTRIBUTES sa;
Signature · 1 line
1.7.3.4
PATCH 27/52 build: autoconf: remove OPENVPN_ADD_LIBS useless macro
In reply to Alon Bar-Lev--- configure.ac | 26 ++++++++++---------------- m4/ax_openvpn_lib.m4 | 4 ---- 2 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 m4/ax_openvpn_lib.m4
configure.ac +10 -16
@@ -352,13 +352,7 @@ case "$host" in AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix]) CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501" WIN32=yes - OPENVPN_ADD_LIBS(-lgdi32) - OPENVPN_ADD_LIBS(-lws2_32) - OPENVPN_ADD_LIBS(-lwininet) - OPENVPN_ADD_LIBS(-lcrypt32) - OPENVPN_ADD_LIBS(-liphlpapi) - OPENVPN_ADD_LIBS(-lwinmm) - OPENVPN_ADD_LIBS(-lshell32) + LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32" ;; *-*-dragonfly*) AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
@@ -640,7 +634,7 @@ case "${with_mem_check}" in [dmalloc], [malloc], [ - OPENVPN_ADD_LIBS(-ldmalloc) + LIBS="${LIBS} -ldmalloc" AC_DEFINE( [DMALLOC], [1],
@@ -682,7 +676,7 @@ if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then [dl], [dlopen], [ - OPENVPN_ADD_LIBS(-ldl) + LIBS="${LIBS} -ldl" AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading]) ], [AC_MSG_RESULT([libdl library not found.])]
@@ -721,7 +715,7 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then if test $havelzolib = 1 ; then break ; fi AC_CHECK_LIB($i, lzo1x_1_15_compress, [ - OPENVPN_ADD_LIBS(-l$i) + LIBS="${LIBS} -l$i" AC_DEFINE(USE_LZO, 1, [Use LZO compression library]) AC_DEFINE_UNQUOTED(LZO_VERSION_NUM, "$LZO_H", [LZO version number]) havelzolib=1
@@ -752,7 +746,7 @@ if test "${enable_pkcs11}" = "yes"; then [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize, [ AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability]) - OPENVPN_ADD_LIBS(-lpkcs11-helper) + LIBS="${LIBS} -lpkcs11-helper" ], [AC_MSG_RESULT([pkcs11-helper library not found.])] )],
@@ -773,7 +767,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_LIB($lib, EVP_CIPHER_CTX_init, [ cryptofound=1 - OPENVPN_ADD_LIBS(-l$lib) + LIBS="${LIBS} -l$lib" ] ) done
@@ -807,7 +801,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_HEADER(polarssl/aes.h, [AC_CHECK_LIB(polarssl, aes_crypt_cbc, [ - OPENVPN_ADD_LIBS(-lpolarssl) + LIBS="${LIBS} -lpolarssl" AC_DEFINE(USE_CRYPTO, 1, [Use crypto library]) AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library]) ],
@@ -831,7 +825,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_LIB($lib, SSL_CTX_new, [ sslfound=1 - OPENVPN_ADD_LIBS(-l$lib) + LIBS="${LIBS} -l$lib" ] ) done
@@ -845,7 +839,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_HEADER(polarssl/ssl.h, [AC_CHECK_LIB(polarssl, ssl_init, [ - OPENVPN_ADD_LIBS(-lpolarssl) + LIBS="${LIBS} -lpolarssl" AC_DEFINE(USE_SSL, 1, [Use SSL library]) AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library]) ],
@@ -867,7 +861,7 @@ if test "${enable_selinux}" = "yes"; then [selinux], [setcon], [ - OPENVPN_ADD_LIBS(-lselinux) + LIBS="${LIBS} -lselinux" AC_DEFINE(HAVE_SETCON, 1, [SELinux support]) ], [AC_MSG_RESULT([SELinux library not found.])]
m4/ax_openvpn_lib.m4 deleted +0 -4
@@ -1,4 +0,0 @@ -dnl OPENVPN_ADD_LIBS(LIB) -AC_DEFUN([OPENVPN_ADD_LIBS], [ - LIBS="$1 $LIBS" -])
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 27/52] build: autoconf: remove OPENVPN_ADD_LIBS useless macro
Looks fairly straightforward: the OPENVPN_ADD_LIBS(LIB) macro[1] from "acinclude.m4" is being phased out, e.g.
OPENVPN_ADD_LIBS(-ldmalloc)
becomes
LIBS="${LIBS} -ldmalloc"
I don't think the macro does anything _that_ special it would be worth saving.
ACK.
Signature · 13 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock [1] dnl OPENVPN_ADD_LIBS(LIB) AC_DEFUN([OPENVPN_ADD_LIBS], [ LIBS="$1 $LIBS" ])
Quoted 117 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 26 ++++++++++---------------- m4/ax_openvpn_lib.m4 | 4 ---- 2 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 m4/ax_openvpn_lib.m4configure.ac +10
-16@@ -352,13 +352,7 @@ case "$host" in AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix]) CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501" WIN32=yes - OPENVPN_ADD_LIBS(-lgdi32) - OPENVPN_ADD_LIBS(-lws2_32) - OPENVPN_ADD_LIBS(-lwininet) - OPENVPN_ADD_LIBS(-lcrypt32) - OPENVPN_ADD_LIBS(-liphlpapi) - OPENVPN_ADD_LIBS(-lwinmm) - OPENVPN_ADD_LIBS(-lshell32) + LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32" ;; *-*-dragonfly*) AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])@@ -640,7 +634,7 @@ case "${with_mem_check}" in [dmalloc], [malloc], [ - OPENVPN_ADD_LIBS(-ldmalloc) + LIBS="${LIBS} -ldmalloc" AC_DEFINE( [DMALLOC], [1],@@ -682,7 +676,7 @@ if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then [dl], [dlopen], [ - OPENVPN_ADD_LIBS(-ldl) + LIBS="${LIBS} -ldl" AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading]) ], [AC_MSG_RESULT([libdl library not found.])]@@ -721,7 +715,7 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then if test $havelzolib = 1 ; then break ; fi AC_CHECK_LIB($i, lzo1x_1_15_compress, [ - OPENVPN_ADD_LIBS(-l$i) + LIBS="${LIBS} -l$i" AC_DEFINE(USE_LZO, 1, [Use LZO compression library]) AC_DEFINE_UNQUOTED(LZO_VERSION_NUM, "$LZO_H", [LZO version number]) havelzolib=1@@ -752,7 +746,7 @@ if test "${enable_pkcs11}" = "yes"; then [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize, [ AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability]) - OPENVPN_ADD_LIBS(-lpkcs11-helper) + LIBS="${LIBS} -lpkcs11-helper" ], [AC_MSG_RESULT([pkcs11-helper library not found.])] )],@@ -773,7 +767,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_LIB($lib, EVP_CIPHER_CTX_init, [ cryptofound=1 - OPENVPN_ADD_LIBS(-l$lib) + LIBS="${LIBS} -l$lib" ] ) done@@ -807,7 +801,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_HEADER(polarssl/aes.h, [AC_CHECK_LIB(polarssl, aes_crypt_cbc, [ - OPENVPN_ADD_LIBS(-lpolarssl) + LIBS="${LIBS} -lpolarssl" AC_DEFINE(USE_CRYPTO, 1, [Use crypto library]) AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library]) ],@@ -831,7 +825,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_LIB($lib, SSL_CTX_new, [ sslfound=1 - OPENVPN_ADD_LIBS(-l$lib) + LIBS="${LIBS} -l$lib" ] ) done@@ -845,7 +839,7 @@ if test "${enable_crypto}" = "yes"; then AC_CHECK_HEADER(polarssl/ssl.h, [AC_CHECK_LIB(polarssl, ssl_init, [ - OPENVPN_ADD_LIBS(-lpolarssl) + LIBS="${LIBS} -lpolarssl" AC_DEFINE(USE_SSL, 1, [Use SSL library]) AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library]) ],@@ -867,7 +861,7 @@ if test "${enable_selinux}" = "yes"; then [selinux], [setcon], [ - OPENVPN_ADD_LIBS(-lselinux) + LIBS="${LIBS} -lselinux" AC_DEFINE(HAVE_SETCON, 1, [SELinux support]) ], [AC_MSG_RESULT([SELinux library not found.])]m4/ax_openvpn_lib.m4 deleted +0
-4@@ -1,4 +0,0 @@ -dnl OPENVPN_ADD_LIBS(LIB) -AC_DEFUN([OPENVPN_ADD_LIBS], [ - LIBS="$1 $LIBS" -])
PATCH 28/52 build: remove awk and non-standard autoconf output processing
In reply to Alon Bar-LevReplace with simpler environment solution.
--- Makefile.am | 12 ++---------- configure.ac | 3 +++ configure_h.awk | 39 --------------------------------------- configure_log.awk | 33 --------------------------------- options.c | 4 ---- 5 files changed, 5 insertions(+), 86 deletions(-) delete mode 100644 configure_h.awk delete mode 100644 configure_log.awk
Makefile.am +2 -10
@@ -36,7 +36,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/depcomp $(srcdir)/aclocal.m4 \ $(srcdir)/config.guess $(srcdir)/config.sub \ $(srcdir)/openvpn.spec -CLEANFILES = openvpn.8.html configure.h +CLEANFILES = openvpn.8.html EXTRA_DIST = \ sample-config-files \
@@ -57,8 +57,7 @@ dist_doc_DATA = \ dist_noinst_SCRIPTS = \ $(TESTS) \ - t_cltsrv-down.sh \ - configure_h.awk configure_log.awk + t_cltsrv-down.sh dist_doc_DATA = \ COPYRIGHT.GPL \
@@ -156,13 +155,6 @@ openvpn_SOURCES = \ win32.h win32.c \ cryptoapi.h cryptoapi.c -nodist_openvpn_SOURCES = configure.h -options.$(OBJEXT): configure.h - -configure.h: Makefile - awk -f $(srcdir)/configure_h.awk config.h > $@ - awk -f $(srcdir)/configure_log.awk config.log >> $@ - if WIN32 dist_noinst_DATA += openvpn.8 nodist_html_DATA = openvpn.8.html
configure.ac +3 -0
@@ -913,6 +913,9 @@ if test "${enable_strict}" = "yes"; then CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" fi +CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" +AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings]) + TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID" TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR" TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
configure_h.awk deleted +0 -39
@@ -1,39 +0,0 @@ -# -# OpenVPN -- An application to securely tunnel IP networks -# over a single UDP port, with support for SSL/TLS-based -# session authentication and key exchange, -# packet encryption, packet authentication, and -# packet compression. -# -# Copyright (C) 2010 David Sommerseth <[email protected]...> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program (see the file COPYING included with this -# distribution); if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# -# This script will build up a line which can be included into a C program. -# The line will contain all interesting #define statements from f.ex. ./config.h -# - -BEGIN { - printf ("#define CONFIGURE_DEFINES \"") -} - -/^#define (ENABLE|DISABLE|DEPRECATED|USE)_/ { - printf (" %s", $2) -} - -END { - printf ("\"\n") -}
configure_log.awk deleted +0 -33
@@ -1,33 +0,0 @@ -# -# OpenVPN -- An application to securely tunnel IP networks -# over a single UDP port, with support for SSL/TLS-based -# session authentication and key exchange, -# packet encryption, packet authentication, and -# packet compression. -# -# Copyright (C) 2010 David Sommerseth <[email protected]...> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program (see the file COPYING included with this -# distribution); if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# -# This script will build up a line which can be included into a C program. -# The line will only contain the first entry of the ./configure line from -# ./config.log. -# - -/\$ (.*)\/configure/ { - printf ("#define CONFIGURE_CALL \"%s\"\n", $0) - exit 0 -}
options.c +0 -4
@@ -49,7 +49,6 @@#include "helper.h" #include "manage.h" #include "forward.h" -#include "configure.h" #include <ctype.h> #include "memdbg.h"
@@ -3403,9 +3402,6 @@ usage_version (void)msg (M_INFO |M_NOPREFIX ,"Originally developed by James Yonan" );msg (M_INFO |M_NOPREFIX ,"Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...>" );#ifndef ENABLE_SMALL -#ifdef CONFIGURE_CALL -msg (M_INFO |M_NOPREFIX ,"\n%s\n" ,CONFIGURE_CALL ); -#endif #ifdef CONFIGURE_DEFINES msg (M_INFO |M_NOPREFIX ,"Compile time defines: %s" ,CONFIGURE_DEFINES );#endif
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 28/52] build: remove awk and non-standard autoconf output processing
This looks ok. If I understood it correctly, earlier the Makefile called configure_h.awk to parse config.h to generate configure.h. This configure.h file contained only two defines:
#define CONFIGURE_DEFINES " ENABLE_CLIENT_SERVER ENABLE_DEBUG ENABLE_EUREPHIA ..." #define CONFIGURE_CALL " $ ./configure "
This patch removes configure_h.awk and thus phases out configure.h. After this change CONFIGURE_DEFINES is generated using this method:
CONFIGURE_DEFINES="set | grep '^enable_.*=' ; set | grep '^with_.*='"
This should be safe if running "set" does not produce output that would match the regexps without being related to the OpenVPN builds. Given that the regexps are very strictly defined, that doesn't sound likely.
I give this one an ACK. Please NACK if you disagree :).
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 170 lines
Replace with simpler environment solution.
Signed-off-by Alon Bar-Lev <[email protected]...>--- Makefile.am | 12 ++---------- configure.ac | 3 +++ configure_h.awk | 39 --------------------------------------- configure_log.awk | 33 --------------------------------- options.c | 4 ---- 5 files changed, 5 insertions(+), 86 deletions(-) delete mode 100644 configure_h.awk delete mode 100644 configure_log.awkMakefile.am +2
-10@@ -36,7 +36,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/depcomp $(srcdir)/aclocal.m4 \ $(srcdir)/config.guess $(srcdir)/config.sub \ $(srcdir)/openvpn.spec -CLEANFILES = openvpn.8.html configure.h +CLEANFILES = openvpn.8.html EXTRA_DIST = \ sample-config-files \@@ -57,8 +57,7 @@ dist_doc_DATA = \ dist_noinst_SCRIPTS = \ $(TESTS) \ - t_cltsrv-down.sh \ - configure_h.awk configure_log.awk + t_cltsrv-down.sh dist_doc_DATA = \ COPYRIGHT.GPL \@@ -156,13 +155,6 @@ openvpn_SOURCES = \ win32.h win32.c \ cryptoapi.h cryptoapi.c -nodist_openvpn_SOURCES = configure.h -options.$(OBJEXT): configure.h - -configure.h: Makefile - awk -f $(srcdir)/configure_h.awk config.h > $@ - awk -f $(srcdir)/configure_log.awk config.log >> $@ - if WIN32 dist_noinst_DATA += openvpn.8 nodist_html_DATA = openvpn.8.htmlconfigure.ac +3
-0@@ -913,6 +913,9 @@ if test "${enable_strict}" = "yes"; then CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" fi +CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" +AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings]) + TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID" TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR" TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"configure_h.awk deleted +0
-39@@ -1,39 +0,0 @@ -# -# OpenVPN -- An application to securely tunnel IP networks -# over a single UDP port, with support for SSL/TLS-based -# session authentication and key exchange, -# packet encryption, packet authentication, and -# packet compression. -# -# Copyright (C) 2010 David Sommerseth <[email protected]...> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program (see the file COPYING included with this -# distribution); if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# -# This script will build up a line which can be included into a C program. -# The line will contain all interesting #define statements from f.ex. ./config.h -# - -BEGIN { - printf ("#define CONFIGURE_DEFINES \"") -} - -/^#define (ENABLE|DISABLE|DEPRECATED|USE)_/ { - printf (" %s", $2) -} - -END { - printf ("\"\n") -}configure_log.awk deleted +0
-33@@ -1,33 +0,0 @@ -# -# OpenVPN -- An application to securely tunnel IP networks -# over a single UDP port, with support for SSL/TLS-based -# session authentication and key exchange, -# packet encryption, packet authentication, and -# packet compression. -# -# Copyright (C) 2010 David Sommerseth <[email protected]...> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 -# as published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program (see the file COPYING included with this -# distribution); if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# -# This script will build up a line which can be included into a C program. -# The line will only contain the first entry of the ./configure line from -# ./config.log. -# - -/\$ (.*)\/configure/ { - printf ("#define CONFIGURE_CALL \"%s\"\n", $0) - exit 0 -}options.c +0
-4@@ -49,7 +49,6 @@#include "helper.h" #include "manage.h" #include "forward.h" -#include "configure.h" #include <ctype.h> #include "memdbg.h" @@ -3403,9 +3402,6 @@ usage_version (void)msg (M_INFO |M_NOPREFIX ,"Originally developed by James Yonan" );msg (M_INFO |M_NOPREFIX ,"Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...>" );#ifndef ENABLE_SMALL -#ifdef CONFIGURE_CALL -msg (M_INFO |M_NOPREFIX ,"\n%s\n" ,CONFIGURE_CALL ); -#endif #ifdef CONFIGURE_DEFINES msg (M_INFO |M_NOPREFIX ,"Compile time defines: %s" ,CONFIGURE_DEFINES );#endif
PATCH 30/52 build: add libtool + windows resources for executables
In reply to Alon Bar-Lev--- .gitignore | 6 ++++ Makefile.am | 5 +++- build/Makefile.am | 15 +++++++++++ build/ltrc.inc | 23 ++++++++++++++++ configure.ac | 20 ++++++++++++++- src/openvpn/Makefile.am | 6 ++++ src/openvpn/openvpn_win32_resources.rc | 41 ++++++++++++++++++++++++++++++ src/openvpnserv/Makefile.am | 5 +++- src/openvpnserv/openvpnserv_resources.rc | 41 ++++++++++++++++++++++++++++++ version.m4 | 1 + 10 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 build/Makefile.am create mode 100644 build/ltrc.inc create mode 100644 src/openvpn/openvpn_win32_resources.rc create mode 100644 src/openvpnserv/openvpnserv_resources.rc
.gitignore +6 -0
@@ -26,6 +26,12 @@ depcomp stamp-h1 install-sh missing +ltmain.sh +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 doc/openvpn.8.html distro/rpm/openvpn.spec
Makefile.am +4 -1
@@ -34,6 +34,9 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \ $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \ + $(srcdir)/m4/libtool.m4 $(srcdir)/m4/lt~obsolete.m4 \ + $(srcdir)/m4/ltoptions.m4 $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ $(srcdir)/depcomp $(srcdir)/aclocal.m4 \ $(srcdir)/config.guess $(srcdir)/config.sub
@@ -41,7 +44,7 @@ EXTRA_DIST = \ contrib \ debug -SUBDIRS = distro include src sample doc tests +SUBDIRS = build distro include src sample doc tests dist_doc_DATA = \ COPYRIGHT.GPL \
build/Makefile.am new file +15 -0
@@ -0,0 +1,15 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...> +# + +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in + +EXTRA_DIST = \ + ltrc.inc
build/ltrc.inc new file +23 -0
@@ -0,0 +1,23 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...> +# +# Required to build Windows resource file + +RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) +LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) + +.rc.lo: + $(LTRCCOMPILE) -i "$<" -o "$@" + +.rc.o: + $(RCCOMPILE) -i "$<" -o "$@" + +.mc.rc: + $(WINDMC) "$<"
configure.ac +19 -1
@@ -29,6 +29,8 @@ AC_PREREQ(2.59) m4_include(version.m4) AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME]) m4_include(compat.m4) +AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format]) + AC_CONFIG_AUX_DIR([.]) AM_CONFIG_HEADER([config.h]) AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
@@ -352,7 +354,6 @@ case "$host" in AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix]) CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501" WIN32=yes - LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32" ;; *-*-dragonfly*) AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
@@ -369,6 +370,22 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +# +# Libtool +# +ifdef( + [LT_INIT], + [ + LT_INIT([win32-dll]) + LT_LANG([Windows Resource]) + ], + [ + AC_LIBTOOL_WIN32_DLL + AC_LIBTOOL_RC + AC_PROG_LIBTOOL + ] +) + if test "${WIN32}" = "yes"; then AC_ARG_VAR([MAN2HTML], [man2html utility]) AC_CHECK_PROGS([MAN2HTML], [man2html])
@@ -930,6 +947,7 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) AC_CONFIG_FILES([ Makefile + build/Makefile distro/Makefile distro/rpm/Makefile distro/rpm/openvpn.spec
src/openvpn/Makefile.am +6 -0
@@ -9,6 +9,8 @@ # Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]...> # +include $(top_srcdir)/build/ltrc.inc + MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in
@@ -93,3 +95,7 @@ openvpn_SOURCES = \ tun.c tun.h \ win32.h win32.c \ cryptoapi.h cryptoapi.c +if WIN32 +openvpn_SOURCES += openvpn_win32_resources.rc +openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 +endif
src/openvpn/openvpn_win32_resources.rc new file +41 -0
41 lines not on this page · raw message
src/openvpnserv/Makefile.am +4 -1
@@ -9,6 +9,8 @@ # Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]...> # +include $(top_srcdir)/build/ltrc.inc + MAINTAINERCLEANFILES = $(srcdir)/Makefile.in if WIN32
@@ -17,4 +19,5 @@ endif openvpnserv_SOURCES = \ openvpnserv.c \ - service.h service.c + service.h service.c \ + openvpnserv_resources.rc
src/openvpnserv/openvpnserv_resources.rc new file +41 -0
41 lines not on this page · raw message
version.m4 +1 -0
@@ -3,6 +3,7 @@ define([PRODUCT_NAME], [OpenVPN]) define([PRODUCT_TARNAME], [openvpn]) define([PRODUCT_VERSION], [2.3_alpha1]) define([PRODUCT_BUGREPORT], [[email protected]]) +define([PRODUCT_VERSION_RESOURCE], [2,3,0,0]) dnl define the TAP version define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901]) define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
Hi,
This patch was ACKed in the IRC meeting on 15th Mar 2012:
<http://thread.gmane.org/gmane.network.openvpn.devel/5992>
However some of the lines in "src/openvpn/openvpn_win32_resources.rc" may need to be fixed:
VALUE "CompanyName", "OpenVPN.net"
VALUE "LegalCopyright", "Copyright � OpenVPN Project"
Quoting
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx
"CompanyName Company that produced the file, for example, "Microsoft
Corporation" or "Standard Microsystems Corporation, Inc." This string is required."
"LegalCopyright Copyright notices that apply to the file. This should
include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional."
I think we could use the same entity name (e.g. "OpenVPN project") in both fields. I also think that the choice of wording revolves around copyright ownership... in 2.1.x series James Yonan/OpenVPN Technologies, Inc. owned _most_ of the copyrights to the codebase. However, in this post-2.3-alpha1 age, copyrights to very large parts of the codebase belong to community developers. So, attributing copyright to "OpenVPN Technologies, Inc. and contributors" would probably not be proper.
So, what should we call this "entity" that owns the copyrights to the codebase?
Signature · 9 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock PS. I'll try to apply some Git magic to produce concrete numbers regarding the copyright ownership in the OpenVPN codebase.
Quoted 311 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- .gitignore | 6 ++++ Makefile.am | 5 +++- build/Makefile.am | 15 +++++++++++ build/ltrc.inc | 23 ++++++++++++++++ configure.ac | 20 ++++++++++++++- src/openvpn/Makefile.am | 6 ++++ src/openvpn/openvpn_win32_resources.rc | 41 ++++++++++++++++++++++++++++++ src/openvpnserv/Makefile.am | 5 +++- src/openvpnserv/openvpnserv_resources.rc | 41 ++++++++++++++++++++++++++++++ version.m4 | 1 + 10 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 build/Makefile.am create mode 100644 build/ltrc.inc create mode 100644 src/openvpn/openvpn_win32_resources.rc create mode 100644 src/openvpnserv/openvpnserv_resources.rc.gitignore +6
-0@@ -26,6 +26,12 @@ depcomp stamp-h1 install-sh missing +ltmain.sh +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 doc/openvpn.8.html distro/rpm/openvpn.specMakefile.am +4
-1@@ -34,6 +34,9 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \ $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \ + $(srcdir)/m4/libtool.m4 $(srcdir)/m4/lt~obsolete.m4 \ + $(srcdir)/m4/ltoptions.m4 $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ $(srcdir)/depcomp $(srcdir)/aclocal.m4 \ $(srcdir)/config.guess $(srcdir)/config.sub@@ -41,7 +44,7 @@ EXTRA_DIST = \ contrib \ debug -SUBDIRS = distro include src sample doc tests +SUBDIRS = build distro include src sample doc tests dist_doc_DATA = \ COPYRIGHT.GPL \build/Makefile.am new file +15
-0@@ -0,0 +1,15 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...> +# + +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in + +EXTRA_DIST = \ + ltrc.incbuild/ltrc.inc new file +23
-0@@ -0,0 +1,23 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...> +# +# Required to build Windows resource file + +RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) +LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) + +.rc.lo: + $(LTRCCOMPILE) -i "$<" -o "$@" + +.rc.o: + $(RCCOMPILE) -i "$<" -o "$@" + +.mc.rc: + $(WINDMC) "$<"configure.ac +19
-1@@ -29,6 +29,8 @@ AC_PREREQ(2.59) m4_include(version.m4) AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME]) m4_include(compat.m4) +AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format]) + AC_CONFIG_AUX_DIR([.]) AM_CONFIG_HEADER([config.h]) AC_CONFIG_SRCDIR([src/openvpn/syshead.h])@@ -352,7 +354,6 @@ case "$host" in AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix]) CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501" WIN32=yes - LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32" ;; *-*-dragonfly*) AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])@@ -369,6 +370,22 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +# +# Libtool +# +ifdef( + [LT_INIT], + [ + LT_INIT([win32-dll]) + LT_LANG([Windows Resource]) + ], + [ + AC_LIBTOOL_WIN32_DLL + AC_LIBTOOL_RC + AC_PROG_LIBTOOL + ] +) + if test "${WIN32}" = "yes"; then AC_ARG_VAR([MAN2HTML], [man2html utility]) AC_CHECK_PROGS([MAN2HTML], [man2html])@@ -930,6 +947,7 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) AC_CONFIG_FILES([ Makefile + build/Makefile distro/Makefile distro/rpm/Makefile distro/rpm/openvpn.specsrc/openvpn/Makefile.am +6
-0@@ -9,6 +9,8 @@ # Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]...> # +include $(top_srcdir)/build/ltrc.inc + MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in@@ -93,3 +95,7 @@ openvpn_SOURCES = \ tun.c tun.h \ win32.h win32.c \ cryptoapi.h cryptoapi.c +if WIN32 +openvpn_SOURCES += openvpn_win32_resources.rc +openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 +endifsrc/openvpn/openvpn_win32_resources.rc new file +41
-0@@ -0,0 +1,41 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#else +#include <config-msc-version.h> +#endif +#include <winresrc.h> + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +VS_VERSION_INFO VERSIONINFO + FILEVERSION OPENVPN_VERSION_RESOURCE + PRODUCTVERSION OPENVPN_VERSION_RESOURCE + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "OpenVPN.net" + VALUE "FileDescription", "OpenVPN" + VALUE "FileVersion", PACKAGE_VERSION ".0" + VALUE "InternalName", "OpenVPN" + VALUE "LegalCopyright", "Copyright � OpenVPN Project" + VALUE "OriginalFilename", "openvpn.exe" + VALUE "ProductName", "OpenVPN" + VALUE "ProductVersion", PACKAGE_VERSION ".0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +ENDsrc/openvpnserv/Makefile.am +4
-1@@ -9,6 +9,8 @@ # Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]...> # +include $(top_srcdir)/build/ltrc.inc + MAINTAINERCLEANFILES = $(srcdir)/Makefile.in if WIN32@@ -17,4 +19,5 @@ endif openvpnserv_SOURCES = \ openvpnserv.c \ - service.h service.c + service.h service.c \ + openvpnserv_resources.rcsrc/openvpnserv/openvpnserv_resources.rc new file +41
-0@@ -0,0 +1,41 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#else +#include <config-msc-version.h> +#endif +#include <winresrc.h> + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +VS_VERSION_INFO VERSIONINFO + FILEVERSION OPENVPN_VERSION_RESOURCE + PRODUCTVERSION OPENVPN_VERSION_RESOURCE + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "OpenVPN.net" + VALUE "FileDescription", "OpenVPN Service" + VALUE "FileVersion", PACKAGE_VERSION ".0" + VALUE "InternalName", "OpenVPN" + VALUE "LegalCopyright", "Copyright � OpenVPN Project" + VALUE "OriginalFilename", "openvpnserv.exe" + VALUE "ProductName", "OpenVPN" + VALUE "ProductVersion", PACKAGE_VERSION ".0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +ENDversion.m4 +1
-1@@ -3,6 +3,7 @@ define([PRODUCT_NAME], [OpenVPN]) define([PRODUCT_TARNAME], [openvpn]) define([PRODUCT_VERSION], [2.3_alpha1]) define([PRODUCT_BUGREPORT], [[email protected]]) +define([PRODUCT_VERSION_RESOURCE], [2,3,0,0]) dnl define the TAP version define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901]) define([PRODUCT_TAP_WIN_MIN_MAJOR], [9]) --1.7.3.4
Re: [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
I left the OpenVPN.net not to cause copyright discussion :) But here we are...
"The OpenVPN Project" is good for me.
2012/3/16 Samuli Seppänen <[email protected]...>:
Quoted 358 lines
Hi,
This patch was ACKed in the IRC meeting on 15th Mar 2012:
<http://thread.gmane.org/gmane.network.openvpn.devel/5992>
However some of the lines in "src/openvpn/openvpn_win32_resources.rc" may need to be fixed:
VALUE "CompanyName", "OpenVPN.net"
VALUE "LegalCopyright", "Copyright � OpenVPN Project"Quoting
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx"CompanyName Company that produced the file, for example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc." This string is required."
"LegalCopyright Copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional."
I think we could use the same entity name (e.g. "OpenVPN project") in both fields. I also think that the choice of wording revolves around copyright ownership... in 2.1.x series James Yonan/OpenVPN Technologies, Inc. owned _most_ of the copyrights to the codebase. However, in this post-2.3-alpha1 age, copyrights to very large parts of the codebase belong to community developers. So, attributing copyright to "OpenVPN Technologies, Inc. and contributors" would probably not be proper.
So, what should we call this "entity" that owns the copyrights to the codebase?
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Incirc freenode net: mattock
PS. I'll try to apply some Git magic to produce concrete numbers regarding the copyright ownership in the OpenVPN codebase.
Quoted 311 lines
Signed-off-by Alon Bar-Lev <[email protected]...>---
.gitignore | 6 ++++
Makefile.am | 5 +++- build/Makefile.am | 15 +++++++++++ build/ltrc.inc | 23 ++++++++++++++++ configure.ac | 20 ++++++++++++++- src/openvpn/Makefile.am | 6 ++++ src/openvpn/openvpn_win32_resources.rc | 41 ++++++++++++++++++++++++++++++ src/openvpnserv/Makefile.am | 5 +++- src/openvpnserv/openvpnserv_resources.rc | 41 ++++++++++++++++++++++++++++++ version.m4 | 1 +10 files changed, 160 insertions(+), 3 deletions(-)create mode 100644 build/Makefile.am
create mode 100644 build/ltrc.inc
create mode 100644 src/openvpn/openvpn_win32_resources.rc create mode 100644 src/openvpnserv/openvpnserv_resources.rc.gitignore +0
-0@@ -26,6 +26,12 @@ depcompstamp-h1
install-sh
missing.gitignore +6
-0+ltmain.sh +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4doc/openvpn.8.html
distro/rpm/openvpn.specMakefile.am +3
-0@@ -34,6 +34,9 @@ MAINTAINERCLEANFILES = \ $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \ $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \ + $(srcdir)/m4/libtool.m4 $(srcdir)/m4/lt~obsolete.m4 \ + $(srcdir)/m4/ltoptions.m4 $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ $(srcdir)/depcomp $(srcdir)/aclocal.m4 \$(srcdir)/config.guess $(srcdir)/config.sub
Makefile.am +0
-0@@ -41,7 +44,7 @@ EXTRA_DIST = \ contrib \debug
Makefile.am +1
-1-SUBDIRS = distro include src sample doc tests +SUBDIRS = build distro include src sample doc testsdist_doc_DATA = \
COPYRIGHT.GPL \build/Makefile.am new file +15
-0@@ -0,0 +1,15 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...> +# + +MAINTAINERCLEANFILES = \ + $(srcdir)/Makefile.in + +EXTRA_DIST = \ + ltrc.incbuild/ltrc.inc new file +23
-0@@ -0,0 +1,23 @@ +# +# OpenVPN -- An application to securely tunnel IP networks +# over a single UDP port, with support for SSL/TLS-based +# session authentication and key exchange, +# packet encryption, packet authentication, and +# packet compression. +# +# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...> +# +# Required to build Windows resource file + +RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) +LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) + +.rc.lo: + $(LTRCCOMPILE) -i "$<" -o "$@" + +.rc.o: + $(RCCOMPILE) -i "$<" -o "$@" + +.mc.rc: + $(WINDMC) "$<"configure.ac +2
-0@@ -29,6 +29,8 @@ AC_PREREQ(2.59) m4_include(version.m4) AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME]) m4_include(compat.m4) +AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format]) + AC_CONFIG_AUX_DIR([.]) AM_CONFIG_HEADER([config.h]) AC_CONFIG_SRCDIR([src/openvpn/syshead.h])@@ -352,7 +354,6 @@ case "$host" in AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501" WIN32=yes
- LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32" ;;
*-*-dragonfly*)
AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])configure.ac +0
-0@@ -369,6 +370,22 @@ AC_PROG_INSTALLAC_PROG_LN_S
AC_PROG_MAKE_SETconfigure.ac +16
-0+# +# Libtool +# +ifdef( + [LT_INIT], + [ + LT_INIT([win32-dll]) + LT_LANG([Windows Resource]) + ], + [ + AC_LIBTOOL_WIN32_DLL + AC_LIBTOOL_RC + AC_PROG_LIBTOOL + ] +) +if test "${WIN32}" = "yes"; then
AC_ARG_VAR([MAN2HTML], [man2html utility])AC_CHECK_PROGS([MAN2HTML], [man2html])configure.ac +0
-0@@ -930,6 +947,7 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])AC_CONFIG_FILES([
Makefile
+ build/Makefile
distro/Makefile
distro/rpm/Makefile
distro/rpm/openvpn.specsrc/openvpn/Makefile.am +2
-0@@ -9,6 +9,8 @@ # Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]....> # +include $(top_srcdir)/build/ltrc.inc + MAINTAINERCLEANFILES = \$(srcdir)/Makefile.in
src/openvpn/Makefile.am +0
-0@@ -93,3 +95,7 @@ openvpn_SOURCES = \ tun.c tun.h \ win32.h win32.c \
cryptoapi.hcryptoapi.csrc/openvpn/Makefile.am +4
-0+if WIN32 +openvpn_SOURCES += openvpn_win32_resources.rc +openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 +endifsrc/openvpn/openvpn_win32_resources.rc new file +41
-0@@ -0,0 +1,41 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#else +#include <config-msc-version.h> +#endif +#include <winresrc.h> + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +VS_VERSION_INFO VERSIONINFO + FILEVERSION OPENVPN_VERSION_RESOURCE + PRODUCTVERSION OPENVPN_VERSION_RESOURCE + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "OpenVPN.net" + VALUE "FileDescription", "OpenVPN" + VALUE "FileVersion", PACKAGE_VERSION ".0" + VALUE "InternalName", "OpenVPN" + VALUE "LegalCopyright", "Copyright � OpenVPN Project" + VALUE "OriginalFilename", "openvpn.exe" + VALUE "ProductName", "OpenVPN" + VALUE "ProductVersion", PACKAGE_VERSION ".0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +ENDsrc/openvpnserv/Makefile.am +2
-0@@ -9,6 +9,8 @@ # Copyright (C) 2006-2012 Alon Bar-Lev <[email protected]....> # +include $(top_srcdir)/build/ltrc.inc +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
if WIN32
src/openvpnserv/Makefile.am +2
-1@@ -17,4 +19,5 @@ endif openvpnserv_SOURCES = \ openvpnserv.c \ - service.h service.c + service.h service.c \ + openvpnserv_resources.rcsrc/openvpnserv/openvpnserv_resources.rc new file +41
-0@@ -0,0 +1,41 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#else +#include <config-msc-version.h> +#endif +#include <winresrc.h> + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +VS_VERSION_INFO VERSIONINFO + FILEVERSION OPENVPN_VERSION_RESOURCE + PRODUCTVERSION OPENVPN_VERSION_RESOURCE + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "OpenVPN.net" + VALUE "FileDescription", "OpenVPN Service" + VALUE "FileVersion", PACKAGE_VERSION ".0" + VALUE "InternalName", "OpenVPN" + VALUE "LegalCopyright", "Copyright � OpenVPN Project" + VALUE "OriginalFilename", "openvpnserv.exe" + VALUE "ProductName", "OpenVPN" + VALUE "ProductVersion", PACKAGE_VERSION ".0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +ENDversion.m4 +1
-0@@ -3,6 +3,7 @@ define([PRODUCT_NAME], [OpenVPN]) define([PRODUCT_TARNAME], [openvpn]) define([PRODUCT_VERSION], [2.3_alpha1]) define([PRODUCT_BUGREPORT], [[email protected]]) +define([PRODUCT_VERSION_RESOURCE], [2,3,0,0])dnl define the TAP version
define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901])define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])--
1.7.3.4
Re: [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
In reply to Samuli Seppänen-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 32 lines · Samuli Seppänen
Hi,
This patch was ACKed in the IRC meeting on 15th Mar 2012:
<http://thread.gmane.org/gmane.network.openvpn.devel/5992>
However some of the lines in "src/openvpn/openvpn_win32_resources.rc" may need to be fixed:
VALUE "CompanyName", "OpenVPN.net" VALUE "LegalCopyright", "Copyright � OpenVPN Project"
Quoting
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx"CompanyName Company that produced the file, for example,
"Microsoft Corporation" or "Standard Microsystems Corporation, Inc." This string is required.""LegalCopyright Copyright notices that apply to the file. This
should include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional."I think we could use the same entity name (e.g. "OpenVPN project") in both fields. I also think that the choice of wording revolves around copyright ownership... in 2.1.x series James Yonan/OpenVPN Technologies, Inc. owned _most_ of the copyrights to the codebase. However, in this post-2.3-alpha1 age, copyrights to very large parts of the codebase belong to community developers. So, attributing copyright to "OpenVPN Technologies, Inc. and contributors" would probably not be proper.
Quoted 2 lines
So, what should we call this "entity" that owns the copyrights to the codebase?
I would even go back to OpenVPN 2.2-beta1. Which includes over 150 patches from the community. But that's nit-picking.
I really think attributing the *project* is the better. The company itself does not really own the copyright to the contributed code. However the community and the company are both heavily involved in the project.
Just an idea ... what about to see how other open source projects solve this in Windows builds? Not sure about anything concrete, but maybe virtio drivers for Windows is a place worth checking out? (virtio drivers in Windows are used for paravirt enabling when running as guest on a KVM host; I believe these drivers are developed with a community project these days)
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9jZ5wACgkQDC186MBRfrogqgCeMA+4shPIDUvIMpHw2uYsSi3H lLAAnAsqw5C4+Hli+PwqejYHkaGoavcN
=+TP5
-----END PGP SIGNATURE-----
PATCH 31/52 build: autoconf: commands as environment
In reply to Alon Bar-Lev--- configure.ac | 66 ++++++++++++++++++++++++--------------------------------- 1 files changed, 28 insertions(+), 38 deletions(-)
configure.ac +28 -38
@@ -267,37 +267,6 @@ AC_ARG_WITH( ) AC_ARG_WITH( - [ifconfig-path], - [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])], - [IFCONFIG="$withval"], - [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) - -AC_ARG_WITH( - [iproute-path], - [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])], - [IPROUTE="$withval"], - [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) - -AC_ARG_WITH([route-path], - [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])], - [ROUTE="$withval"], - [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) - -AC_ARG_WITH( - [netstat-path], - [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])], - [NETSTAT="$withval"], - [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])] -) -AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool]) - -AC_ARG_WITH( [mem-check], [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])], [
@@ -370,6 +339,20 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility]) +AC_ARG_VAR([ROUTE], [full path to route utility]) +AC_ARG_VAR([IPROUTE], [full path to ip utility]) +AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests +AC_ARG_VAR([MAN2HTML], [path to man2html utility]) +AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests +AC_CHECK_PROGS([MAN2HTML], [man2html]) +AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) +AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) +AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) + # # Libtool #
@@ -386,12 +369,6 @@ ifdef( ] ) -if test "${WIN32}" = "yes"; then - AC_ARG_VAR([MAN2HTML], [man2html utility]) - AC_CHECK_PROGS([MAN2HTML], [man2html]) - test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) -fi - AC_C_CONST AC_C_INLINE AC_C_VOLATILE
@@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers]) test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file]) test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support]) -test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) + +if test "${enable_iproute2}" = "yes"; then + test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) + AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) +else + if test "${WIN32}" != "yes"; then + test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing]) + test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing]) + fi +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"
@@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" fi +if test "${WIN32}" = "yes"; then + test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) +fi + CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment
So, this patch replaces (removes?) the "--with-<executable>-path" configure options with environment variables, right? For example, if one has "ifconfig" in a non-standard place, he can set the IFCONFIG environment variable and the build will find it. Did I understand this correctly?
I don't know autotools well enough to give this one an ACK at this point. That said, the patch does clean up configure.ac a lot, and cleanups are always nice :).
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 110 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 66 ++++++++++++++++++++++++--------------------------------- 1 files changed, 28 insertions(+), 38 deletions(-)configure.ac +28
-38@@ -267,37 +267,6 @@ AC_ARG_WITH( ) AC_ARG_WITH( - [ifconfig-path], - [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])], - [IFCONFIG="$withval"], - [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) - -AC_ARG_WITH( - [iproute-path], - [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])], - [IPROUTE="$withval"], - [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) - -AC_ARG_WITH([route-path], - [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])], - [ROUTE="$withval"], - [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) - -AC_ARG_WITH( - [netstat-path], - [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])], - [NETSTAT="$withval"], - [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])] -) -AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool]) - -AC_ARG_WITH( [mem-check], [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])], [@@ -370,6 +339,20 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility]) +AC_ARG_VAR([ROUTE], [full path to route utility]) +AC_ARG_VAR([IPROUTE], [full path to ip utility]) +AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests +AC_ARG_VAR([MAN2HTML], [path to man2html utility]) +AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests +AC_CHECK_PROGS([MAN2HTML], [man2html]) +AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) +AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) +AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) + # # Libtool #@@ -386,12 +369,6 @@ ifdef( ] ) -if test "${WIN32}" = "yes"; then - AC_ARG_VAR([MAN2HTML], [man2html utility]) - AC_CHECK_PROGS([MAN2HTML], [man2html]) - test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) -fi - AC_C_CONST AC_C_INLINE AC_C_VOLATILE@@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers]) test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file]) test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support]) -test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) + +if test "${enable_iproute2}" = "yes"; then + test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) + AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) +else + if test "${WIN32}" != "yes"; then + test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing]) + test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing]) + fi +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"@@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" fi +if test "${WIN32}" = "yes"; then + test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) +fi + CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
Re: [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment
Just like CPP, CC, CXX, LD, AR, PKG_CONFIG Programs are expected to be in environment.
The autoconf detection get/set these in environment too.
2012/3/8 Samuli Seppänen <[email protected]...>:
Quoted 123 lines
So, this patch replaces (removes?) the "--with-<executable>-path" configure options with environment variables, right? For example, if one has "ifconfig" in a non-standard place, he can set the IFCONFIG environment variable and the build will find it. Did I understand this correctly?
I don't know autotools well enough to give this one an ACK at this point. That said, the patch does clean up configure.ac a lot, and cleanups are always nice :).
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Incirc freenode net: mattock
Quoted 110 lines
Signed-off-by Alon Bar-Lev <[email protected]...>---
configure.ac | 66 ++++++++++++++++++++++++---------------------------------1 files changed, 28 insertions(+), 38 deletions(-)configure.ac +0
-0@@ -267,37 +267,6 @@ AC_ARG_WITH( )AC_ARG_WITH(
- [ifconfig-path],
- [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])],
- [IFCONFIG="$withval"],
- [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]configure.ac +0
-27-) -AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) - -AC_ARG_WITH( - [iproute-path], - [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])], - [IPROUTE="$withval"], - [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) - -AC_ARG_WITH([route-path], - [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])], - [ROUTE="$withval"], - [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] -) -AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) - -AC_ARG_WITH( - [netstat-path], - [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])], - [NETSTAT="$withval"], - [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])] -) -AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool]) - -AC_ARG_WITH([mem-check],
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])], [configure.ac +0
-0@@ -370,6 +339,20 @@ AC_PROG_INSTALLAC_PROG_LN_S
AC_PROG_MAKE_SETconfigure.ac +14
-0+AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility]) +AC_ARG_VAR([ROUTE], [full path to route utility]) +AC_ARG_VAR([IPROUTE], [full path to ip utility]) +AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests +AC_ARG_VAR([MAN2HTML], [path to man2html utility]) +AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) +AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests +AC_CHECK_PROGS([MAN2HTML], [man2html]) +AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) +AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) +AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) +#
# Libtool
#configure.ac +0
-0@@ -386,12 +369,6 @@ ifdef(]
)configure.ac +0
-6-if test "${WIN32}" = "yes"; then - AC_ARG_VAR([MAN2HTML], [man2html utility]) - AC_CHECK_PROGS([MAN2HTML], [man2html]) - test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) -fi -AC_C_CONST
AC_C_INLINE
AC_C_VOLATILEconfigure.ac +10
-1@@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers]) test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file]) test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support]) -test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) + +if test "${enable_iproute2}" = "yes"; then + test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) + AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) +else + if test "${WIN32}" != "yes"; then + test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing]) + test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing]) + fi +fiif test "${enable_pedantic}" = "yes"; then
enable_strict="yes"configure.ac +0
-0@@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; thenCFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" fi
configure.ac +4
-0+if test "${WIN32}" = "yes"; then + test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) +fi +CONFIGURE_DEFINES="
set | grep '^enable_.*=' ; set | grep '^with_.*='" AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["echo ${CONFIGURE_DEFINES}"], [Configuration settings])
PATCH 32/52 build: libdl usage
In reply to Alon Bar-Lev1. properly detect.
2. Link only required components.
3. No way we don't have LoadLibrary on Windows.
4. ENABLE_PLUGIN should be controlled in autoconf.
--- configure.ac | 50 ++++++++++++++++------------------------------- src/openvpn/Makefile.am | 4 ++- src/openvpn/plugin.c | 16 +++++++++----- src/openvpn/plugin.h | 4 +- src/openvpn/syshead.h | 11 ---------- 5 files changed, 32 insertions(+), 53 deletions(-)
configure.ac +17 -33
@@ -395,7 +395,7 @@ AC_CHECK_HEADERS([ \ stdio.h stdarg.h \ time.h errno.h fcntl.h io.h direct.h \ ctype.h sys/types.h sys/socket.h \ - signal.h unistd.h \ + signal.h unistd.h dlfcn.h \ netinet/in.h netinet/in_systm.h \ netinet/tcp.h arpa/inet.h netdb.h \ windows.h winsock2.h ws2tcpip.h \
@@ -606,6 +606,13 @@ else AC_CHECK_FUNCS(SOCKET_OPT_FUNCS) fi +AC_CHECK_LIB( + [dl], + [dlopen], + [DL_LIBS="-ldl"] +) +AC_SUBST([DL_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(
@@ -658,38 +665,6 @@ case "${with_mem_check}" in esac dnl -dnl Check for dlopen -- first try libc then libdl. -dnl -if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then - AC_CHECK_HEADER( - [dlfcn.h], - [AC_CHECK_FUNC( - [dlopen], - [AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])], - [AC_CHECK_LIB( - [dl], - [dlopen], - [ - LIBS="${LIBS} -ldl" - AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading]) - ], - [AC_MSG_RESULT([libdl library not found.])] - )], - )], - ) - if test "${enable_eurephia}" = "yes"; then - AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in]) - fi -fi - -dnl -dnl Check if LoadLibrary exists on Windows -dnl -if test "${WIN32}" = "yes"; then - AC_DEFINE(USE_LOAD_LIBRARY, 1, [Use LoadLibrary to load DLLs on Windows]) -fi - -dnl dnl check for LZO library dnl if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
@@ -898,6 +873,13 @@ test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHEC test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file]) test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support]) +if test "${enable_plugins}" = "yes"; then + test "${WIN32}" != "yes" -a -z "${DL_LIBS}" && AC_MSG_ERROR([libdl is required for plugins]) + OPTIONAL_DL_LIBS="${DL_LIBS}" + AC_DEFINE([ENABLE_PLUGIN], [1], [Enable systemd support]) + test "${enable_eurephia}" = "yes" && AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in]) +fi + if test "${enable_iproute2}" = "yes"; then test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
@@ -933,6 +915,8 @@ AC_SUBST([TAP_WIN_COMPONENT_ID]) AC_SUBST([TAP_WIN_MIN_MAJOR]) AC_SUBST([TAP_WIN_MIN_MINOR]) +AC_SUBST([OPTIONAL_DL_LIBS]) + AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) AC_CONFIG_FILES([
src/openvpn/Makefile.am +3 -1
@@ -95,7 +95,9 @@ openvpn_SOURCES = \ tun.c tun.h \ win32.h win32.c \ cryptoapi.h cryptoapi.c +openvpn_LDADD = \ + $(OPTIONAL_DL_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rc -openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 +openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32 endif
src/openvpn/plugin.c +10 -6
@@ -26,6 +26,10 @@#ifdef ENABLE_PLUGIN +#ifdef HAVE_DLFCN_H +#include <dlfcn.h> +#endif +#include "buffer.h" #include "error.h" #include "misc.h"
@@ -160,7 +164,7 @@ plugin_option_list_print (const struct plugin_option_list *list, int msglevel) }#endif -#if defined(USE_LIBDL ) +#ifndef WIN32 static void libdl_resolve_symbol (void *handle,void **dest,const char *symbol,const char *plugin_name,const unsigned int flags)
@@ -170,7 +174,7 @@ libdl_resolve_symbol (void *handle, void **dest, const char *symbol, const char msg (M_FATAL, "PLUGIN: could not find required symbol '%s' in plugin shared object %s: %s", symbol, plugin_name, dlerror()); } -#elif defined(USE_LOAD_LIBRARY) +#else static void dll_resolve_symbol (HMODULE module,void **dest,const char *symbol,const char *plugin_name,const unsigned int flags)
@@ -191,7 +195,7 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o) p->so_pathname = o->so_pathname; p->plugin_type_mask =plugin_supported_types (); -#if defined(USE_LIBDL ) +#ifndef WIN32 p->handle =NULL ;#if defined(PLUGIN_LIBDIR )
@@ -220,7 +224,7 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o)# define PLUGIN_SYM (var, name, flags) libdl_resolve_symbol (p->handle, (void*)&p->var, name, p->so_pathname, flags) -#elif defined(USE_LOAD_LIBRARY ) +#else rel = !absolute_pathname (p->so_pathname); p->module =LoadLibraryW (wide_string (p->so_pathname, &gc));
@@ -427,10 +431,10 @@ plugin_close_item (struct plugin *p)if (p->plugin_handle) (*p->close)(p->plugin_handle); -#if defined(USE_LIBDL ) +#ifndef WIN32 if (dlclose (p->handle))msg (M_WARN ,"PLUGIN_CLOSE: dlclose() failed on plugin: %s" , p->so_pathname); -#elif defined(USE_LOAD_LIBRARY ) +#elif defined(WIN32 )if (!FreeLibrary (p->module))msg (M_WARN ,"PLUGIN_CLOSE: FreeLibrary() failed on plugin: %s" , p->so_pathname);#endif
src/openvpn/plugin.h +2 -2
@@ -59,9 +59,9 @@ struct plugin {unsigned int plugin_type_mask;int requested_initialization_point; -#if defined(USE_LIBDL ) +#ifndef WIN32 void *handle; -#elif defined(USE_LOAD_LIBRARY ) +#else HMODULE module;#endif
src/openvpn/syshead.h +0 -11
@@ -156,10 +156,6 @@#include <grp.h> #endif -#ifdef USE_LIBDL -#include <dlfcn.h> -#endif -#ifdef HAVE_NETDB_H #include <netdb.h> #endif
@@ -507,13 +503,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Do we have a plug-in capability? -*/ -#if defined(USE_LIBDL ) || defined(USE_LOAD_LIBRARY ) -#define ENABLE_PLUGIN -#endif - -/* * Enable deferred authentication? */ #if defined(ENABLE_DEF_AUTH ) &&P2MP_SERVER && defined(ENABLE_PLUGIN )
Signature · 1 line
1.7.3.4
PATCH 33/52 build: properly detect and use socket libs
In reply to Alon Bar-Lev--- configure.ac | 27 +++++++++++++++++---------- src/openvpn/Makefile.am | 1 + 2 files changed, 18 insertions(+), 10 deletions(-)
configure.ac +17 -10
@@ -442,16 +442,6 @@ if test "${WIN32}" != "yes"; then [[${SOCKET_INCLUDES}]] ) - AC_CHECK_DECLS( - [SO_MARK], - , - , - [[${SOCKET_INCLUDES}]] - ) - - AC_SEARCH_LIBS([socket], [socket]) - AC_SEARCH_LIBS([inet_ntoa], [nsl]) - AC_SEARCH_LIBS([gethostbyname], [resolv nsl]) AC_FUNC_FORK fi
@@ -613,6 +603,23 @@ AC_CHECK_LIB( ) AC_SUBST([DL_LIBS]) +AC_CHECK_LIB( + [nsl], + [inet_ntoa], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"] +) +AC_CHECK_LIB( + [socket], + [socket], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"] +) +AC_CHECK_LIB( + [resolv], + [gethostbyname], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"] +) +AC_SUBST([SOCKETS_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(
src/openvpn/Makefile.am +1 -0
@@ -96,6 +96,7 @@ openvpn_SOURCES = \ win32.h win32.c \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ + $(SOCKETS_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rc
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs
Did some digging regarding AC_SEARCH_LIBS and AC_CHECK_LIB. Somebody with more autotools knowledge might want to read this one:
<http://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html>
So, the question is: why AC_CHECK_LIB rather than AC_SEARCH_LIBS in this particular case? Apparently both have their uses.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 63 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 27 +++++++++++++++++---------- src/openvpn/Makefile.am | 1 + 2 files changed, 18 insertions(+), 10 deletions(-)configure.ac +17
-10@@ -442,16 +442,6 @@ if test "${WIN32}" != "yes"; then [[${SOCKET_INCLUDES}]] ) - AC_CHECK_DECLS( - [SO_MARK], - , - , - [[${SOCKET_INCLUDES}]] - ) - - AC_SEARCH_LIBS([socket], [socket]) - AC_SEARCH_LIBS([inet_ntoa], [nsl]) - AC_SEARCH_LIBS([gethostbyname], [resolv nsl]) AC_FUNC_FORK fi@@ -613,6 +603,23 @@ AC_CHECK_LIB( ) AC_SUBST([DL_LIBS]) +AC_CHECK_LIB( + [nsl], + [inet_ntoa], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"] +) +AC_CHECK_LIB( + [socket], + [socket], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"] +) +AC_CHECK_LIB( + [resolv], + [gethostbyname], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"] +) +AC_SUBST([SOCKETS_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(src/openvpn/Makefile.am +1
-0@@ -96,6 +96,7 @@ openvpn_SOURCES = \ win32.h win32.c \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ + $(SOCKETS_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rc
Re: [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs
Although I work with flameeyes closely in some of these issues...
I disagree with his opinion here as generic approach.
He is write as in most cases people just adds libraries as they go in the configure process...
So you check for dl, then rt, then resolv, then selinux etc... building your LIBS.
The result is one long LIBS which is common to all executables.
I take another approach and detect dependencies as atoms.
Yes... if one day dl will be merged into libc we fail in this case, but then we can fix <something>.
For now this is working perfectly.
Alon.
2012/3/8 Samuli Seppänen <[email protected]...>:
Quoted 80 lines
Did some digging regarding
AC_SEARCH_LIBSandAC_CHECK_LIB. Somebody with more autotools knowledge might want to read this one:<http://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html>
So, the question is: why
AC_CHECK_LIBrather thanAC_SEARCH_LIBSin this particular case? Apparently both have their uses.--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Incirc freenode net: mattock
Quoted 63 lines
Signed-off-by Alon Bar-Lev <[email protected]...>---
configure.ac | 27 +++++++++++++++++---------- src/openvpn/Makefile.am | 1 +2 files changed, 18 insertions(+), 10 deletions(-)configure.ac +0
-0@@ -442,16 +442,6 @@ if test "${WIN32}" != "yes"; then[[${SOCKET_INCLUDES}]]
)- AC_CHECK_DECLS(
- [SO_MARK],
- ,
- ,
- [[${SOCKET_INCLUDES}]]
- )
-
-AC_SEARCH_LIBS([socket], [socket])
-AC_SEARCH_LIBS([inet_ntoa], [nsl])
-AC_SEARCH_LIBS([gethostbyname], [resolv nsl])AC_FUNC_FORK
ficonfigure.ac +17
-0@@ -613,6 +603,23 @@ AC_CHECK_LIB( ) AC_SUBST([DL_LIBS]) +AC_CHECK_LIB( + [nsl], + [inet_ntoa], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"] +) +AC_CHECK_LIB( + [socket], + [socket], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"] +) +AC_CHECK_LIB( + [resolv], + [gethostbyname], + [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"] +) +AC_SUBST([SOCKETS_LIBS]) +case "${with_mem_check}" in
valgrind)
AC_CHECK_HEADER(src/openvpn/Makefile.am +0
-0@@ -96,6 +96,7 @@ openvpn_SOURCES = \ win32.h win32.c \
cryptoapi.hcryptoapi.c
openvpn_LDADD = \
+ $(SOCKETS_LIBS) \
$(OPTIONAL_DL_LIBS)
if WIN32
openvpn_SOURCES += openvpn_win32_resources.rc
PATCH 34/52 build: autoconf: minor cleanups
In reply to Alon Bar-Lev--- configure.ac | 145 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 72 insertions(+), 73 deletions(-)
configure.ac +72 -73
@@ -400,6 +400,16 @@ AC_CHECK_HEADERS([ \ netinet/tcp.h arpa/inet.h netdb.h \ windows.h winsock2.h ws2tcpip.h \ ]) +AC_CHECK_HEADERS([ \ + sys/time.h sys/un.h sys/ioctl.h sys/stat.h \ + sys/mman.h sys/file.h \ + unistd.h signal.h \ + syslog.h pwd.h grp.h \ + net/if_tun.h net/tun/if_tun.h stropts.h \ + sys/sockio.h \ + sys/uio.h linux/if_tun.h linux/sockios.h \ + linux/types.h sys/poll.h sys/epoll.h err.h \ +]) SOCKET_INCLUDES=" #ifdef HAVE_STDLIB_H
@@ -425,76 +435,11 @@ SOCKET_INCLUDES=" #endif " -if test "${WIN32}" != "yes"; then - AC_CHECK_HEADERS([ \ - sys/time.h sys/un.h sys/ioctl.h sys/stat.h \ - sys/mman.h sys/file.h \ - syslog.h pwd.h grp.h \ - net/if_tun.h net/tun/if_tun.h stropts.h \ - sys/sockio.h \ - sys/uio.h linux/if_tun.h linux/sockios.h \ - linux/types.h sys/poll.h sys/epoll.h err.h \ - ]) - AC_CHECK_HEADERS( - [net/if.h netinet/ip.h netinet/if_ether.h resolv.h], - , - , - [[${SOCKET_INCLUDES}]] - ) - - AC_FUNC_FORK -fi - -dnl We emulate signals in Windows -AC_CHECK_DECLS( - [SIGHUP], - , - [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])], - [[ - #ifdef HAVE_SIGNAL_H - #include <signal.h> - #endif - ]] -) -AC_CHECK_DECLS( - [SIGINT], - , - [AC_DEFINE([SIGINT], [2], [SIGINT replacement])], - [[ - #ifdef HAVE_SIGNAL_H - #include <signal.h> - #endif - ]] -) -AC_CHECK_DECLS( - [SIGUSR1], +AC_CHECK_HEADERS( + [net/if.h netinet/ip.h netinet/if_ether.h resolv.h], , - [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])], - [[ - #ifdef HAVE_SIGNAL_H - #include <signal.h> - #endif - ]] -) -AC_CHECK_DECLS( - [SIGUSR2], , - [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])], - [[ - #ifdef HAVE_SIGNAL_H - #include <signal.h> - #endif - ]] -) -AC_CHECK_DECLS( - [SIGTERM], - , - [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])], - [[ - #ifdef HAVE_SIGNAL_H - #include <signal.h> - #endif - ]] + [[${SOCKET_INCLUDES}]] ) AC_CHECK_TYPES(
@@ -503,8 +448,6 @@ AC_CHECK_TYPES( [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])], [[${SOCKET_INCLUDES}]] ) - -dnl check for IPv6 types AC_CHECK_TYPE( [struct tun_pi], [AC_DEFINE(HAVE_TUN_PI, 1, [struct tun_pi needed for IPv6 support])],
@@ -547,16 +490,72 @@ AC_CHECK_TYPE( [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])], [[${SOCKET_INCLUDES}]] ) +AC_CHECK_DECLS( + [SO_MARK], + , + , + [[${SOCKET_INCLUDES}]] +) -AC_CHECK_FUNCS( - [ctime memset vsnprintf strdup], +dnl We emulate signals in Windows +AC_CHECK_DECLS( + [SIGHUP], , - [AC_MSG_ERROR([Required library function not found])] + [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])], + [[ + #ifdef HAVE_SIGNAL_H + #include <signal.h> + #endif + ]] ) +AC_CHECK_DECLS( + [SIGINT], + , + [AC_DEFINE([SIGINT], [2], [SIGINT replacement])], + [[ + #ifdef HAVE_SIGNAL_H + #include <signal.h> + #endif + ]] +) +AC_CHECK_DECLS( + [SIGUSR1], + , + [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])], + [[ + #ifdef HAVE_SIGNAL_H + #include <signal.h> + #endif + ]] +) +AC_CHECK_DECLS( + [SIGUSR2], + , + [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])], + [[ + #ifdef HAVE_SIGNAL_H + #include <signal.h> + #endif + ]] +) +AC_CHECK_DECLS( + [SIGTERM], + , + [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])], + [[ + #ifdef HAVE_SIGNAL_H + #include <signal.h> + #endif + ]] +) + +AC_FUNC_FORK + AC_CHECK_FUNCS([ \ daemon chroot getpwnam setuid nice system getpid dup dup2 \ getpass strerror syslog openlog mlockall getgrnam setgid \ setgroups stat flock readv writev time gettimeofday \ + ctime memset vsnprintf strdup \ setsid chdir putenv getpeername unlink \ chsize ftruncate execve getpeereid umask basename dirname access \ epoll_create \
Signature · 1 line
1.7.3.4
PATCH 35/52 build: proper selinux detection and usage
In reply to Alon Bar-Lev--- configure.ac | 35 +++++++++++++++-------------------- src/openvpn/Makefile.am | 1 + src/openvpn/init.c | 4 ++-- src/openvpn/options.c | 6 +++--- src/openvpn/options.h | 2 +- src/openvpn/syshead.h | 2 +- 6 files changed, 23 insertions(+), 27 deletions(-)
configure.ac +15 -20
@@ -215,7 +215,7 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [selinux], - [AS_HELP_STRING([--disable-selinux], [disable SELinux support])], + [AS_HELP_STRING([--enable-selinux], [enable SELinux support])], , [enable_selinux="no"] )
@@ -619,6 +619,13 @@ AC_CHECK_LIB( ) AC_SUBST([SOCKETS_LIBS]) +AC_CHECK_LIB( + [selinux], + [setcon], + [SELINUX_LIBS="-lselinux"] +) +AC_SUBST([SELINUX_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(
@@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then fi fi -dnl -dnl check for SELinux library and headers -dnl -if test "${enable_selinux}" = "yes"; then - AC_CHECK_HEADER( - [selinux/selinux.h], - [AC_CHECK_LIB( - [selinux], - [setcon], - [ - LIBS="${LIBS} -lselinux" - AC_DEFINE(HAVE_SETCON, 1, [SELinux support]) - ], - [AC_MSG_RESULT([SELinux library not found.])] - )], - [AC_MSG_ERROR([SELinux headers not found.])] - ) -fi - if test -n "${SP_PLATFORM_WINDOWS}"; then AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #" AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
@@ -896,6 +884,12 @@ else fi fi +if test "${enable_selinux}" = "yes"; then + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing]) + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}" + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) +fi + if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -ansi -pedantic"
@@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR]) AC_SUBST([TAP_WIN_MIN_MINOR]) AC_SUBST([OPTIONAL_DL_LIBS]) +AC_SUBST([OPTIONAL_SELINUX_LIBS]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
src/openvpn/Makefile.am +1 -0
@@ -97,6 +97,7 @@ openvpn_SOURCES = \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ $(SOCKETS_LIBS) \ + $(OPTIONAL_SELINUX_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rc
src/openvpn/init.c +2 -2
@@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)mstats_open (c->options.memstats_fn);#endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX /* Apply a SELinux context in order to restrict what OpenVPN can do * to _only_ what it is supposed to do after initialization is complete * (basically just network I/O operations). Doing it after chroot
@@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)msg (M_WARN ,"WARNING: --ping should normally be used with --ping-restart or --ping-exit" );if (o->username || o->groupname || o->chroot_dir -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX || o->selinux_context #endif )
src/openvpn/options.c +3 -3
@@ -316,7 +316,7 @@ static const char usage_message[] = "--user user : Set UID to user after initialization.\n" "--group group : Set GID to group after initialization.\n" "--chroot dir : Chroot to this directory after initialization.\n" -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX "--setcon context: Apply this SELinux context after initialization.\n" #endif"--cd dir : Change to this directory before initialization.\n"
@@ -1477,7 +1477,7 @@ show_settings (const struct options *o)SHOW_STR (groupname);SHOW_STR (chroot_dir);SHOW_STR (cd_dir); -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX SHOW_STR (selinux_context);#endif SHOW_STR (writepid);
@@ -4525,7 +4525,7 @@ add_option (struct options *options, } options->cd_dir = p[1 ]; } -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX else if (streq (p[0], "setcon") && p[1]) {VERIFY_PERMISSION (OPT_P_GENERAL );
src/openvpn/options.h +1 -1
@@ -310,7 +310,7 @@ struct optionsconst char *groupname;const char *chroot_dir;const char *cd_dir; -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX char *selinux_context;#endif const char *writepid;
src/openvpn/syshead.h +1 -1
@@ -176,7 +176,7 @@#include <sys/epoll.h> #endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX #include <selinux/selinux.h> #endif
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
Looks like a cleaner implementation than the earlier one. I take it AC_CHECK_HEADER is not anymore needed to detect selinux.h, but why exactly?
Besides that I give this one an ACK.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 175 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 35 +++++++++++++++-------------------- src/openvpn/Makefile.am | 1 + src/openvpn/init.c | 4 ++-- src/openvpn/options.c | 6 +++--- src/openvpn/options.h | 2 +- src/openvpn/syshead.h | 2 +- 6 files changed, 23 insertions(+), 27 deletions(-)configure.ac +15
-20@@ -215,7 +215,7 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [selinux], - [AS_HELP_STRING([--disable-selinux], [disable SELinux support])], + [AS_HELP_STRING([--enable-selinux], [enable SELinux support])], , [enable_selinux="no"] )@@ -619,6 +619,13 @@ AC_CHECK_LIB( ) AC_SUBST([SOCKETS_LIBS]) +AC_CHECK_LIB( + [selinux], + [setcon], + [SELINUX_LIBS="-lselinux"] +) +AC_SUBST([SELINUX_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(@@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then fi fi -dnl -dnl check for SELinux library and headers -dnl -if test "${enable_selinux}" = "yes"; then - AC_CHECK_HEADER( - [selinux/selinux.h], - [AC_CHECK_LIB( - [selinux], - [setcon], - [ - LIBS="${LIBS} -lselinux" - AC_DEFINE(HAVE_SETCON, 1, [SELinux support]) - ], - [AC_MSG_RESULT([SELinux library not found.])] - )], - [AC_MSG_ERROR([SELinux headers not found.])] - ) -fi - if test -n "${SP_PLATFORM_WINDOWS}"; then AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #" AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"@@ -896,6 +884,12 @@ else fi fi +if test "${enable_selinux}" = "yes"; then + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing]) + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}" + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) +fi + if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -ansi -pedantic"@@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR]) AC_SUBST([TAP_WIN_MIN_MINOR]) AC_SUBST([OPTIONAL_DL_LIBS]) +AC_SUBST([OPTIONAL_SELINUX_LIBS]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])src/openvpn/Makefile.am +1
-0@@ -97,6 +97,7 @@ openvpn_SOURCES = \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ $(SOCKETS_LIBS) \ + $(OPTIONAL_SELINUX_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rcsrc/openvpn/init.c +2
-2@@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)mstats_open (c->options.memstats_fn);#endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX /* Apply a SELinux context in order to restrict what OpenVPN can do * to _only_ what it is supposed to do after initialization is complete * (basically just network I/O operations). Doing it after chroot @@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)msg (M_WARN ,"WARNING: --ping should normally be used with --ping-restart or --ping-exit" );if (o->username || o->groupname || o->chroot_dir -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX || o->selinux_context #endif )src/openvpn/options.c +3
-3@@ -316,7 +316,7 @@ static const char usage_message[] = "--user user : Set UID to user after initialization.\n" "--group group : Set GID to group after initialization.\n" "--chroot dir : Chroot to this directory after initialization.\n" -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX "--setcon context: Apply this SELinux context after initialization.\n" #endif"--cd dir : Change to this directory before initialization.\n" @@ -1477,7 +1477,7 @@ show_settings (const struct options *o)SHOW_STR (groupname);SHOW_STR (chroot_dir);SHOW_STR (cd_dir); -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX SHOW_STR (selinux_context);#endif SHOW_STR (writepid);@@ -4525,7 +4525,7 @@ add_option (struct options *options, } options->cd_dir = p[1 ]; } -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX else if (streq (p[0], "setcon") && p[1]) {VERIFY_PERMISSION (OPT_P_GENERAL );src/openvpn/options.h +1
-1@@ -310,7 +310,7 @@ struct optionsconst char *groupname;const char *chroot_dir;const char *cd_dir; -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX char *selinux_context;#endif const char *writepid;src/openvpn/syshead.h +1
-1@@ -176,7 +176,7 @@#include <sys/epoll.h> #endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX #include <selinux/selinux.h> #endif
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
I wrote this in the introduction of the patch set.
There are two approaches to detecting dependencies:
1. Detect all compile time dependences- you detect headers and libraries, this is probably the safest way to go, but makes the code very complex.
2. Detect library only - you assume that if library is present, the functionality exists, this is what important... no need to check for header, most probably this exists as well. This makes the code simpler, in the risk of compile failure if header is missing.
In all project I wrote build for (opensc, uswsusp, ntfs3g, ecryptfs) we took the 2nd approach, and it is fine.
Alon.
2012/3/8 Samuli Seppänen <[email protected]...>:
Quoted 187 lines
Looks like a cleaner implementation than the earlier one. I take it
AC_CHECK_HEADERis not anymore needed to detectselinux.h, but why exactly?Besides that I give this one an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Incirc freenode net: mattock
Quoted 175 lines
Signed-off-by Alon Bar-Lev <[email protected]...>---
configure.ac | 35 +++++++++++++++-------------------- src/openvpn/Makefile.am | 1 +
src/openvpn/init.c | 4 ++--src/openvpn/options.c | 6 +++--- src/openvpn/options.h | 2 +- src/openvpn/syshead.h | 2 +- 6 files changed, 23 insertions(+), 27 deletions(-)configure.ac +0
-0@@ -215,7 +215,7 @@ AC_ARG_ENABLE(AC_ARG_ENABLE(
[selinux],
- [AS_HELP_STRING([--disable-selinux], [disable SELinux support])],
+ [AS_HELP_STRING([--enable-selinux], [enable SELinux support])], ,
[enable_selinux="no"]
)configure.ac +7
-0@@ -619,6 +619,13 @@ AC_CHECK_LIB( ) AC_SUBST([SOCKETS_LIBS]) +AC_CHECK_LIB( + [selinux], + [setcon], + [SELINUX_LIBS="-lselinux"] +) +AC_SUBST([SELINUX_LIBS]) +case "${with_mem_check}" in
valgrind)
AC_CHECK_HEADER(configure.ac +0
-0@@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; thenfi
ficonfigure.ac +0
-19-dnl -dnl check for SELinux library and headers -dnl -if test "${enable_selinux}" = "yes"; then - AC_CHECK_HEADER( - [selinux/selinux.h], - [AC_CHECK_LIB( - [selinux], - [setcon], - [ - LIBS="${LIBS} -lselinux" - AC_DEFINE(HAVE_SETCON, 1, [SELinux support]) - ], - [AC_MSG_RESULT([SELinux library not found.])] - )], - [AC_MSG_ERROR([SELinux headers not found.])] - ) -fi -if test -n "${SP_PLATFORM_WINDOWS}"; then
AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator])#"AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator])#"configure.ac +0
-0@@ -896,6 +884,12 @@ elsefi
ficonfigure.ac +6
-0+if test "${enable_selinux}" = "yes"; then + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing]) + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}" + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) +fi +if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
CFLAGS="${CFLAGS} -ansi -pedantic"configure.ac +1
-0@@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR]) AC_SUBST([TAP_WIN_MIN_MINOR]) AC_SUBST([OPTIONAL_DL_LIBS]) +AC_SUBST([OPTIONAL_SELINUX_LIBS]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])src/openvpn/Makefile.am +0
-0@@ -97,6 +97,7 @@ openvpn_SOURCES = \
cryptoapi.hcryptoapi.c
openvpn_LDADD = \
$(SOCKETS_LIBS) \
+ $(OPTIONAL_SELINUX_LIBS) \
$(OPTIONAL_DL_LIBS)
if WIN32
openvpn_SOURCES += openvpn_win32_resources.rcsrc/openvpn/init.c +1
-1@@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay) mstats_open(c->options.memstats_fn); #endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX /* Apply a SELinux context in order to restrict what OpenVPN can do* to _only_ what it is supposed to do after initialization is complete * (basically just network I/O operations). Doing it after chroot @@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c) msg (M_WARN, "WARNING: --ping should normally be used with --ping-restart or --ping-exit");if (
o->username||o->groupname||o->chroot_dirsrc/openvpn/init.c +1
-1-#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX ||
o->selinux_context
#endif
)src/openvpn/options.c +0
-0@@ -316,7 +316,7 @@ static const char usage_message[] ="--user user : Set UID to user after initialization.\n" "--group group : Set GID to group after initialization.\n" "--chroot dir : Chroot to this directory after initialization.\n"
src/openvpn/options.c +1
-1-#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX "--setcon context: Apply this SELinux context after initialization.\n" #endif
"--cd dir : Change to this directory before initialization.\n"src/openvpn/options.c +2
-2@@ -1477,7 +1477,7 @@ show_settings (const struct options *o) SHOW_STR (groupname); SHOW_STR (chroot_dir); SHOW_STR (cd_dir); -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX SHOW_STR (selinux_context); #endif SHOW_STR (writepid);@@ -4525,7 +4525,7 @@ add_option (struct options *options, } options->cd_dir = p[1]; } -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX else if (streq (p[0], "setcon") && p[1]) { VERIFY_PERMISSION (OPT_P_GENERAL);src/openvpn/options.h +1
-1@@ -310,7 +310,7 @@ struct options const char *groupname; const char *chroot_dir; const char *cd_dir; -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX char *selinux_context; #endif const char *writepid;src/openvpn/syshead.h +1
-1@@ -176,7 +176,7 @@ #include <sys/epoll.h> #endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX #include <selinux/selinux.h> #endif
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
Thanks for the clarification. ACK then.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 205 lines
I wrote this in the introduction of the patch set.
There are two approaches to detecting dependencies:
1. Detect all compile time dependences- you detect headers and libraries, this is probably the safest way to go, but makes the code very complex.
2. Detect library only - you assume that if library is present, the functionality exists, this is what important... no need to check for header, most probably this exists as well. This makes the code simpler, in the risk of compile failure if header is missing.
In all project I wrote build for (opensc, uswsusp, ntfs3g, ecryptfs) we took the 2nd approach, and it is fine.
Alon.
2012/3/8 Samuli Seppänen <[email protected]...>:
Quoted 186 lines
Looks like a cleaner implementation than the earlier one. I take it
AC_CHECK_HEADERis not anymore needed to detectselinux.h, but why exactly?Besides that I give this one an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Incirc freenode net: mattock
Quoted 175 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 35 +++++++++++++++-------------------- src/openvpn/Makefile.am | 1 + src/openvpn/init.c | 4 ++-- src/openvpn/options.c | 6 +++--- src/openvpn/options.h | 2 +- src/openvpn/syshead.h | 2 +- 6 files changed, 23 insertions(+), 27 deletions(-)configure.ac +15
-20@@ -215,7 +215,7 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [selinux], - [AS_HELP_STRING([--disable-selinux], [disable SELinux support])], + [AS_HELP_STRING([--enable-selinux], [enable SELinux support])], , [enable_selinux="no"] )@@ -619,6 +619,13 @@ AC_CHECK_LIB( ) AC_SUBST([SOCKETS_LIBS]) +AC_CHECK_LIB( + [selinux], + [setcon], + [SELINUX_LIBS="-lselinux"] +) +AC_SUBST([SELINUX_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER(@@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then fi fi -dnl -dnl check for SELinux library and headers -dnl -if test "${enable_selinux}" = "yes"; then - AC_CHECK_HEADER( - [selinux/selinux.h], - [AC_CHECK_LIB( - [selinux], - [setcon], - [ - LIBS="${LIBS} -lselinux" - AC_DEFINE(HAVE_SETCON, 1, [SELinux support]) - ], - [AC_MSG_RESULT([SELinux library not found.])] - )], - [AC_MSG_ERROR([SELinux headers not found.])] - ) -fi - if test -n "${SP_PLATFORM_WINDOWS}"; then AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #" AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"@@ -896,6 +884,12 @@ else fi fi +if test "${enable_selinux}" = "yes"; then + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing]) + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}" + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) +fi + if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -ansi -pedantic"@@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR]) AC_SUBST([TAP_WIN_MIN_MINOR]) AC_SUBST([OPTIONAL_DL_LIBS]) +AC_SUBST([OPTIONAL_SELINUX_LIBS]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])src/openvpn/Makefile.am +1
-0@@ -97,6 +97,7 @@ openvpn_SOURCES = \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ $(SOCKETS_LIBS) \ + $(OPTIONAL_SELINUX_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32 openvpn_SOURCES += openvpn_win32_resources.rcsrc/openvpn/init.c +2
-2@@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)mstats_open (c->options.memstats_fn);#endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX /* Apply a SELinux context in order to restrict what OpenVPN can do * to _only_ what it is supposed to do after initialization is complete * (basically just network I/O operations). Doing it after chroot @@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)msg (M_WARN ,"WARNING: --ping should normally be used with --ping-restart or --ping-exit" );if (o->username || o->groupname || o->chroot_dir -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX || o->selinux_context #endif )src/openvpn/options.c +3
-3@@ -316,7 +316,7 @@ static const char usage_message[] = "--user user : Set UID to user after initialization.\n" "--group group : Set GID to group after initialization.\n" "--chroot dir : Chroot to this directory after initialization.\n" -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX "--setcon context: Apply this SELinux context after initialization.\n" #endif"--cd dir : Change to this directory before initialization.\n" @@ -1477,7 +1477,7 @@ show_settings (const struct options *o)SHOW_STR (groupname);SHOW_STR (chroot_dir);SHOW_STR (cd_dir); -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX SHOW_STR (selinux_context);#endif SHOW_STR (writepid);@@ -4525,7 +4525,7 @@ add_option (struct options *options, } options->cd_dir = p[1 ]; } -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX else if (streq (p[0], "setcon") && p[1]) {VERIFY_PERMISSION (OPT_P_GENERAL );src/openvpn/options.h +1
-1@@ -310,7 +310,7 @@ struct optionsconst char *groupname;const char *chroot_dir;const char *cd_dir; -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX char *selinux_context;#endif const char *writepid;src/openvpn/syshead.h +1
-1@@ -176,7 +176,7 @@#include <sys/epoll.h> #endif -#ifdef HAVE_SETCON +#ifdef ENABLE_SELINUX #include <selinux/selinux.h> #endif
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
In reply to Alon Bar-LevHi Alon,
sorry for digging up the dead, but our disagreements might have started earlier and just went unnoticed so far ... :)
2012/3/8 Alon Bar-Lev <[email protected]...>:
Quoted 7 lines
I wrote this in the introduction of the patch set.
There are two approaches to detecting dependencies:
1. Detect all compile time dependences- you detect headers and libraries, this is probably the safest way to go, but makes the code very complex.
Are you referring to the configure code? I might be missing something obvious, but
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])
versus
AC_CHECK_HEADER([selinux/selinux.h], [
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"],
[AC_MSG_RESULT([SELinux library not found.])]
)], [AC_MSG_ERROR([SELinux headers not found.])]
)
doesn't really qualify as "very complex" to me.
Quoted 4 lines
2. Detect library only - you assume that if library is present, the functionality exists, this is what important... no need to check for header, most probably this exists as well. This makes the code simpler, in the risk of compile failure if header is missing.
Which is less convenient for the user who expects _configure_ to figure out those kinds of problems. My expectation would be: If configure thinks everything is fine, the build should normally compile without errors unless there's a bug in the lib / the program.
Your two alternatives don't really sound like whether or not we want auto-detection but more like what kinds of problems to detect at configure time.
1. detect missing / misplaced libs and missing / misplaced headers
2. detect missing / misplaced libs
Library auto-detection would IMHO be
a) to enable / disable features based on which libraries were found and/or
b) to search additional non-standard paths for the libraries and headers.
Some projects implement b), but I wouldn't recommend it. I tend to also disagree with a), depending on the dependency. For example, I could see configure enabling/disabling selinux automatically, unless explicitly told to use a specific setting.
Cheers
Fabian
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
Quoted 21 lines · Fabian Knittel
Hi Alon,
sorry for digging up the dead, but our disagreements might have started earlier and just went unnoticed so far ... :)
2012/3/8 Alon Bar-Lev <[email protected]...>:
Quoted 7 lines
I wrote this in the introduction of the patch set.
There are two approaches to detecting dependencies:
1. Detect all compile time dependences- you detect headers and libraries, this is probably the safest way to go, but makes the code very complex.
Are you referring to the configure code? I might be missing something obvious, but
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])versus
Quoted 7 lines
AC_CHECK_HEADER([selinux/selinux.h], [
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"], [AC_MSG_RESULT([SELinux library not found.])] )], [AC_MSG_ERROR([SELinux headers not found.])]
)doesn't really qualify as "very complex" to me.
This is untrue.
As most features needs custom CFLAGs as well, it looks like:
old_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${SOME_CFLAGS}"AC_CHECK_HEADER([...])
CFLAGS="${old_CFLAGS}"
And as I wrote, in all build system I re-wrote I used this approach, no negative impact what so ever.
I don't mind doing this differently in openvpn *IF* there is a good reason to do so.
A good reason not to do this is to lower the line of code in autoconf.
Alon.
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
Hi Alon,
Quoted 12 lines
Quoted 11 lines
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])versus
AC_CHECK_HEADER([selinux/selinux.h], [
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"], [AC_MSG_RESULT([SELinux library not found.])] )], [AC_MSG_ERROR([SELinux headers not found.])]
)doesn't really qualify as "very complex" to me.
Quoted 7 lines
This is untrue.
As most features needs custom CFLAGs as well, it looks like:old_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${SOME_CFLAGS}"AC_CHECK_HEADER([...])
CFLAGS="${old_CFLAGS}"
I can see where this would be necessary if you wanted to "search additional non-standard paths for the libraries and headers" (see my last email), but it wouldn't be necessary for the simple case, where you want to make sure that library and header are available and compilable with the flags the user provided.
So it sounds as if we're actually somewhat in agreement! You don't want complex, automatic detection of non-standard situations and I agree wholeheartedly.
But I _do_ want basic checking to achieve clear error messages at configuration time, not obscure build errors far later in the build process. Rule of thumb: If "make" fails due to missing or wrong dependencies, it's a bug in configure, because it didn't detect the problem beforehand.
Cheers
Fabian
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
Quoted 8 lines · Fabian Knittel
So it sounds as if we're actually somewhat in agreement! You don't want complex, automatic detection of non-standard situations and I agree wholeheartedly.
But I _do_ want basic checking to achieve clear error messages at configuration time, not obscure build errors far later in the build process. Rule of thumb: If "make" fails due to missing or wrong dependencies, it's a bug in configure, because it didn't detect the problem beforehand.
I understand your argument.
However, from my experience it is not needed, people are most capable of manage this without creating noise.
I suggest to leave this as-is and if for some reason the audience of openvpn is different than other project I handle, we modify it.
Alon.
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
Quoted 4 lines
However, from my experience it is not needed, people are most capable of manage this without creating noise.
On the contrary, displaying meaningful error messages from configure is *never* a "noise". As Fabian pointed out - quite rightly - if make fails due to wrong/incorrect/missing dependencies then it is a bug in configure, no ifs, no buts, therefore displaying an error messages when some of the headers/libs are missing or misplaced makes perfect sense.
Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
In reply to Fabian KnittelQuoted 8 lines
Are you referring to the configure code? I might be missing something obvious, but
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])versus
Quoted 8 lines
AC_CHECK_HEADER([selinux/selinux.h], [
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"],
[AC_MSG_RESULT([SELinux library not found.])]
)], [AC_MSG_ERROR([SELinux headers not found.])]
)doesn't really qualify as "very complex" to me.
Of course it isn't - and it is the better choice - by a mile! The primary function of configure has always been not only to find out what the build environment is like, but to also figure out a potential build problems/missing headers/libraries and _communicate_ those findings, so that potential errors down the line during the build process are easily discovered and removed at source.
The last thing I, as a person compiling/building OpenVPN, want is to debug a config.log and then the configure file itself to find out why a specific part of OpenVPN build has failed. The former - rather obscure - statement does not give me that option, while the latter discovers this and properly communicates it.
Quoted 17 lines
Quoted 5 lines
2. Detect library only - you assume that if library is present, the functionality exists, this is what important... no need to check for header, most probably this exists as well. This makes the code simpler, in the risk of compile failure if header is missing.
Which is less convenient for the user who expects _configure_ to figure out those kinds of problems. My expectation would be: If configure thinks everything is fine, the build should normally compile without errors unless there's a bug in the lib / the program.
Your two alternatives don't really sound like whether or not we want auto-detection but more like what kinds of problems to detect at configure time.
1. detect missing / misplaced libs and missing / misplaced headers
2. detect missing / misplaced libs
Quoted 9 lines
Library auto-detection would IMHO be
a) to enable / disable features based on which libraries were found and/or
b) to search additional non-standard paths for the libraries and headers.Some projects implement b), but I wouldn't recommend it. I tend to also disagree with a), depending on the dependency. For example, I could see configure enabling/disabling selinux automatically, unless explicitly told to use a specific setting.
Exactly - every single word of it!
PATCH 36/52 build: distribute pkg.m4
In reply to Alon Bar-LevRHEL and others do not install this globally, so we provide our own copy.
--- m4/pkg.m4 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 159 insertions(+), 0 deletions(-) create mode 100644 m4/pkg.m4
m4/pkg.m4 new file +159 -0
@@ -0,0 +1,159 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant <[email protected]...>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 36/52] build: distribute pkg.m4
If we need pkg-config, then we also want this one:
"Macros to locate and utilise pkg-config"
ACK.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 173 lines
RHEL and others do not install this globally, so we provide our own copy.
Signed-off-by Alon Bar-Lev <[email protected]...>--- m4/pkg.m4 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 159 insertions(+), 0 deletions(-) create mode 100644 m4/pkg.m4m4/pkg.m4 new file +159
-0@@ -0,0 +1,159 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant <[email protected]...>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES
PATCH 37/52 build: proper pkcs11-helper detection and usage
In reply to Alon Bar-Lev--- configure.ac | 49 ++++++++++++++++--------------------------- distro/rpm/openvpn.spec.in | 5 ++- src/openvpn/Makefile.am | 4 +++ src/openvpn/ssl.c | 2 +- src/openvpn/syshead.h | 7 ------ 5 files changed, 26 insertions(+), 41 deletions(-)
configure.ac +18 -31
@@ -111,9 +111,9 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [pkcs11], - [AS_HELP_STRING([--disable-pkcs11], [disable pkcs11 support])], + [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])], , - [enable_pkcs11="yes"] + [enable_pkcs11="no"] ) AC_ARG_ENABLE(
@@ -254,19 +254,6 @@ AC_ARG_WITH( ) AC_ARG_WITH( - [pkcs11-helper-headers], - [AS_HELP_STRING([--with-pkcs11-helper-headers=DIR], [pkcs11-helper Include files location])], - [PKCS11_HELPER_HDR_DIR="$withval"] - [CPPFLAGS="$CPPFLAGS -I$withval"] -) - -AC_ARG_WITH( - [pkcs11-helper-lib], - [AS_HELP_STRING([--with-pkcs11-helper-lib=DIR], [pkcs11-helper Library location])], - [LDFLAGS="$LDFLAGS -L$withval"] -) - -AC_ARG_WITH( [mem-check], [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])], [
@@ -719,22 +706,12 @@ if test "${enable_lzo_stub}" = "yes"; then AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability]) fi -dnl -dnl enable pkcs11 capability -dnl -if test "${enable_pkcs11}" = "yes"; then - AC_CHECKING([for pkcs11-helper Library and Header files]) - AC_CHECK_HEADER(pkcs11-helper-1.0/pkcs11h-core.h, - [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize, - [ - AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability]) - LIBS="${LIBS} -lpkcs11-helper" - ], - [AC_MSG_RESULT([pkcs11-helper library not found.])] - )], - [AC_MSG_RESULT([pkcs11-helper headers not found.])] - ) -fi +PKG_CHECK_MODULES( + [PKCS11_HELPER], + [libpkcs11-helper-1 >= 1.02], + [have_pkcs11_helper="yes"], + [] +) dnl dnl check for SSL-crypto library
@@ -890,6 +867,14 @@ if test "${enable_selinux}" = "yes"; then AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) fi +if test "${enable_pkcs11}" = "yes"; then + test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing]) + test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled]) + OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}" + OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}" + AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11]) +fi + if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -ansi -pedantic"
@@ -917,6 +902,8 @@ AC_SUBST([TAP_WIN_MIN_MINOR]) AC_SUBST([OPTIONAL_DL_LIBS]) AC_SUBST([OPTIONAL_SELINUX_LIBS]) +AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS]) +AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
distro/rpm/openvpn.spec.in +3 -2
@@ -52,8 +52,8 @@ Requires: openssl >= 0.9.6 %{!?without_pam:BuildRequires: pam-devel} %{!?without_pam:Requires: pam} -%{!?with_pkcs11:BuildRequires: pkcs11-helper-devel} -%{!?with_pkcs11:Requires: pkcs11-helper} +%{?with_pkcs11:BuildRequires: pkcs11-helper-devel} +%{?with_pkcs11:Requires: pkcs11-helper} # # Description
@@ -111,6 +111,7 @@ Development support for OpenVPN. --docdir="%{_docdir}/%{name}-%{version}" \ %{?with_password_save:--enable-password-save} \ %{?without_lzo:--disable-lzo} \ + %{?with_pkcs11:--enable-pkcs11} \ %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include} %__make
src/openvpn/Makefile.am +4 -0
@@ -16,6 +16,9 @@ MAINTAINERCLEANFILES = \ INCLUDES = -I$(top_srcdir)/include +AM_CFLAGS = \ + $(OPTIONAL_PKCS11_HELPER_CFLAGS) + sbin_PROGRAMS = openvpn openvpn_SOURCES = \
@@ -97,6 +100,7 @@ openvpn_SOURCES = \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ $(SOCKETS_LIBS) \ + $(OPTIONAL_PKCS11_HELPER_LIBS) \ $(OPTIONAL_SELINUX_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32
src/openvpn/ssl.c +1 -1
@@ -264,7 +264,7 @@ ssl_purge_auth (const bool auth_user_pass_only) {if (!auth_user_pass_only) { -#ifdef USE_PKCS11 +#ifdef ENABLE_PKCS11 pkcs11_logout ();#endif purge_user_pass (&passbuf, true);
src/openvpn/syshead.h +0 -7
@@ -590,13 +590,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Do we have PKCS11 capability? -*/ -#if defined(USE_PKCS11 ) && defined(USE_CRYPTO ) && defined(USE_SSL ) -#define ENABLE_PKCS11 -#endif - -/* * Do we have CryptoAPI capability? */ #if defined(WIN32 ) && defined(USE_CRYPTO ) && defined(USE_SSL ) && defined(USE_OPENSSL )
Signature · 1 line
1.7.3.4
Re: [Openvpn-devel] [PATCH 37/52] build: proper pkcs11-helper detection and usage
These changes follow the same style as earlier patches, e.g. the selinux patch. Pkg-config is now being used to detect pkcs11-helper afaics. Also, pkcs11-helper now disabled by default, which I think makes sense.
I don't see why this shouldn't be included, so it's an ACK.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 174 lines
Signed-off-by Alon Bar-Lev <[email protected]...>--- configure.ac | 49 ++++++++++++++++--------------------------- distro/rpm/openvpn.spec.in | 5 ++- src/openvpn/Makefile.am | 4 +++ src/openvpn/ssl.c | 2 +- src/openvpn/syshead.h | 7 ------ 5 files changed, 26 insertions(+), 41 deletions(-)configure.ac +18
-31@@ -111,9 +111,9 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [pkcs11], - [AS_HELP_STRING([--disable-pkcs11], [disable pkcs11 support])], + [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])], , - [enable_pkcs11="yes"] + [enable_pkcs11="no"] ) AC_ARG_ENABLE(@@ -254,19 +254,6 @@ AC_ARG_WITH( ) AC_ARG_WITH( - [pkcs11-helper-headers], - [AS_HELP_STRING([--with-pkcs11-helper-headers=DIR], [pkcs11-helper Include files location])], - [PKCS11_HELPER_HDR_DIR="$withval"] - [CPPFLAGS="$CPPFLAGS -I$withval"] -) - -AC_ARG_WITH( - [pkcs11-helper-lib], - [AS_HELP_STRING([--with-pkcs11-helper-lib=DIR], [pkcs11-helper Library location])], - [LDFLAGS="$LDFLAGS -L$withval"] -) - -AC_ARG_WITH( [mem-check], [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])], [@@ -719,22 +706,12 @@ if test "${enable_lzo_stub}" = "yes"; then AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability]) fi -dnl -dnl enable pkcs11 capability -dnl -if test "${enable_pkcs11}" = "yes"; then - AC_CHECKING([for pkcs11-helper Library and Header files]) - AC_CHECK_HEADER(pkcs11-helper-1.0/pkcs11h-core.h, - [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize, - [ - AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability]) - LIBS="${LIBS} -lpkcs11-helper" - ], - [AC_MSG_RESULT([pkcs11-helper library not found.])] - )], - [AC_MSG_RESULT([pkcs11-helper headers not found.])] - ) -fi +PKG_CHECK_MODULES( + [PKCS11_HELPER], + [libpkcs11-helper-1 >= 1.02], + [have_pkcs11_helper="yes"], + [] +) dnl dnl check for SSL-crypto library@@ -890,6 +867,14 @@ if test "${enable_selinux}" = "yes"; then AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) fi +if test "${enable_pkcs11}" = "yes"; then + test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing]) + test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled]) + OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}" + OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}" + AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11]) +fi + if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -ansi -pedantic"@@ -917,6 +902,8 @@ AC_SUBST([TAP_WIN_MIN_MINOR]) AC_SUBST([OPTIONAL_DL_LIBS]) AC_SUBST([OPTIONAL_SELINUX_LIBS]) +AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS]) +AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS]) AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])distro/rpm/openvpn.spec.in +3
-2@@ -52,8 +52,8 @@ Requires: openssl >= 0.9.6 %{!?without_pam:BuildRequires: pam-devel} %{!?without_pam:Requires: pam} -%{!?with_pkcs11:BuildRequires: pkcs11-helper-devel} -%{!?with_pkcs11:Requires: pkcs11-helper} +%{?with_pkcs11:BuildRequires: pkcs11-helper-devel} +%{?with_pkcs11:Requires: pkcs11-helper} # # Description@@ -111,6 +111,7 @@ Development support for OpenVPN. --docdir="%{_docdir}/%{name}-%{version}" \ %{?with_password_save:--enable-password-save} \ %{?without_lzo:--disable-lzo} \ + %{?with_pkcs11:--enable-pkcs11} \ %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include} %__makesrc/openvpn/Makefile.am +4
-0@@ -16,6 +16,9 @@ MAINTAINERCLEANFILES = \ INCLUDES = -I$(top_srcdir)/include +AM_CFLAGS = \ + $(OPTIONAL_PKCS11_HELPER_CFLAGS) + sbin_PROGRAMS = openvpn openvpn_SOURCES = \@@ -97,6 +100,7 @@ openvpn_SOURCES = \ cryptoapi.h cryptoapi.c openvpn_LDADD = \ $(SOCKETS_LIBS) \ + $(OPTIONAL_PKCS11_HELPER_LIBS) \ $(OPTIONAL_SELINUX_LIBS) \ $(OPTIONAL_DL_LIBS) if WIN32src/openvpn/ssl.c +1
-1@@ -264,7 +264,7 @@ ssl_purge_auth (const bool auth_user_pass_only) {if (!auth_user_pass_only) { -#ifdef USE_PKCS11 +#ifdef ENABLE_PKCS11 pkcs11_logout ();#endif purge_user_pass (&passbuf, true);src/openvpn/syshead.h +0
-7@@ -590,13 +590,6 @@ socket_defined (const socket_descriptor_t sd)#endif /* -* Do we have PKCS11 capability? -*/ -#if defined(USE_PKCS11 ) && defined(USE_CRYPTO ) && defined(USE_SSL ) -#define ENABLE_PKCS11 -#endif - -/* * Do we have CryptoAPI capability? */ #if defined(WIN32 ) && defined(USE_CRYPTO ) && defined(USE_SSL ) && defined(USE_OPENSSL )