diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-11-01 13:32:07 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-11-01 13:32:07 +0100 |
commit | 5313d2d78ca150515f7f5eb39801c100690b6b29 (patch) | |
tree | c78e420367283bb1b16f14210b12687cdfbd26eb /src/libcharon/plugins/tnc_pdp | |
parent | 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff) | |
download | vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip |
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libcharon/plugins/tnc_pdp')
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/Makefile.am | 7 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/Makefile.in | 251 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/tnc_pdp.c | 446 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/tnc_pdp.h | 4 | ||||
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/tnc_pdp_plugin.c | 15 |
5 files changed, 537 insertions, 186 deletions
diff --git a/src/libcharon/plugins/tnc_pdp/Makefile.am b/src/libcharon/plugins/tnc_pdp/Makefile.am index ce0ddce06..cc7c934d8 100644 --- a/src/libcharon/plugins/tnc_pdp/Makefile.am +++ b/src/libcharon/plugins/tnc_pdp/Makefile.am @@ -2,7 +2,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/libstrongswan \ -I$(top_srcdir)/src/libhydra \ -I$(top_srcdir)/src/libcharon \ - -I$(top_srcdir)/src/libradius + -I$(top_srcdir)/src/libradius \ + -I$(top_srcdir)/src/libtncif \ + -I$(top_srcdir)/src/libtnccs \ + -I$(top_srcdir)/src/libtls \ + -I$(top_srcdir)/src/libpttls AM_CFLAGS = \ -rdynamic @@ -13,6 +17,7 @@ else plugin_LTLIBRARIES = libstrongswan-tnc-pdp.la libstrongswan_tnc_pdp_la_LIBADD = \ $(top_builddir)/src/libradius/libradius.la \ + $(top_builddir)/src/libpttls/libpttls.la \ $(top_builddir)/src/libtls/libtls.la \ $(top_builddir)/src/libtnccs/libtnccs.la endif diff --git a/src/libcharon/plugins/tnc_pdp/Makefile.in b/src/libcharon/plugins/tnc_pdp/Makefile.in index 76607081a..d263bdec4 100644 --- a/src/libcharon/plugins/tnc_pdp/Makefile.in +++ b/src/libcharon/plugins/tnc_pdp/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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,23 +15,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -52,13 +79,15 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/libcharon/plugins/tnc_pdp -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 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/split-package-version.m4 \ $(top_srcdir)/m4/macros/with.m4 \ $(top_srcdir)/m4/macros/enable-disable.m4 \ $(top_srcdir)/m4/macros/add-plugin.m4 \ @@ -100,6 +129,7 @@ am__installdirs = "$(DESTDIR)$(plugindir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES) @MONOLITHIC_FALSE@libstrongswan_tnc_pdp_la_DEPENDENCIES = \ @MONOLITHIC_FALSE@ $(top_builddir)/src/libradius/libradius.la \ +@MONOLITHIC_FALSE@ $(top_builddir)/src/libpttls/libpttls.la \ @MONOLITHIC_FALSE@ $(top_builddir)/src/libtls/libtls.la \ @MONOLITHIC_FALSE@ $(top_builddir)/src/libtnccs/libtnccs.la am_libstrongswan_tnc_pdp_la_OBJECTS = tnc_pdp_plugin.lo tnc_pdp.lo \ @@ -109,6 +139,7 @@ libstrongswan_tnc_pdp_la_OBJECTS = \ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = libstrongswan_tnc_pdp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libstrongswan_tnc_pdp_la_LDFLAGS) \ @@ -116,6 +147,18 @@ libstrongswan_tnc_pdp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @MONOLITHIC_FALSE@am_libstrongswan_tnc_pdp_la_rpath = -rpath \ @MONOLITHIC_FALSE@ $(plugindir) @MONOLITHIC_TRUE@am_libstrongswan_tnc_pdp_la_rpath = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -128,20 +171,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libstrongswan_tnc_pdp_la_SOURCES) DIST_SOURCES = $(libstrongswan_tnc_pdp_la_SOURCES) am__can_run_installinfo = \ @@ -149,6 +188,23 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -225,6 +281,10 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_BUILD = @PACKAGE_VERSION_BUILD@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_REVIEW = @PACKAGE_VERSION_REVIEW@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ @@ -341,6 +401,7 @@ starter_plugins = @starter_plugins@ strongswan_conf = @strongswan_conf@ sysconfdir = @sysconfdir@ systemdsystemunitdir = @systemdsystemunitdir@ +t_plugins = @t_plugins@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ @@ -352,7 +413,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/libstrongswan \ -I$(top_srcdir)/src/libhydra \ -I$(top_srcdir)/src/libcharon \ - -I$(top_srcdir)/src/libradius + -I$(top_srcdir)/src/libradius \ + -I$(top_srcdir)/src/libtncif \ + -I$(top_srcdir)/src/libtnccs \ + -I$(top_srcdir)/src/libtls \ + -I$(top_srcdir)/src/libpttls AM_CFLAGS = \ -rdynamic @@ -361,6 +426,7 @@ AM_CFLAGS = \ @MONOLITHIC_FALSE@plugin_LTLIBRARIES = libstrongswan-tnc-pdp.la @MONOLITHIC_FALSE@libstrongswan_tnc_pdp_la_LIBADD = \ @MONOLITHIC_FALSE@ $(top_builddir)/src/libradius/libradius.la \ +@MONOLITHIC_FALSE@ $(top_builddir)/src/libpttls/libpttls.la \ @MONOLITHIC_FALSE@ $(top_builddir)/src/libtls/libtls.la \ @MONOLITHIC_FALSE@ $(top_builddir)/src/libtnccs/libtnccs.la @@ -406,12 +472,15 @@ $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ @@ -438,12 +507,15 @@ uninstall-pluginLTLIBRARIES: clean-pluginLTLIBRARIES: -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libstrongswan-tnc-pdp.la: $(libstrongswan_tnc_pdp_la_OBJECTS) $(libstrongswan_tnc_pdp_la_DEPENDENCIES) $(EXTRA_libstrongswan_tnc_pdp_la_DEPENDENCIES) $(AM_V_CCLD)$(libstrongswan_tnc_pdp_la_LINK) $(am_libstrongswan_tnc_pdp_la_rpath) $(libstrongswan_tnc_pdp_la_OBJECTS) $(libstrongswan_tnc_pdp_la_LIBADD) $(LIBS) @@ -458,22 +530,25 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnc_pdp_plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -484,26 +559,15 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - 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; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - 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; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -515,15 +579,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - 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; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -532,6 +592,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -676,20 +751,20 @@ uninstall-am: uninstall-pluginLTLIBRARIES .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES clean-pluginLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-pluginLTLIBRARIES install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-pluginLTLIBRARIES + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pluginLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-pluginLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c index a30d89535..31cee9e2b 100644 --- a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c +++ b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Andreas Steffen + * Copyright (C) 2012-2013 Andreas Steffen * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it @@ -22,6 +22,13 @@ #include <radius_message.h> #include <radius_mppe.h> +#include <pt_tls_server.h> + +#include <tnc/tnc.h> + +#include <tncifimv.h> +#include <tncif_names.h> + #include <daemon.h> #include <utils/debug.h> #include <pen/pen.h> @@ -32,6 +39,11 @@ typedef struct private_tnc_pdp_t private_tnc_pdp_t; /** + * Default RADIUS port, when not configured + */ +#define RADIUS_PORT 1812 + +/** * Maximum size of a RADIUS IP packet */ #define MAX_PACKET 4096 @@ -57,14 +69,29 @@ struct private_tnc_pdp_t { eap_type_t type; /** - * IPv4 RADIUS socket + * PT-TLS port of the server + */ + u_int16_t pt_tls_port; + + /** + * PT-TLS IPv4 socket */ - int ipv4; + int pt_tls_ipv4; /** - * IPv6 RADIUS socket + * PT-TLS IPv6 socket */ - int ipv6; + int pt_tls_ipv6; + + /** + * RADIUS IPv4 socket + */ + int radius_ipv4; + + /** + * RADIUS IPv6 socket + */ + int radius_ipv6; /** * RADIUS shared secret @@ -90,13 +117,13 @@ struct private_tnc_pdp_t { * List of registered TNC-PDP connections */ tnc_pdp_connections_t *connections; -}; +}; /** - * Open IPv4 or IPv6 UDP RADIUS socket + * Open IPv4 or IPv6 UDP socket */ -static int open_socket(int family, u_int16_t port) +static int open_udp_socket(int family, u_int16_t port) { int on = TRUE; struct sockaddr_storage addr; @@ -135,20 +162,115 @@ static int open_socket(int family, u_int16_t port) skt = socket(family, SOCK_DGRAM, IPPROTO_UDP); if (skt < 0) { - DBG1(DBG_CFG, "opening RADIUS socket failed: %s", strerror(errno)); + DBG1(DBG_CFG, "opening UDP socket failed: %s", strerror(errno)); return 0; } if (setsockopt(skt, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0) { - DBG1(DBG_CFG, "unable to set SO_REUSEADDR on socket: %s", strerror(errno)); + DBG1(DBG_CFG, "unable to set SO_REUSEADDR on socket: %s", + strerror(errno)); close(skt); return 0; } + if (family == AF_INET6) + { + if (setsockopt(skt, IPPROTO_IPV6, IPV6_V6ONLY, + (void *)&on, sizeof(on)) < 0) + { + DBG1(DBG_CFG, "unable to set IPV6_V6ONLY on socket: %s", + strerror(errno)); + close(skt); + return 0; + } + } /* bind the socket */ if (bind(skt, (struct sockaddr *)&addr, addrlen) < 0) { - DBG1(DBG_CFG, "unable to bind RADIUS socket: %s", strerror(errno)); + DBG1(DBG_CFG, "unable to bind UDP socket: %s", strerror(errno)); + close(skt); + return 0; + } + + return skt; +} + +/** + * Open IPv4 or IPv6 TCP socket + */ +static int open_tcp_socket(int family, u_int16_t port) +{ + int on = TRUE; + struct sockaddr_storage addr; + socklen_t addrlen; + int skt; + + memset(&addr, 0, sizeof(addr)); + addr.ss_family = family; + + /* precalculate constants depending on address family */ + switch (family) + { + case AF_INET: + { + struct sockaddr_in *sin = (struct sockaddr_in *)&addr; + + htoun32(&sin->sin_addr.s_addr, INADDR_ANY); + htoun16(&sin->sin_port, port); + addrlen = sizeof(struct sockaddr_in); + break; + } + case AF_INET6: + { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&addr; + + memcpy(&sin6->sin6_addr, &in6addr_any, sizeof(in6addr_any)); + htoun16(&sin6->sin6_port, port); + addrlen = sizeof(struct sockaddr_in6); + break; + } + default: + return 0; + } + + /* open the socket */ + skt = socket(family, SOCK_STREAM, IPPROTO_TCP); + if (skt < 0) + { + DBG1(DBG_CFG, "opening TCP socket failed: %s", strerror(errno)); + return 0; + } + if (setsockopt(skt, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0) + { + DBG1(DBG_CFG, "unable to set SO_REUSEADDR on socket: %s", + strerror(errno)); + close(skt); + return 0; + } + if (family == AF_INET6) + { + if (setsockopt(skt, IPPROTO_IPV6, IPV6_V6ONLY, + (void *)&on, sizeof(on)) < 0) + { + DBG1(DBG_CFG, "unable to set IPV6_V6ONLY on socket: %s", + strerror(errno)); + close(skt); + return 0; + } + } + + /* bind the socket */ + if (bind(skt, (struct sockaddr *)&addr, addrlen) < 0) + { + DBG1(DBG_CFG, "unable to bind TCP socket: %s", strerror(errno)); + close(skt); + return 0; + } + + /* start listening on socket */ + if (listen(skt, 5) == -1) + { + DBG1(DBG_TNC, "listen on TCP socket failed: %s", strerror(errno)); close(skt); return 0; } @@ -165,7 +287,8 @@ static void send_message(private_tnc_pdp_t *this, radius_message_t *message, int fd; chunk_t data; - fd = (client->get_family(client) == AF_INET) ? this->ipv4 : this->ipv6; + fd = (client->get_family(client) == AF_INET) ? + this->radius_ipv4 : this->radius_ipv6; data = message->get_encoding(message); DBG2(DBG_CFG, "sending RADIUS packet to %#H", client); @@ -448,9 +571,95 @@ end: } /** + * Callback function to get recommendation from TNCCS connection + */ +static bool get_recommendation(TNC_IMV_Action_Recommendation rec, + TNC_IMV_Evaluation_Result eval) +{ + DBG1(DBG_TNC, "final recommendation is '%N' and evaluation is '%N'", + TNC_IMV_Action_Recommendation_names, rec, + TNC_IMV_Evaluation_Result_names, eval); + + return TRUE; +} + +/** + * Get more data on a PT-TLS connection + */ +static bool pt_tls_receive_more(pt_tls_server_t *this, int fd, + watcher_event_t event) +{ + switch (this->handle(this)) + { + case NEED_MORE: + return TRUE; + case FAILED: + case SUCCESS: + default: + DBG1(DBG_TNC, "PT-TLS connection terminates"); + this->destroy(this); + close(fd); + return FALSE; + } +} + +/** + * Accept TCP connection received on the PT-TLS listening socket + */ +static bool pt_tls_receive(private_tnc_pdp_t *this, int fd, watcher_event_t event) +{ + int pt_tls_fd; + struct sockaddr_storage addr; + socklen_t addrlen = sizeof(addr); + identification_t *peer; + host_t *host; + pt_tls_server_t *pt_tls; + tnccs_t *tnccs; + pt_tls_auth_t auth = PT_TLS_AUTH_TLS_OR_SASL; + + pt_tls_fd = accept(fd, (sockaddr_t*)&addr, &addrlen); + if (pt_tls_fd == -1) + { + DBG1(DBG_TNC, "accepting PT-TLS stream failed: %s", strerror(errno)); + return FALSE; + } + host = host_create_from_sockaddr((sockaddr_t*)&addr); + DBG1(DBG_TNC, "accepting PT-TLS stream from %H", host); + host->destroy(host); + + /* At this moment the peer identity is not known yet */ + peer = identification_create_from_encoding(ID_ANY, chunk_empty), + + tnccs = tnc->tnccs->create_instance(tnc->tnccs, TNCCS_2_0, TRUE, + this->server, peer, TNC_IFT_TLS_2_0, + (tnccs_cb_t)get_recommendation); + peer->destroy(peer); + + if (!tnccs) + { + DBG1(DBG_TNC, "could not create TNCCS 2.0 connection instance"); + close(pt_tls_fd); + return FALSE; + } + + pt_tls = pt_tls_server_create(this->server, pt_tls_fd, auth, tnccs); + if (!pt_tls) + { + DBG1(DBG_TNC, "could not create PT-TLS connection instance"); + close(pt_tls_fd); + return FALSE; + } + + lib->watcher->add(lib->watcher, pt_tls_fd, WATCHER_READ, + (watcher_cb_t)pt_tls_receive_more, pt_tls); + + return TRUE; +} + +/** * Process packets received on the RADIUS socket */ -static bool receive(private_tnc_pdp_t *this, int fd, watcher_event_t event) +static bool radius_receive(private_tnc_pdp_t *this, int fd, watcher_event_t event) { radius_message_t *request; char buffer[MAX_PACKET]; @@ -510,15 +719,25 @@ static bool receive(private_tnc_pdp_t *this, int fd, watcher_event_t event) METHOD(tnc_pdp_t, destroy, void, private_tnc_pdp_t *this) { - if (this->ipv4) + if (this->pt_tls_ipv4) + { + lib->watcher->remove(lib->watcher, this->pt_tls_ipv4); + close(this->pt_tls_ipv4); + } + if (this->pt_tls_ipv6) { - lib->watcher->remove(lib->watcher, this->ipv4); - close(this->ipv4); + lib->watcher->remove(lib->watcher, this->pt_tls_ipv6); + close(this->pt_tls_ipv6); } - if (this->ipv6) + if (this->radius_ipv4) { - lib->watcher->remove(lib->watcher, this->ipv6); - close(this->ipv6); + lib->watcher->remove(lib->watcher, this->radius_ipv4); + close(this->radius_ipv4); + } + if (this->radius_ipv6) + { + lib->watcher->remove(lib->watcher, this->radius_ipv6); + close(this->radius_ipv6); } DESTROY_IF(this->server); DESTROY_IF(this->signer); @@ -531,90 +750,149 @@ METHOD(tnc_pdp_t, destroy, void, /* * see header file */ -tnc_pdp_t *tnc_pdp_create(u_int16_t port) +tnc_pdp_t *tnc_pdp_create(void) { private_tnc_pdp_t *this; char *secret, *server, *eap_type_str; + int radius_port, pt_tls_port; + bool radius_enable, pt_tls_enable; - INIT(this, - .public = { - .destroy = _destroy, - }, - .ipv4 = open_socket(AF_INET, port), - .ipv6 = open_socket(AF_INET6, port), - .hasher = lib->crypto->create_hasher(lib->crypto, HASH_MD5), - .signer = lib->crypto->create_signer(lib->crypto, AUTH_HMAC_MD5_128), - .ng = lib->crypto->create_nonce_gen(lib->crypto), - .connections = tnc_pdp_connections_create(), - ); + server = lib->settings->get_str(lib->settings, + "%s.plugins.tnc-pdp.server", NULL, charon->name); + pt_tls_enable = lib->settings->get_bool(lib->settings, + "%s.plugins.tnc-pdp.pt_tls.enable", TRUE, charon->name); + pt_tls_port = lib->settings->get_int(lib->settings, + "%s.plugins.tnc-pdp.pt_tls.port", PT_TLS_PORT, charon->name); + radius_enable = lib->settings->get_bool(lib->settings, + "%s.plugins.tnc-pdp.radius.enable", TRUE, charon->name); + radius_port = lib->settings->get_int(lib->settings, + "%s.plugins.tnc-pdp.radius.port", RADIUS_PORT, charon->name); + secret = lib->settings->get_str(lib->settings, + "%s.plugins.tnc-pdp.radius.secret", NULL, charon->name); + eap_type_str = lib->settings->get_str(lib->settings, + "%s.plugins.tnc-pdp.radius.method", "ttls", charon->name); - if (!this->hasher || !this->signer || !this->ng) - { - DBG1(DBG_CFG, "RADIUS initialization failed, HMAC/MD5/NG required"); - destroy(this); - return NULL; - } - if (!this->ipv4 && !this->ipv6) + if (!pt_tls_enable && !radius_enable) { - DBG1(DBG_NET, "could not create any RADIUS sockets"); - destroy(this); + DBG1(DBG_CFG, " neither PT-TLS and RADIUS protocols enabled, PDP disabled"); return NULL; } - if (this->ipv4) - { - lib->watcher->add(lib->watcher, this->ipv4, WATCHER_READ, - (watcher_cb_t)receive, this); - } - else - { - DBG1(DBG_NET, "could not open IPv4 RADIUS socket, IPv4 disabled"); - } - if (this->ipv6) - { - lib->watcher->add(lib->watcher, this->ipv6, WATCHER_READ, - (watcher_cb_t)receive, this); - } - else - { - DBG1(DBG_NET, "could not open IPv6 RADIUS socket, IPv6 disabled"); - } - - server = lib->settings->get_str(lib->settings, - "%s.plugins.tnc-pdp.server", NULL, charon->name); if (!server) { DBG1(DBG_CFG, "missing PDP server name, PDP disabled"); - destroy(this); return NULL; } - this->server = identification_create_from_string(server); - secret = lib->settings->get_str(lib->settings, - "%s.plugins.tnc-pdp.secret", NULL, charon->name); - if (!secret) - { - DBG1(DBG_CFG, "missing RADIUS secret, PDP disabled"); - destroy(this); - return NULL; - } - this->secret = chunk_create(secret, strlen(secret)); - if (!this->signer->set_key(this->signer, this->secret)) + INIT(this, + .public = { + .destroy = _destroy, + }, + .server = identification_create_from_string(server), + .connections = tnc_pdp_connections_create(), + ); + + /* Create IPv4 and IPv6 PT-TLS listening sockets */ + if (pt_tls_enable) { - DBG1(DBG_CFG, "could not set signer key"); - destroy(this); - return NULL; + this->pt_tls_ipv4 = open_tcp_socket(AF_INET, pt_tls_port); + this->pt_tls_ipv6 = open_tcp_socket(AF_INET6, pt_tls_port); + + if (!this->pt_tls_ipv4 && !this->pt_tls_ipv6) + { + DBG1(DBG_NET, "could not create any PT-TLS sockets"); + destroy(this); + return NULL; + } + this->pt_tls_port = pt_tls_port; + + if (this->pt_tls_ipv4) + { + lib->watcher->add(lib->watcher, this->pt_tls_ipv4, WATCHER_READ, + (watcher_cb_t)pt_tls_receive, this); + } + else + { + DBG1(DBG_NET, "could not open IPv4 PT-TLS socket, IPv4 disabled"); + } + + if (this->pt_tls_ipv6) + { + lib->watcher->add(lib->watcher, this->pt_tls_ipv6, WATCHER_READ, + (watcher_cb_t)pt_tls_receive, this); + } + else + { + DBG1(DBG_NET, "could not open IPv6 PT-TLS socket, IPv6 disabled"); + } + + /* register PT-TLS service */ + lib->set(lib, "pt-tls-server", this->server); + lib->set(lib, "pt-tls-port", &this->pt_tls_port); } - eap_type_str = lib->settings->get_str(lib->settings, - "%s.plugins.tnc-pdp.method", "ttls", charon->name); - this->type = eap_type_from_string(eap_type_str); - if (this->type == 0) + /* Create IPv4 and IPv6 RADIUS listening sockets */ + if (radius_enable) { - DBG1(DBG_CFG, "unrecognized eap method \"%s\"", eap_type_str); - destroy(this); - return NULL; + if (!secret) + { + DBG1(DBG_CFG, "missing RADIUS secret, PDP disabled"); + destroy(this); + return NULL; + } + + this->radius_ipv4 = open_udp_socket(AF_INET, radius_port); + this->radius_ipv6 = open_udp_socket(AF_INET6, radius_port); + this->secret = chunk_from_str(secret); + this->type = eap_type_from_string(eap_type_str); + this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_MD5); + this->signer = lib->crypto->create_signer(lib->crypto, AUTH_HMAC_MD5_128); + this->ng = lib->crypto->create_nonce_gen(lib->crypto); + + if (!this->hasher || !this->signer || !this->ng) + { + DBG1(DBG_CFG, "RADIUS initialization failed, HMAC/MD5/NG required"); + destroy(this); + return NULL; + } + if (!this->radius_ipv4 && !this->radius_ipv6) + { + DBG1(DBG_NET, "could not create any RADIUS sockets"); + destroy(this); + return NULL; + } + if (this->radius_ipv4) + { + lib->watcher->add(lib->watcher, this->radius_ipv4, WATCHER_READ, + (watcher_cb_t)radius_receive, this); + } + else + { + DBG1(DBG_NET, "could not open IPv4 RADIUS socket, IPv4 disabled"); + } + if (this->radius_ipv6) + { + lib->watcher->add(lib->watcher, this->radius_ipv6, WATCHER_READ, + (watcher_cb_t)radius_receive, this); + } + else + { + DBG1(DBG_NET, "could not open IPv6 RADIUS socket, IPv6 disabled"); + } + + if (!this->signer->set_key(this->signer, this->secret)) + { + DBG1(DBG_CFG, "could not set signer key"); + destroy(this); + return NULL; + } + if (this->type == 0) + { + DBG1(DBG_CFG, "unrecognized eap method \"%s\"", eap_type_str); + destroy(this); + return NULL; + } + DBG1(DBG_IKE, "eap method %N selected", eap_type_names, this->type); } - DBG1(DBG_IKE, "eap method %N selected", eap_type_names, this->type); return &this->public; } diff --git a/src/libcharon/plugins/tnc_pdp/tnc_pdp.h b/src/libcharon/plugins/tnc_pdp/tnc_pdp.h index 06291220f..25a041944 100644 --- a/src/libcharon/plugins/tnc_pdp/tnc_pdp.h +++ b/src/libcharon/plugins/tnc_pdp/tnc_pdp.h @@ -38,9 +38,7 @@ struct tnc_pdp_t { /** * Create a TNC PDP instance - * - * @param port RADIUS port of TNC PDP */ -tnc_pdp_t* tnc_pdp_create(u_int16_t port); +tnc_pdp_t* tnc_pdp_create(void); #endif /** TNC_PDP_PLUGIN_H_ @}*/ diff --git a/src/libcharon/plugins/tnc_pdp/tnc_pdp_plugin.c b/src/libcharon/plugins/tnc_pdp/tnc_pdp_plugin.c index e35ba9ead..5586b568b 100644 --- a/src/libcharon/plugins/tnc_pdp/tnc_pdp_plugin.c +++ b/src/libcharon/plugins/tnc_pdp/tnc_pdp_plugin.c @@ -21,11 +21,6 @@ typedef struct private_tnc_pdp_plugin_t private_tnc_pdp_plugin_t; /** - * Default RADIUS port, when not configured - */ -#define RADIUS_PORT 1812 - -/** * private data of tnc_pdp plugin */ struct private_tnc_pdp_plugin_t { @@ -56,11 +51,11 @@ static bool plugin_cb(private_tnc_pdp_plugin_t *this, { if (reg) { - int port; - - port = lib->settings->get_int(lib->settings, - "%s.plugins.tnc-pdp.port", RADIUS_PORT, charon->name); - this->pdp = tnc_pdp_create(port); + this->pdp = tnc_pdp_create(); + if (!this->pdp) + { + return FALSE; + } } else { |