--- isakmpd-20041012.orig/GNUmakefile
+++ isakmpd-20041012/GNUmakefile
@@ -40,12 +40,12 @@
 # integrated, freebsd/netbsd means FreeBSD/NetBSD with KAME IPsec.
 # darwin means MacOS X 10.2 and later with KAME IPsec. linux means Linux-2.5
 # and later with native IPSec support.
-OS=		openbsd
+#OS=		openbsd
 #OS=		netbsd
 #OS=		freebsd
 #OS=		freeswan
 #OS=		darwin
-#OS=		linux
+OS=		linux
 
 .CURDIR:=	$(shell pwd)
 VPATH=		${.CURDIR}/sysdep/${OS}
@@ -55,9 +55,10 @@
 ifndef BINDIR
 BINDIR=		/sbin
 endif
-ifndef LDSTATIC
-LDSTATIC=	-static
-endif
+
+#ifndef LDSTATIC
+#LDSTATIC=	-static
+#endif
 
 SRCS=		app.c attribute.c cert.c connection.c \
 		constants.c conf.c cookie.c crypto.c dh.c doi.c exchange.c \
@@ -131,11 +132,14 @@
 ifneq ($(findstring install,$(MAKECMDGOALS)),install)
 # Skip 'regress' until the regress/ structure has gmake makefiles for it.
 #SUBDIR:=	regress
-SUBDIR:=
+SUBDIR:=	apps/certpatch
 mksubdirs:
 	$(foreach DIR, ${SUBDIR}, \
-		cd ${DIR}; ${MAKE} ${MAKEFLAGS} CFLAGS="${CFLAGS}" \
-			MKDEP="${MKDEP}" ${MAKECMDGOALS})
+		cd ${.CURDIR}/${DIR}; ${MAKE} ${MAKECMDGOALS};)
+		
+#	$(foreach DIR, ${SUBDIR}, \
+#		cd ${DIR}; ${MAKE} CFLAGS="${CFLAGS}" \
+#			MKDEP="${MKDEP}" ${MAKECMDGOALS})
 else
 mksubdirs:
 endif
@@ -173,7 +177,7 @@
 endif
 
 SRCS+=		${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \
-		$(ISAKMP_CFG)
+			$(ISAKMP_CFG) ${DPD} ${NAT_TRAVERSAL}
 CFLAGS+=	${IPSEC_CFLAGS}
 LDADD+=		${DESLIB}
 DPADD+=		${DESLIBDEP}
--- isakmpd-20041012.orig/apps/certpatch/GNUmakefile
+++ isakmpd-20041012/apps/certpatch/GNUmakefile
@@ -0,0 +1,55 @@
+#	$OpenBSD: Makefile,v 1.7 2003/06/03 14:35:00 ho Exp $
+#	$EOM: Makefile,v 1.6 2000/03/28 21:22:06 ho Exp $
+
+#
+# Copyright (c) 1999 Niels Provos.  All rights reserved.
+# Copyright (c) 2001 Niklas Hallqvist.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# This code was written under funding by Ericsson Radio Systems.
+#
+
+PROG=		certpatch
+SRCS=		certpatch.c
+BINDIR?=	/usr/sbin
+TOPSRC=		${.CURDIR}../..
+TOPOBJ!=	cd ${TOPSRC}; printf "all:\n\t@pwd\n" |${MAKE} -f-
+OS=			linux
+FEATURES!=	awk '/^FEATURES=/ { print $$0 }' ${.CURDIR}/../../Makefile | sed 's/FEATURES=.//'
+.PATH:		${TOPSRC} ${TOPSRC}/sysdep/${OS} ${TOPOBJ}
+CFLAGS+=	-I${TOPSRC} -I${TOPSRC}/sysdep/${OS} -I${TOPOBJ} -Wall
+LDFLAGS+=	-lcrypto -lssl -lgmp
+MAN=		certpatch.8
+
+CFLAGS+=	-DMP_FLAVOUR=MP_FLAVOUR_GMP
+LDADD+=		-lgmp
+DPADD+=		${LIBGMP}
+
+# Override LIBSYSDEPDIR definition from Makefile.sysdep
+LIBSYSDEPDIR=	${TOPSRC}/sysdep/common/libsysdep
+
+all:	${PROG}
+
+clean:	
+	rm -f ${PROG}
--- isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep
+++ isakmpd-20041012/sysdep/linux/GNUmakefile.sysdep
@@ -25,33 +25,33 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-LIBGMP:=	/usr/lib/libgmp.a
-LIBCRYPTO:=	/usr/lib/libcrypto.a
+#LIBGMP:=	/usr/lib/libgmp.a
+#LIBCRYPTO:=	/usr/lib/libcrypto.a
 LIBSYSDEPDIR:=	${.CURDIR}/sysdep/common/libsysdep
 LIBSYSDEP:=	${LIBSYSDEPDIR}/libsysdep.a
 
-LDADD+=		-lgmp ${LIBSYSDEP} ${LIBCRYPTO}
+LDADD+=		-lgmp -ldl -lcrypto ${LIBSYSDEP} ${LIBCRYPTO} 
 DPADD+=		${LIBGMP} ${LIBSYSDEP}
 
-CFLAGS+=	-DUSE_OLD_SOCKADDR -DHAVE_PCAP \
-		-DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP \
-		-I/usr/src/linux/include -I${.CURDIR}/sysdep/common \
+CFLAGS+=	-DHAVE_GETNAMEINFO -DUSE_OLD_SOCKADDR -DHAVE_PCAP \
+		-DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP -DUSE_AES \
+		-I${.CURDIR}/sysdep/linux/include -I${.CURDIR}/sysdep/common \
 		-I/usr/include/openssl
 
-FEATURES=	debug tripledes blowfish cast ec aggressive x509 policy
-FEATURES+=	des aes
+FEATURES=	debug tripledes blowfish cast ec aggressive x509
+FEATURES+=	dpd nat_traversal isakmp_cfg des aes
 
 IPSEC_SRCS=	pf_key_v2.c
 IPSEC_CFLAGS=	-DUSE_PF_KEY_V2
 
 USE_LIBCRYPO=	defined
 HAVE_DLOPEN=	defined
-USE_KEYNOTE=	defined
+# USE_KEYNOTE=	defined
 
 # hack libsysdep.a dependenc
 ${LIBSYSDEPDIR}/.depend ${LIBSYSDEP}:
 	cd ${LIBSYSDEPDIR} && \
-		${MAKE} --no-print-directory ${MAKEFLAGS} \
+		${MAKE} --no-print-directory \
 			CFLAGS="${CFLAGS}" MKDEP="${MKDEP}" ${MAKECMDGOALS}
 
 ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
