summaryrefslogtreecommitdiff
path: root/src/stroke
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:34:14 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:34:14 +0000
commited7d79f96177044949744da10f4431c1d6242241 (patch)
tree3aabaa55ed3b5291daef891cfee9befb5235e2b8 /src/stroke
parent7410d3c6d6a9a1cd7aa55083c938946af6ff9498 (diff)
downloadvyos-strongswan-ed7d79f96177044949744da10f4431c1d6242241.tar.gz
vyos-strongswan-ed7d79f96177044949744da10f4431c1d6242241.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.3.6)
Diffstat (limited to 'src/stroke')
-rw-r--r--src/stroke/Makefile.in161
-rw-r--r--src/stroke/stroke.c66
-rw-r--r--src/stroke/stroke_msg.h13
3 files changed, 154 insertions, 86 deletions
diff --git a/src/stroke/Makefile.in b/src/stroke/Makefile.in
index e2ed28afe..82f2be13d 100644
--- a/src/stroke/Makefile.in
+++ b/src/stroke/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -36,13 +38,20 @@ ipsec_PROGRAMS = stroke$(EXEEXT)
subdir = src/stroke
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
+ $(top_srcdir)/m4/config/ltoptions.m4 \
+ $(top_srcdir)/m4/config/ltsugar.m4 \
+ $(top_srcdir)/m4/config/ltversion.m4 \
+ $(top_srcdir)/m4/config/lt~obsolete.m4 \
+ $(top_srcdir)/m4/macros/with.m4 \
+ $(top_srcdir)/m4/macros/enable-disable.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(ipsecdir)"
-ipsecPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(ipsec_PROGRAMS)
am_stroke_OBJECTS = stroke.$(OBJEXT) stroke_keywords.$(OBJEXT)
stroke_OBJECTS = $(am_stroke_OBJECTS)
@@ -53,6 +62,7 @@ stroke_DEPENDENCIES = \
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -100,25 +110,22 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IPSEC_ROUTING_TABLE = @IPSEC_ROUTING_TABLE@
-IPSEC_ROUTING_TABLE_PRIO = @IPSEC_ROUTING_TABLE_PRIO@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_HEADERS = @LINUX_HEADERS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQLCFLAG = @MYSQLCFLAG@
+MYSQLCONFIG = @MYSQLCONFIG@
+MYSQLLIB = @MYSQLLIB@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
@@ -130,11 +137,14 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADLIB = @PTHREADLIB@
RANLIB = @RANLIB@
+RTLIB = @RTLIB@
RUBY = @RUBY@
RUBYINCLUDE = @RUBYINCLUDE@
SED = @SED@
@@ -163,9 +173,9 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
-confdir = @confdir@
datadir = @datadir@
datarootdir = @datarootdir@
+default_pkcs11 = @default_pkcs11@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
@@ -188,7 +198,7 @@ ipsecuser = @ipsecuser@
libdir = @libdir@
libexecdir = @libexecdir@
libstrongswan_plugins = @libstrongswan_plugins@
-linuxdir = @linuxdir@
+linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
@@ -196,6 +206,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
nm_CFLAGS = @nm_CFLAGS@
nm_LIBS = @nm_LIBS@
+nm_ca_dir = @nm_ca_dir@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
piddir = @piddir@
@@ -204,10 +215,12 @@ pluto_plugins = @pluto_plugins@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+random_device = @random_device@
resolv_conf = @resolv_conf@
+routing_table = @routing_table@
+routing_table_prio = @routing_table_prio@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-simreader = @simreader@
srcdir = @srcdir@
strongswan_conf = @strongswan_conf@
sysconfdir = @sysconfdir@
@@ -215,6 +228,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
stroke_SOURCES = stroke.c stroke_msg.h stroke_keywords.c stroke_keywords.h
@@ -238,9 +252,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/stroke/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/stroke/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/stroke/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/stroke/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -258,34 +272,50 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
install-ipsecPROGRAMS: $(ipsec_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(ipsecdir)" || $(MKDIR_P) "$(DESTDIR)$(ipsecdir)"
- @list='$(ipsec_PROGRAMS)'; for p in $$list; do \
- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- if test -f $$p \
- || test -f $$p1 \
- ; then \
- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ipsecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(ipsecdir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(ipsecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(ipsecdir)/$$f" || exit 1; \
- else :; fi; \
- done
+ @list='$(ipsec_PROGRAMS)'; test -n "$(ipsecdir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(ipsecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(ipsecdir)$$dir" || exit $$?; \
+ } \
+ ; done
uninstall-ipsecPROGRAMS:
@$(NORMAL_UNINSTALL)
- @list='$(ipsec_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f '$(DESTDIR)$(ipsecdir)/$$f'"; \
- rm -f "$(DESTDIR)$(ipsecdir)/$$f"; \
- done
+ @list='$(ipsec_PROGRAMS)'; test -n "$(ipsecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(ipsecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(ipsecdir)" && rm -f $$files
clean-ipsecPROGRAMS:
- @list='$(ipsec_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
+ @list='$(ipsec_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
stroke$(EXEEXT): $(stroke_OBJECTS) $(stroke_DEPENDENCIES)
@rm -f stroke$(EXEEXT)
$(LINK) $(stroke_OBJECTS) $(stroke_LDADD) $(LIBS)
@@ -301,21 +331,21 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
@@ -338,7 +368,7 @@ tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -346,29 +376,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -389,13 +424,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -428,6 +467,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -451,6 +491,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -459,18 +501,28 @@ install-data-am: install-ipsecPROGRAMS
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -493,7 +545,7 @@ ps-am:
uninstall-am: uninstall-ipsecPROGRAMS
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-ipsecPROGRAMS clean-libtool ctags distclean \
@@ -512,6 +564,7 @@ uninstall-am: uninstall-ipsecPROGRAMS
stroke_keywords.c: $(srcdir)/stroke_keywords.txt $(srcdir)/stroke_keywords.h
$(GPERF) -m 10 -D -C -G -t < $(srcdir)/stroke_keywords.txt > $@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/src/stroke/stroke.c b/src/stroke/stroke.c
index c27a8ca3e..955e49535 100644
--- a/src/stroke/stroke.c
+++ b/src/stroke/stroke.c
@@ -55,14 +55,14 @@ static int send_stroke_msg (stroke_msg_t *msg)
{
struct sockaddr_un ctl_addr;
int sock;
- char buffer[64];
+ char buffer[512];
int byte_count;
ctl_addr.sun_family = AF_UNIX;
strcpy(ctl_addr.sun_path, STROKE_SOCKET);
-
+
msg->output_verbosity = 1; /* CONTROL */
-
+
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
{
@@ -76,7 +76,7 @@ static int send_stroke_msg (stroke_msg_t *msg)
close(sock);
return -1;
}
-
+
/* send message */
if (write(sock, msg, msg->length) != msg->length)
{
@@ -84,56 +84,66 @@ static int send_stroke_msg (stroke_msg_t *msg)
close(sock);
return -1;
}
-
+
while ((byte_count = read(sock, buffer, sizeof(buffer)-1)) > 0)
{
buffer[byte_count] = '\0';
printf("%s", buffer);
+
+ /* we prompt if we receive the "Passphrase:" magic keyword */
+ if (byte_count >= 12 &&
+ strcmp(buffer + byte_count - 12, "Passphrase:\n") == 0)
+ {
+ if (fgets(buffer, sizeof(buffer), stdin))
+ {
+ if (write(sock, buffer, strlen(buffer)));
+ }
+ }
}
if (byte_count < 0)
{
fprintf(stderr, "reading from socket failed: %s\n", strerror(errno));
}
-
+
close(sock);
return 0;
}
static int add_connection(char *name,
- char *my_id, char *other_id,
+ char *my_id, char *other_id,
char *my_addr, char *other_addr,
char *my_nets, char *other_nets)
{
stroke_msg_t msg;
-
+
memset(&msg, 0, sizeof(msg));
msg.length = offsetof(stroke_msg_t, buffer);
msg.type = STR_ADD_CONN;
-
+
msg.add_conn.name = push_string(&msg, name);
msg.add_conn.ikev2 = 1;
msg.add_conn.auth_method = 2;
msg.add_conn.mode = 1;
msg.add_conn.mobike = 1;
msg.add_conn.dpd.action = 1;
-
+
msg.add_conn.me.id = push_string(&msg, my_id);
msg.add_conn.me.address = push_string(&msg, my_addr);
msg.add_conn.me.subnets = push_string(&msg, my_nets);
msg.add_conn.me.sendcert = 1;
-
+
msg.add_conn.other.id = push_string(&msg, other_id);
msg.add_conn.other.address = push_string(&msg, other_addr);
msg.add_conn.other.subnets = push_string(&msg, other_nets);
msg.add_conn.other.sendcert = 1;
-
+
return send_stroke_msg(&msg);
}
static int del_connection(char *name)
{
stroke_msg_t msg;
-
+
msg.length = offsetof(stroke_msg_t, buffer);
msg.type = STR_DEL_CONN;
msg.initiate.name = push_string(&msg, name);
@@ -143,7 +153,7 @@ static int del_connection(char *name)
static int initiate_connection(char *name)
{
stroke_msg_t msg;
-
+
msg.length = offsetof(stroke_msg_t, buffer);
msg.type = STR_INITIATE;
msg.initiate.name = push_string(&msg, name);
@@ -153,7 +163,7 @@ static int initiate_connection(char *name)
static int terminate_connection(char *name)
{
stroke_msg_t msg;
-
+
msg.type = STR_TERMINATE;
msg.length = offsetof(stroke_msg_t, buffer);
msg.initiate.name = push_string(&msg, name);
@@ -163,7 +173,7 @@ static int terminate_connection(char *name)
static int terminate_connection_srcip(char *start, char *end)
{
stroke_msg_t msg;
-
+
msg.type = STR_TERMINATE_SRCIP;
msg.length = offsetof(stroke_msg_t, buffer);
msg.terminate_srcip.start = push_string(&msg, start);
@@ -174,7 +184,7 @@ static int terminate_connection_srcip(char *start, char *end)
static int route_connection(char *name)
{
stroke_msg_t msg;
-
+
msg.type = STR_ROUTE;
msg.length = offsetof(stroke_msg_t, buffer);
msg.route.name = push_string(&msg, name);
@@ -184,7 +194,7 @@ static int route_connection(char *name)
static int unroute_connection(char *name)
{
stroke_msg_t msg;
-
+
msg.type = STR_UNROUTE;
msg.length = offsetof(stroke_msg_t, buffer);
msg.unroute.name = push_string(&msg, name);
@@ -194,7 +204,7 @@ static int unroute_connection(char *name)
static int show_status(stroke_keyword_t kw, char *connection)
{
stroke_msg_t msg;
-
+
msg.type = (kw == STROKE_STATUS)? STR_STATUS:STR_STATUS_ALL;
msg.length = offsetof(stroke_msg_t, buffer);
msg.status.name = push_string(&msg, connection);
@@ -219,7 +229,7 @@ static int list_flags[] = {
static int list(stroke_keyword_t kw, int utc)
{
stroke_msg_t msg;
-
+
msg.type = STR_LIST;
msg.length = offsetof(stroke_msg_t, buffer);
msg.list.utc = utc;
@@ -240,7 +250,7 @@ static int reread_flags[] = {
static int reread(stroke_keyword_t kw)
{
stroke_msg_t msg;
-
+
msg.type = STR_REREAD;
msg.length = offsetof(stroke_msg_t, buffer);
msg.reread.flags = reread_flags[kw - STROKE_REREAD_FIRST];
@@ -255,7 +265,7 @@ static int purge_flags[] = {
static int purge(stroke_keyword_t kw)
{
stroke_msg_t msg;
-
+
msg.type = STR_PURGE;
msg.length = offsetof(stroke_msg_t, buffer);
msg.purge.flags = purge_flags[kw - STROKE_PURGE_FIRST];
@@ -266,7 +276,7 @@ static int leases(stroke_keyword_t kw, char *pool, char *address)
{
stroke_msg_t msg;
-
+
msg.type = STR_LEASES;
msg.length = offsetof(stroke_msg_t, buffer);
msg.leases.pool = push_string(&msg, pool);
@@ -277,7 +287,7 @@ static int leases(stroke_keyword_t kw, char *pool, char *address)
static int set_loglevel(char *type, u_int level)
{
stroke_msg_t msg;
-
+
msg.type = STR_LOGLEVEL;
msg.length = offsetof(stroke_msg_t, buffer);
msg.loglevel.type = push_string(&msg, type);
@@ -349,7 +359,7 @@ int main(int argc, char *argv[])
{
exit_usage(NULL);
}
-
+
token = in_word_set(argv[1], strlen(argv[1]));
if (token == NULL)
@@ -365,8 +375,8 @@ int main(int argc, char *argv[])
exit_usage("\"add\" needs more parameters...");
}
res = add_connection(argv[2],
- argv[3], argv[4],
- argv[5], argv[6],
+ argv[3], argv[4],
+ argv[5], argv[6],
argv[7], argv[8]);
break;
case STROKE_DELETE:
@@ -417,7 +427,7 @@ int main(int argc, char *argv[])
{
exit_usage("\"logtype\" needs more parameters...");
}
- res = set_loglevel(argv[2], atoi(argv[3]));
+ res = set_loglevel(argv[2], atoi(argv[3]));
break;
case STROKE_STATUS:
case STROKE_STATUSALL:
diff --git a/src/stroke/stroke_msg.h b/src/stroke/stroke_msg.h
index abf285a86..56a7a158f 100644
--- a/src/stroke/stroke_msg.h
+++ b/src/stroke/stroke_msg.h
@@ -138,7 +138,7 @@ struct stroke_end_t {
char *updown;
char *address;
char *sourceip;
- int sourceip_size;
+ int sourceip_mask;
char *subnets;
int sendcert;
int hostaccess;
@@ -194,7 +194,7 @@ struct stroke_msg_t {
STR_LEASES,
/* more to come */
} type;
-
+
/* verbosity of output returned from charon (-from -1=silent to 4=private)*/
int output_verbosity;
@@ -203,7 +203,7 @@ struct stroke_msg_t {
struct {
char *name;
} initiate, route, unroute, terminate, status, del_conn, del_ca;
-
+
/* data for STR_TERMINATE_SRCIP */
struct {
char *start;
@@ -223,6 +223,7 @@ struct stroke_msg_t {
int mobike;
int force_encap;
int ipcomp;
+ time_t inactivity;
int proxy_mode;
int install_policy;
@@ -237,6 +238,10 @@ struct stroke_msg_t {
time_t ipsec_lifetime;
time_t ike_lifetime;
time_t margin;
+ u_int64_t life_bytes;
+ u_int64_t margin_bytes;
+ u_int64_t life_packets;
+ u_int64_t margin_packets;
unsigned long tries;
unsigned long fuzz;
} rekey;
@@ -268,7 +273,7 @@ struct stroke_msg_t {
char *type;
int level;
} loglevel;
-
+
/* data for STR_CONFIG */
struct {
int cachecrl;