summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorroot <root@build-vm.(none)>2010-06-14 15:51:25 -0700
committerroot <root@build-vm.(none)>2010-06-14 15:51:25 -0700
commitc4414d9a8b31bedfb7471cd2365aaf5ea5cf55d5 (patch)
tree86ee5befd8195f56dcd91f9fd4e06368bf507a11 /extensions
downloadconntrack-tools-c4414d9a8b31bedfb7471cd2365aaf5ea5cf55d5.tar.gz
conntrack-tools-c4414d9a8b31bedfb7471cd2365aaf5ea5cf55d5.zip
debian conntrack 0.9.14-2
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Makefile.am17
-rw-r--r--extensions/Makefile.in562
-rw-r--r--extensions/libct_proto_dccp.c246
-rw-r--r--extensions/libct_proto_gre.c192
-rw-r--r--extensions/libct_proto_icmp.c122
-rw-r--r--extensions/libct_proto_icmpv6.c124
-rw-r--r--extensions/libct_proto_sctp.c246
-rw-r--r--extensions/libct_proto_tcp.c234
-rw-r--r--extensions/libct_proto_udp.c192
-rw-r--r--extensions/libct_proto_udplite.c197
-rw-r--r--extensions/libct_proto_unknown.c34
11 files changed, 2166 insertions, 0 deletions
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
new file mode 100644
index 0000000..c36c3a1
--- /dev/null
+++ b/extensions/Makefile.am
@@ -0,0 +1,17 @@
+include $(top_srcdir)/Make_global.am
+
+noinst_LTLIBRARIES = libct_proto_tcp.la libct_proto_udp.la \
+ libct_proto_icmp.la libct_proto_icmpv6.la \
+ libct_proto_unknown.la libct_proto_udplite.la \
+ libct_proto_sctp.la libct_proto_dccp.la \
+ libct_proto_gre.la
+
+libct_proto_tcp_la_SOURCES = libct_proto_tcp.c
+libct_proto_udp_la_SOURCES = libct_proto_udp.c
+libct_proto_udplite_la_SOURCES = libct_proto_udplite.c
+libct_proto_icmp_la_SOURCES = libct_proto_icmp.c
+libct_proto_icmpv6_la_SOURCES = libct_proto_icmpv6.c
+libct_proto_unknown_la_SOURCES = libct_proto_unknown.c
+libct_proto_sctp_la_SOURCES = libct_proto_sctp.c
+libct_proto_dccp_la_SOURCES = libct_proto_dccp.c
+libct_proto_gre_la_SOURCES = libct_proto_gre.c
diff --git a/extensions/Makefile.in b/extensions/Makefile.in
new file mode 100644
index 0000000..ea3b62f
--- /dev/null
+++ b/extensions/Makefile.in
@@ -0,0 +1,562 @@
+# 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, 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@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
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/Make_global.am
+subdir = extensions
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libct_proto_dccp_la_LIBADD =
+am_libct_proto_dccp_la_OBJECTS = libct_proto_dccp.lo
+libct_proto_dccp_la_OBJECTS = $(am_libct_proto_dccp_la_OBJECTS)
+libct_proto_gre_la_LIBADD =
+am_libct_proto_gre_la_OBJECTS = libct_proto_gre.lo
+libct_proto_gre_la_OBJECTS = $(am_libct_proto_gre_la_OBJECTS)
+libct_proto_icmp_la_LIBADD =
+am_libct_proto_icmp_la_OBJECTS = libct_proto_icmp.lo
+libct_proto_icmp_la_OBJECTS = $(am_libct_proto_icmp_la_OBJECTS)
+libct_proto_icmpv6_la_LIBADD =
+am_libct_proto_icmpv6_la_OBJECTS = libct_proto_icmpv6.lo
+libct_proto_icmpv6_la_OBJECTS = $(am_libct_proto_icmpv6_la_OBJECTS)
+libct_proto_sctp_la_LIBADD =
+am_libct_proto_sctp_la_OBJECTS = libct_proto_sctp.lo
+libct_proto_sctp_la_OBJECTS = $(am_libct_proto_sctp_la_OBJECTS)
+libct_proto_tcp_la_LIBADD =
+am_libct_proto_tcp_la_OBJECTS = libct_proto_tcp.lo
+libct_proto_tcp_la_OBJECTS = $(am_libct_proto_tcp_la_OBJECTS)
+libct_proto_udp_la_LIBADD =
+am_libct_proto_udp_la_OBJECTS = libct_proto_udp.lo
+libct_proto_udp_la_OBJECTS = $(am_libct_proto_udp_la_OBJECTS)
+libct_proto_udplite_la_LIBADD =
+am_libct_proto_udplite_la_OBJECTS = libct_proto_udplite.lo
+libct_proto_udplite_la_OBJECTS = $(am_libct_proto_udplite_la_OBJECTS)
+libct_proto_unknown_la_LIBADD =
+am_libct_proto_unknown_la_OBJECTS = libct_proto_unknown.lo
+libct_proto_unknown_la_OBJECTS = $(am_libct_proto_unknown_la_OBJECTS)
+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) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libct_proto_dccp_la_SOURCES) $(libct_proto_gre_la_SOURCES) \
+ $(libct_proto_icmp_la_SOURCES) \
+ $(libct_proto_icmpv6_la_SOURCES) \
+ $(libct_proto_sctp_la_SOURCES) $(libct_proto_tcp_la_SOURCES) \
+ $(libct_proto_udp_la_SOURCES) \
+ $(libct_proto_udplite_la_SOURCES) \
+ $(libct_proto_unknown_la_SOURCES)
+DIST_SOURCES = $(libct_proto_dccp_la_SOURCES) \
+ $(libct_proto_gre_la_SOURCES) $(libct_proto_icmp_la_SOURCES) \
+ $(libct_proto_icmpv6_la_SOURCES) \
+ $(libct_proto_sctp_la_SOURCES) $(libct_proto_tcp_la_SOURCES) \
+ $(libct_proto_udp_la_SOURCES) \
+ $(libct_proto_udplite_la_SOURCES) \
+ $(libct_proto_unknown_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBNETFILTER_CONNTRACK_CFLAGS = @LIBNETFILTER_CONNTRACK_CFLAGS@
+LIBNETFILTER_CONNTRACK_LIBS = @LIBNETFILTER_CONNTRACK_LIBS@
+LIBNFNETLINK_CFLAGS = @LIBNFNETLINK_CFLAGS@
+LIBNFNETLINK_LIBS = @LIBNFNETLINK_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+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@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XLEX = @XLEX@
+XYACC = @XYACC@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS = -std=gnu99 -W -Wall \
+ -Wmissing-prototypes -Wwrite-strings -Wcast-qual -Wfloat-equal -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wstrict-prototypes -Wundef \
+ -Wno-unused-parameter
+
+noinst_LTLIBRARIES = libct_proto_tcp.la libct_proto_udp.la \
+ libct_proto_icmp.la libct_proto_icmpv6.la \
+ libct_proto_unknown.la libct_proto_udplite.la \
+ libct_proto_sctp.la libct_proto_dccp.la \
+ libct_proto_gre.la
+
+libct_proto_tcp_la_SOURCES = libct_proto_tcp.c
+libct_proto_udp_la_SOURCES = libct_proto_udp.c
+libct_proto_udplite_la_SOURCES = libct_proto_udplite.c
+libct_proto_icmp_la_SOURCES = libct_proto_icmp.c
+libct_proto_icmpv6_la_SOURCES = libct_proto_icmpv6.c
+libct_proto_unknown_la_SOURCES = libct_proto_unknown.c
+libct_proto_sctp_la_SOURCES = libct_proto_sctp.c
+libct_proto_dccp_la_SOURCES = libct_proto_dccp.c
+libct_proto_gre_la_SOURCES = libct_proto_gre.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Make_global.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu extensions/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu extensions/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(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):
+
+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
+libct_proto_dccp.la: $(libct_proto_dccp_la_OBJECTS) $(libct_proto_dccp_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_dccp_la_OBJECTS) $(libct_proto_dccp_la_LIBADD) $(LIBS)
+libct_proto_gre.la: $(libct_proto_gre_la_OBJECTS) $(libct_proto_gre_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_gre_la_OBJECTS) $(libct_proto_gre_la_LIBADD) $(LIBS)
+libct_proto_icmp.la: $(libct_proto_icmp_la_OBJECTS) $(libct_proto_icmp_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_icmp_la_OBJECTS) $(libct_proto_icmp_la_LIBADD) $(LIBS)
+libct_proto_icmpv6.la: $(libct_proto_icmpv6_la_OBJECTS) $(libct_proto_icmpv6_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_icmpv6_la_OBJECTS) $(libct_proto_icmpv6_la_LIBADD) $(LIBS)
+libct_proto_sctp.la: $(libct_proto_sctp_la_OBJECTS) $(libct_proto_sctp_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_sctp_la_OBJECTS) $(libct_proto_sctp_la_LIBADD) $(LIBS)
+libct_proto_tcp.la: $(libct_proto_tcp_la_OBJECTS) $(libct_proto_tcp_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_tcp_la_OBJECTS) $(libct_proto_tcp_la_LIBADD) $(LIBS)
+libct_proto_udp.la: $(libct_proto_udp_la_OBJECTS) $(libct_proto_udp_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_udp_la_OBJECTS) $(libct_proto_udp_la_LIBADD) $(LIBS)
+libct_proto_udplite.la: $(libct_proto_udplite_la_OBJECTS) $(libct_proto_udplite_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_udplite_la_OBJECTS) $(libct_proto_udplite_la_LIBADD) $(LIBS)
+libct_proto_unknown.la: $(libct_proto_unknown_la_OBJECTS) $(libct_proto_unknown_la_DEPENDENCIES)
+ $(LINK) $(libct_proto_unknown_la_OBJECTS) $(libct_proto_unknown_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_dccp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_gre.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_icmp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_icmpv6.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_sctp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_tcp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_udp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_udplite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libct_proto_unknown.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@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@ $(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@ $(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 $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+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)
+ 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; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ 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)
+ 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)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ 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 -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+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"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+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
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES 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-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
+
+
+# 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/extensions/libct_proto_dccp.c b/extensions/libct_proto_dccp.c
new file mode 100644
index 0000000..586c4cc
--- /dev/null
+++ b/extensions/libct_proto_dccp.c
@@ -0,0 +1,246 @@
+/*
+ * (C) 2009 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h> /* For htons */
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+#include <libnetfilter_conntrack/libnetfilter_conntrack_dccp.h>
+
+#include "conntrack.h"
+
+#ifndef IPPROTO_DCCP
+#define IPPROTO_DCCP 33
+#endif
+
+enum {
+ CT_DCCP_ORIG_SPORT = (1 << 0),
+ CT_DCCP_ORIG_DPORT = (1 << 1),
+ CT_DCCP_REPL_SPORT = (1 << 2),
+ CT_DCCP_REPL_DPORT = (1 << 3),
+ CT_DCCP_MASK_SPORT = (1 << 4),
+ CT_DCCP_MASK_DPORT = (1 << 5),
+ CT_DCCP_STATE = (1 << 6),
+ CT_DCCP_EXPTUPLE_SPORT = (1 << 7),
+ CT_DCCP_EXPTUPLE_DPORT = (1 << 8),
+ CT_DCCP_ROLE = (1 << 9),
+};
+
+#define DCCP_OPT_MAX 13
+static struct option opts[DCCP_OPT_MAX] = {
+ { .name = "orig-port-src", .has_arg = 1, .val = 1 },
+ { .name = "orig-port-dst", .has_arg = 1, .val = 2 },
+ { .name = "reply-port-src", .has_arg = 1, .val = 3 },
+ { .name = "reply-port-dst", .has_arg = 1, .val = 4 },
+ { .name = "mask-port-src", .has_arg = 1, .val = 5 },
+ { .name = "mask-port-dst", .has_arg = 1, .val = 6 },
+ { .name = "state", .has_arg = 1, .val = 7 },
+ { .name = "tuple-port-src", .has_arg = 1, .val = 8 },
+ { .name = "tuple-port-dst", .has_arg = 1, .val = 9 },
+ { .name = "sport", .has_arg = 1, .val = 1 }, /* alias */
+ { .name = "dport", .has_arg = 1, .val = 2 }, /* alias */
+ { .name = "role", .has_arg = 1, .val = 10 },
+ { 0, 0, 0, 0},
+};
+
+static const char *dccp_optflags[DCCP_OPT_MAX] = {
+ [0] = "sport",
+ [1] = "dport",
+ [2] = "reply-port-src",
+ [3] = "reply-port-dst",
+ [4] = "mask-port-src",
+ [5] = "mask-port-dst",
+ [6] = "state",
+ [7] = "tuple-port-src",
+ [8] = "tuple-port-dst",
+ [9] = "role"
+};
+
+static char dccp_commands_v_options[NUMBER_OF_CMD][DCCP_OPT_MAX] =
+/* Well, it's better than "Re: Sevilla vs Betis" */
+{
+ /* 1 2 3 4 5 6 7 8 9 10*/
+/*CT_LIST*/ {2,2,2,2,0,0,2,0,0,0},
+/*CT_CREATE*/ {3,3,3,3,0,0,1,0,0,1},
+/*CT_UPDATE*/ {2,2,2,2,0,0,2,0,0,0},
+/*CT_DELETE*/ {2,2,2,2,0,0,2,0,0,0},
+/*CT_GET*/ {3,3,3,3,0,0,2,0,0,0},
+/*CT_FLUSH*/ {0,0,0,0,0,0,0,0,0,0},
+/*CT_EVENT*/ {2,2,2,2,0,0,2,0,0,0},
+/*CT_VERSION*/ {0,0,0,0,0,0,0,0,0,0},
+/*CT_HELP*/ {0,0,0,0,0,0,0,0,0,0},
+/*EXP_LIST*/ {0,0,0,0,0,0,0,0,0,0},
+/*EXP_CREATE*/ {1,1,1,1,1,1,0,1,1,1},
+/*EXP_DELETE*/ {1,1,1,1,0,0,0,0,0,0},
+/*EXP_GET*/ {1,1,1,1,0,0,0,0,0,0},
+/*EXP_FLUSH*/ {0,0,0,0,0,0,0,0,0,0},
+/*EXP_EVENT*/ {0,0,0,0,0,0,0,0,0,0},
+};
+
+static const char *dccp_states[DCCP_CONNTRACK_MAX] = {
+ [DCCP_CONNTRACK_NONE] = "NONE",
+ [DCCP_CONNTRACK_REQUEST] = "REQUEST",
+ [DCCP_CONNTRACK_RESPOND] = "RESPOND",
+ [DCCP_CONNTRACK_PARTOPEN] = "PARTOPEN",
+ [DCCP_CONNTRACK_OPEN] = "OPEN",
+ [DCCP_CONNTRACK_CLOSEREQ] = "CLOSEREQ",
+ [DCCP_CONNTRACK_CLOSING] = "CLOSING",
+ [DCCP_CONNTRACK_TIMEWAIT] = "TIMEWAIT",
+ [DCCP_CONNTRACK_IGNORE] = "IGNORE",
+ [DCCP_CONNTRACK_INVALID] = "INVALID",
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --orig-port-src\t\toriginal source port\n");
+ fprintf(stdout, " --orig-port-dst\t\toriginal destination port\n");
+ fprintf(stdout, " --reply-port-src\t\treply source port\n");
+ fprintf(stdout, " --reply-port-dst\t\treply destination port\n");
+ fprintf(stdout, " --mask-port-src\t\tmask source port\n");
+ fprintf(stdout, " --mask-port-dst\t\tmask destination port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple src port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple dst port\n");
+ fprintf(stdout, " --state\t\t\tDCCP state, fe. RESPOND\n");
+}
+
+static int parse_options(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ int i;
+ u_int16_t port;
+
+ switch(c) {
+ case 1:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_DCCP);
+ *flags |= CT_DCCP_ORIG_SPORT;
+ break;
+ case 2:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_DCCP);
+ *flags |= CT_DCCP_ORIG_DPORT;
+ break;
+ case 3:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_DCCP);
+ *flags |= CT_DCCP_REPL_SPORT;
+ break;
+ case 4:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_DCCP);
+ *flags |= CT_DCCP_REPL_DPORT;
+ break;
+ case 5:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_DCCP);
+ *flags |= CT_DCCP_MASK_SPORT;
+ break;
+ case 6:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_DCCP);
+ *flags |= CT_DCCP_MASK_DPORT;
+ break;
+ case 7:
+ for (i=0; i<DCCP_CONNTRACK_MAX; i++) {
+ if (strcmp(optarg, dccp_states[i]) == 0) {
+ nfct_set_attr_u8(ct, ATTR_DCCP_STATE, i);
+ break;
+ }
+ }
+ if (i == DCCP_CONNTRACK_MAX)
+ exit_error(PARAMETER_PROBLEM,
+ "Unknown DCCP state `%s'", optarg);
+ *flags |= CT_DCCP_STATE;
+ break;
+ case 8:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ *flags |= CT_DCCP_EXPTUPLE_SPORT;
+ break;
+ case 9:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ *flags |= CT_DCCP_EXPTUPLE_DPORT;
+ break;
+ case 10:
+ if (strncasecmp(optarg, "client", strlen(optarg)) == 0) {
+ nfct_set_attr_u8(ct, ATTR_DCCP_ROLE,
+ DCCP_CONNTRACK_ROLE_CLIENT);
+ } else if (strncasecmp(optarg, "server", strlen(optarg)) == 0) {
+ nfct_set_attr_u8(ct, ATTR_DCCP_ROLE,
+ DCCP_CONNTRACK_ROLE_SERVER);
+ } else {
+ exit_error(PARAMETER_PROBLEM,
+ "Unknown DCCP role `%s'", optarg);
+ }
+ *flags |= CT_DCCP_ROLE;
+ break;
+ }
+ return 1;
+}
+
+#define DCCP_VALID_FLAGS_MAX 2
+static unsigned int dccp_valid_flags[DCCP_VALID_FLAGS_MAX] = {
+ CT_DCCP_ORIG_SPORT | CT_DCCP_ORIG_DPORT,
+ CT_DCCP_REPL_SPORT | CT_DCCP_REPL_DPORT
+};
+
+static void
+final_check(unsigned int flags, unsigned int cmd, struct nf_conntrack *ct)
+{
+ int ret, partial;
+
+ ret = generic_opt_check(flags, DCCP_OPT_MAX,
+ dccp_commands_v_options[cmd], dccp_optflags,
+ dccp_valid_flags, DCCP_VALID_FLAGS_MAX,
+ &partial);
+ if (!ret) {
+ switch(partial) {
+ case -1:
+ case 0:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--sport' and "
+ "`--dport'");
+ break;
+ case 1:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--reply-port-src' and "
+ "`--report-port-dst'");
+ break;
+ }
+ }
+}
+
+static struct ctproto_handler dccp = {
+ .name = "dccp",
+ .protonum = IPPROTO_DCCP,
+ .parse_opts = parse_options,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_dccp(void)
+{
+ register_proto(&dccp);
+}
diff --git a/extensions/libct_proto_gre.c b/extensions/libct_proto_gre.c
new file mode 100644
index 0000000..0274a37
--- /dev/null
+++ b/extensions/libct_proto_gre.c
@@ -0,0 +1,192 @@
+/*
+ * (C) 2009 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <netinet/in.h> /* For htons */
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+
+#include "conntrack.h"
+
+enum {
+ CT_GRE_ORIG_SKEY = (1 << 0),
+ CT_GRE_ORIG_DKEY = (1 << 1),
+ CT_GRE_REPL_SKEY = (1 << 2),
+ CT_GRE_REPL_DKEY = (1 << 3),
+ CT_GRE_MASK_SKEY = (1 << 4),
+ CT_GRE_MASK_DKEY = (1 << 5),
+ CT_GRE_EXPTUPLE_SKEY = (1 << 6),
+ CT_GRE_EXPTUPLE_DKEY = (1 << 7)
+};
+
+#define GRE_OPT_MAX 11
+static struct option opts[GRE_OPT_MAX] = {
+ { "orig-key-src", .has_arg = 1, .val = '1' },
+ { "srckey", .has_arg = 1, .val = '1' },
+ { "orig-key-dst", .has_arg = 1, .val = '2' },
+ { "dstkey", .has_arg = 1, .val = '2' },
+ { "reply-key-src", .has_arg = 1, .val = '3' },
+ { "reply-key-dst", .has_arg = 1, .val = '4' },
+ { "mask-key-src", .has_arg = 1, .val = '5' },
+ { "mask-key-dst", .has_arg = 1, .val = '6' },
+ { "tuple-key-src", .has_arg = 1, .val = '7' },
+ { "tuple-key-dst", .has_arg = 1, .val = '8' },
+ {0, 0, 0, 0}
+};
+
+static const char *gre_optflags[GRE_OPT_MAX] = {
+ [0] = "srckey",
+ [1] = "dstkey",
+ [2] = "reply-key-src",
+ [3] = "reply-key-dst",
+ [4] = "mask-key-src",
+ [5] = "mask-key-dst",
+ [6] = "tuple-key-src",
+ [7] = "tuple-key-dst"
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --orig-key-src\t\toriginal source key\n");
+ fprintf(stdout, " --orig-key-dst\t\toriginal destination key\n");
+ fprintf(stdout, " --reply-key-src\t\treply source key\n");
+ fprintf(stdout, " --reply-key-dst\t\treply destination key\n");
+ fprintf(stdout, " --mask-key-src\t\tmask source key\n");
+ fprintf(stdout, " --mask-key-dst\t\tmask destination key\n");
+ fprintf(stdout, " --tuple-key-src\t\texpectation tuple src key\n");
+ fprintf(stdout, " --tuple-key-src\t\texpectation tuple dst key\n");
+}
+
+static char gre_commands_v_options[NUMBER_OF_CMD][GRE_OPT_MAX] =
+{
+ /* 1 2 3 4 5 6 7 8 */
+/*CT_LIST*/ {2,2,2,2,0,0,0,0},
+/*CT_CREATE*/ {3,3,3,3,0,0,0,0},
+/*CT_UPDATE*/ {2,2,2,2,0,0,0,0},
+/*CT_DELETE*/ {2,2,2,2,0,0,0,0},
+/*CT_GET*/ {3,3,3,3,0,0,0,0},
+/*CT_FLUSH*/ {0,0,0,0,0,0,0,0},
+/*CT_EVENT*/ {2,2,2,2,0,0,0,0},
+/*CT_VERSION*/ {0,0,0,0,0,0,0,0},
+/*CT_HELP*/ {0,0,0,0,0,0,0,0},
+/*EXP_LIST*/ {0,0,0,0,0,0,0,0},
+/*EXP_CREATE*/ {1,1,1,1,1,1,1,1},
+/*EXP_DELETE*/ {1,1,1,1,0,0,0,0},
+/*EXP_GET*/ {1,1,1,1,0,0,0,0},
+/*EXP_FLUSH*/ {0,0,0,0,0,0,0,0},
+/*EXP_EVENT*/ {0,0,0,0,0,0,0,0},
+};
+
+static int parse_options(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ switch(c) {
+ u_int16_t port;
+ case '1':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_ORIG_SKEY;
+ break;
+ case '2':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_ORIG_DKEY;
+ break;
+ case '3':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_REPL_SKEY;
+ break;
+ case '4':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_REPL_DKEY;
+ break;
+ case '5':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_MASK_SKEY;
+ break;
+ case '6':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_MASK_DKEY;
+ break;
+ case '7':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_EXPTUPLE_SKEY;
+ break;
+ case '8':
+ port = htons(strtoul(optarg, NULL, 0));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, IPPROTO_GRE);
+ *flags |= CT_GRE_EXPTUPLE_DKEY;
+ break;
+ }
+ return 1;
+}
+
+#define GRE_VALID_FLAGS_MAX 2
+static unsigned int gre_valid_flags[GRE_VALID_FLAGS_MAX] = {
+ CT_GRE_ORIG_SKEY | CT_GRE_ORIG_DKEY,
+ CT_GRE_REPL_SKEY | CT_GRE_REPL_DKEY,
+};
+
+static void final_check(unsigned int flags,
+ unsigned int cmd,
+ struct nf_conntrack *ct)
+{
+ int ret, partial;
+
+ ret = generic_opt_check(flags, GRE_OPT_MAX,
+ gre_commands_v_options[cmd], gre_optflags,
+ gre_valid_flags, GRE_VALID_FLAGS_MAX, &partial);
+ if (!ret) {
+ switch(partial) {
+ case -1:
+ case 0:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--srckey' and "
+ "`--dstkey'");
+ break;
+ case 1:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--reply-src-key' and "
+ "`--reply-dst-key'");
+ break;
+ }
+ }
+}
+
+static struct ctproto_handler gre = {
+ .name = "gre",
+ .protonum = IPPROTO_GRE,
+ .parse_opts = parse_options,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_gre(void)
+{
+ register_proto(&gre);
+}
diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c
new file mode 100644
index 0000000..3a346ed
--- /dev/null
+++ b/extensions/libct_proto_icmp.c
@@ -0,0 +1,122 @@
+/*
+ * (C) 2005-2007 by Pablo Neira Ayuso <pablo@netfilter.org>
+ * 2005 by Harald Welte <laforge@netfilter.org>
+ *
+ * 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.
+ *
+ */
+
+#include "conntrack.h"
+
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <netinet/in.h> /* For htons */
+#include <netinet/ip_icmp.h>
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+
+enum {
+ CT_ICMP_TYPE = (1 << 0),
+ CT_ICMP_CODE = (1 << 1),
+ CT_ICMP_ID = (1 << 2),
+};
+
+static struct option opts[] = {
+ {"icmp-type", 1, 0, '1'},
+ {"icmp-code", 1, 0, '2'},
+ {"icmp-id", 1, 0, '3'},
+ {0, 0, 0, 0}
+};
+
+#define ICMP_NUMBER_OF_OPT 4
+
+static const char *icmp_optflags[ICMP_NUMBER_OF_OPT] = {
+"icmp-type", "icmp-code", "icmp-id"
+};
+
+static char icmp_commands_v_options[NUMBER_OF_CMD][ICMP_NUMBER_OF_OPT] =
+/* Well, it's better than "Re: Maradona vs Pele" */
+{
+ /* 1 2 3 */
+/*CT_LIST*/ {2,2,2},
+/*CT_CREATE*/ {1,1,2},
+/*CT_UPDATE*/ {1,1,2},
+/*CT_DELETE*/ {1,1,2},
+/*CT_GET*/ {1,1,2},
+/*CT_FLUSH*/ {0,0,0},
+/*CT_EVENT*/ {2,2,2},
+/*CT_VERSION*/ {0,0,0},
+/*CT_HELP*/ {0,0,0},
+/*EXP_LIST*/ {0,0,0},
+/*EXP_CREATE*/ {0,0,0},
+/*EXP_DELETE*/ {0,0,0},
+/*EXP_GET*/ {0,0,0},
+/*EXP_FLUSH*/ {0,0,0},
+/*EXP_EVENT*/ {0,0,0},
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --icmp-type\t\t\ticmp type\n");
+ fprintf(stdout, " --icmp-code\t\t\ticmp code\n");
+ fprintf(stdout, " --icmp-id\t\t\ticmp id\n");
+}
+
+static int parse(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ switch(c) {
+ u_int8_t tmp;
+ u_int16_t id;
+ case '1':
+ tmp = atoi(optarg);
+ nfct_set_attr_u8(ct, ATTR_ICMP_TYPE, tmp);
+ nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMP);
+ *flags |= CT_ICMP_TYPE;
+ break;
+ case '2':
+ tmp = atoi(optarg);
+ nfct_set_attr_u8(ct, ATTR_ICMP_CODE, tmp);
+ nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMP);
+ *flags |= CT_ICMP_CODE;
+ break;
+ case '3':
+ id = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ICMP_ID, id);
+ nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMP);
+ *flags |= CT_ICMP_ID;
+ break;
+ }
+ return 1;
+}
+
+static void final_check(unsigned int flags,
+ unsigned int cmd,
+ struct nf_conntrack *ct)
+{
+ generic_opt_check(flags,
+ ICMP_NUMBER_OF_OPT,
+ icmp_commands_v_options[cmd],
+ icmp_optflags, NULL, 0, NULL);
+}
+
+static struct ctproto_handler icmp = {
+ .name = "icmp",
+ .protonum = IPPROTO_ICMP,
+ .parse_opts = parse,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_icmp(void)
+{
+ register_proto(&icmp);
+}
diff --git a/extensions/libct_proto_icmpv6.c b/extensions/libct_proto_icmpv6.c
new file mode 100644
index 0000000..070eb7f
--- /dev/null
+++ b/extensions/libct_proto_icmpv6.c
@@ -0,0 +1,124 @@
+/*
+ * (C) 2008 by Krzysztof Piotr Oledzki <ole@ans.pl>
+ *
+ * Based on libct_proto_icmp.c:
+ * (C) 2005-2007 by Pablo Neira Ayuso <pablo@netfilter.org>
+ * 2005 by Harald Welte <laforge@netfilter.org>
+ *
+ * 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.
+ *
+ */
+
+#include "conntrack.h"
+
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <netinet/in.h> /* For htons */
+#include <netinet/icmp6.h>
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+
+enum {
+ CT_ICMP_TYPE = (1 << 0),
+ CT_ICMP_CODE = (1 << 1),
+ CT_ICMP_ID = (1 << 2),
+};
+
+static struct option opts[] = {
+ { "icmpv6-type", 1, 0, '1' },
+ { "icmpv6-code", 1, 0, '2' },
+ { "icmpv6-id", 1, 0, '3' },
+ { 0, 0, 0, 0 },
+};
+
+#define ICMPV6_NUMBER_OF_OPT 4
+
+static const char *icmpv6_optflags[ICMPV6_NUMBER_OF_OPT] = {
+ "icmpv6-type", "icmpv6-code", "icmpv6-id"
+};
+
+static char icmpv6_commands_v_options[NUMBER_OF_CMD][ICMPV6_NUMBER_OF_OPT] =
+/* Well, it's better than "Re: Maradona vs Pele" */
+{
+ /* 1 2 3 */
+/*CT_LIST*/ {2,2,2},
+/*CT_CREATE*/ {1,1,2},
+/*CT_UPDATE*/ {1,1,2},
+/*CT_DELETE*/ {1,1,2},
+/*CT_GET*/ {1,1,2},
+/*CT_FLUSH*/ {0,0,0},
+/*CT_EVENT*/ {2,2,2},
+/*CT_VERSION*/ {0,0,0},
+/*CT_HELP*/ {0,0,0},
+/*EXP_LIST*/ {0,0,0},
+/*EXP_CREATE*/ {0,0,0},
+/*EXP_DELETE*/ {0,0,0},
+/*EXP_GET*/ {0,0,0},
+/*EXP_FLUSH*/ {0,0,0},
+/*EXP_EVENT*/ {0,0,0},
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --icmpv6-type\t\t\ticmpv6 type\n");
+ fprintf(stdout, " --icmpv6-code\t\t\ticmpv6 code\n");
+ fprintf(stdout, " --icmpv6-id\t\t\ticmpv6 id\n");
+}
+
+static int parse(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ switch(c) {
+ u_int8_t tmp;
+ u_int16_t id;
+ case '1':
+ tmp = atoi(optarg);
+ nfct_set_attr_u8(ct, ATTR_ICMP_TYPE, tmp);
+ nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMPV6);
+ *flags |= CT_ICMP_TYPE;
+ break;
+ case '2':
+ tmp = atoi(optarg);
+ nfct_set_attr_u8(ct, ATTR_ICMP_CODE, tmp);
+ nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMPV6);
+ *flags |= CT_ICMP_CODE;
+ break;
+ case '3':
+ id = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ICMP_ID, id);
+ nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_ICMPV6);
+ *flags |= CT_ICMP_ID;
+ break;
+ }
+ return 1;
+}
+
+static void final_check(unsigned int flags,
+ unsigned int cmd,
+ struct nf_conntrack *ct)
+{
+ generic_opt_check(flags, ICMPV6_NUMBER_OF_OPT,
+ icmpv6_commands_v_options[cmd], icmpv6_optflags,
+ NULL, 0, NULL);
+}
+
+static struct ctproto_handler icmpv6 = {
+ .name = "icmpv6",
+ .protonum = IPPROTO_ICMPV6,
+ .parse_opts = parse,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_icmpv6(void)
+{
+ register_proto(&icmpv6);
+}
diff --git a/extensions/libct_proto_sctp.c b/extensions/libct_proto_sctp.c
new file mode 100644
index 0000000..f4c94df
--- /dev/null
+++ b/extensions/libct_proto_sctp.c
@@ -0,0 +1,246 @@
+/*
+ * (C) 2009 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h> /* For htons */
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+#include <libnetfilter_conntrack/libnetfilter_conntrack_sctp.h>
+
+#include "conntrack.h"
+
+#ifndef IPPROTO_SCTP
+#define IPPROTO_SCTP 132
+#endif
+
+enum {
+ CT_SCTP_ORIG_SPORT = (1 << 0),
+ CT_SCTP_ORIG_DPORT = (1 << 1),
+ CT_SCTP_REPL_SPORT = (1 << 2),
+ CT_SCTP_REPL_DPORT = (1 << 3),
+ CT_SCTP_MASK_SPORT = (1 << 4),
+ CT_SCTP_MASK_DPORT = (1 << 5),
+ CT_SCTP_STATE = (1 << 6),
+ CT_SCTP_EXPTUPLE_SPORT = (1 << 7),
+ CT_SCTP_EXPTUPLE_DPORT = (1 << 8),
+ CT_SCTP_ORIG_VTAG = (1 << 9),
+ CT_SCTP_REPL_VTAG = (1 << 10),
+};
+
+#define SCTP_OPT_MAX 14
+static struct option opts[SCTP_OPT_MAX] = {
+ { .name = "orig-port-src", .has_arg = 1, .val = 1 },
+ { .name = "orig-port-dst", .has_arg = 1, .val = 2 },
+ { .name = "reply-port-src", .has_arg = 1, .val = 3 },
+ { .name = "reply-port-dst", .has_arg = 1, .val = 4 },
+ { .name = "mask-port-src", .has_arg = 1, .val = 5 },
+ { .name = "mask-port-dst", .has_arg = 1, .val = 6 },
+ { .name = "state", .has_arg = 1, .val = 7 },
+ { .name = "tuple-port-src", .has_arg = 1, .val = 8 },
+ { .name = "tuple-port-dst", .has_arg = 1, .val = 9 },
+ { .name = "orig-vtag", .has_arg = 1, .val = 10 },
+ { .name = "reply-vtag", .has_arg = 1, .val = 11 },
+ { .name = "sport", .has_arg = 1, .val = 1 }, /* alias */
+ { .name = "dport", .has_arg = 1, .val = 2 }, /* alias */
+ {0, 0, 0, 0}
+};
+
+static const char *sctp_optflags[SCTP_OPT_MAX] = {
+ [0] = "sport",
+ [1] = "dport",
+ [2] = "reply-port-src",
+ [3] = "reply-port-dst",
+ [4] = "mask-port-src",
+ [5] = "mask-port-dst",
+ [6] = "state",
+ [7] = "tuple-port-src",
+ [8] = "tuple-port-dst",
+ [9] = "orig-vtag",
+ [10] = "reply-vtag",
+};
+
+static char sctp_commands_v_options[NUMBER_OF_CMD][SCTP_OPT_MAX] =
+/* Well, it's better than "Re: Sevilla vs Betis" */
+{
+ /* 1 2 3 4 5 6 7 8 9 10 11*/
+/*CT_LIST*/ {2,2,2,2,0,0,2,0,0,0,0},
+/*CT_CREATE*/ {3,3,3,3,0,0,1,0,0,1,1},
+/*CT_UPDATE*/ {2,2,2,2,0,0,2,0,0,2,2},
+/*CT_DELETE*/ {2,2,2,2,0,0,2,0,0,0,0},
+/*CT_GET*/ {3,3,3,3,0,0,2,0,0,2,2},
+/*CT_FLUSH*/ {0,0,0,0,0,0,0,0,0,0,0},
+/*CT_EVENT*/ {2,2,2,2,0,0,2,0,0,0,0},
+/*CT_VERSION*/ {0,0,0,0,0,0,0,0,0,0,0},
+/*CT_HELP*/ {0,0,0,0,0,0,0,0,0,0,0},
+/*EXP_LIST*/ {0,0,0,0,0,0,0,0,0,0,0},
+/*EXP_CREATE*/ {1,1,1,1,1,1,0,1,1,1,1},
+/*EXP_DELETE*/ {1,1,1,1,0,0,0,0,0,0,0},
+/*EXP_GET*/ {1,1,1,1,0,0,0,0,0,0,0},
+/*EXP_FLUSH*/ {0,0,0,0,0,0,0,0,0,0,0},
+/*EXP_EVENT*/ {0,0,0,0,0,0,0,0,0,0,0},
+};
+
+static const char *sctp_states[SCTP_CONNTRACK_MAX] = {
+ [SCTP_CONNTRACK_NONE] = "NONE",
+ [SCTP_CONNTRACK_CLOSED] = "CLOSED",
+ [SCTP_CONNTRACK_COOKIE_WAIT] = "COOKIE_WAIT",
+ [SCTP_CONNTRACK_COOKIE_ECHOED] = "COOKIE_ECHOED",
+ [SCTP_CONNTRACK_ESTABLISHED] = "ESTABLISHED",
+ [SCTP_CONNTRACK_SHUTDOWN_SENT] = "SHUTDOWN_SENT",
+ [SCTP_CONNTRACK_SHUTDOWN_RECD] = "SHUTDOWN_RECD",
+ [SCTP_CONNTRACK_SHUTDOWN_ACK_SENT] = "SHUTDOWN_ACK_SENT",
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --orig-port-src\t\toriginal source port\n");
+ fprintf(stdout, " --orig-port-dst\t\toriginal destination port\n");
+ fprintf(stdout, " --reply-port-src\t\treply source port\n");
+ fprintf(stdout, " --reply-port-dst\t\treply destination port\n");
+ fprintf(stdout, " --mask-port-src\t\tmask source port\n");
+ fprintf(stdout, " --mask-port-dst\t\tmask destination port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple src port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple dst port\n");
+ fprintf(stdout, " --state\t\t\tSCTP state, fe. ESTABLISHED\n");
+ fprintf(stdout, " --orig-vtag\t\toriginal verification tag\n");
+ fprintf(stdout, " --reply-vtag\t\treply verification tag\n");
+}
+
+static int
+parse_options(char c, struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple, struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ int i;
+ u_int16_t port;
+ u_int32_t vtag;
+
+ switch(c) {
+ case 1:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_SCTP);
+ *flags |= CT_SCTP_ORIG_SPORT;
+ break;
+ case 2:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_SCTP);
+ *flags |= CT_SCTP_ORIG_DPORT;
+ break;
+ case 3:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_SCTP);
+ *flags |= CT_SCTP_REPL_SPORT;
+ break;
+ case 4:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_SCTP);
+ *flags |= CT_SCTP_REPL_DPORT;
+ break;
+ case 5:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_SCTP);
+ *flags |= CT_SCTP_MASK_SPORT;
+ break;
+ case 6:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_SCTP);
+ *flags |= CT_SCTP_MASK_DPORT;
+ break;
+ case 7:
+ for (i=0; i<SCTP_CONNTRACK_MAX; i++) {
+ if (strcmp(optarg, sctp_states[i]) == 0) {
+ nfct_set_attr_u8(ct, ATTR_SCTP_STATE, i);
+ break;
+ }
+ }
+ if (i == SCTP_CONNTRACK_MAX)
+ exit_error(PARAMETER_PROBLEM,
+ "unknown SCTP state `%s'", optarg);
+ *flags |= CT_SCTP_STATE;
+ break;
+ case 8:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ *flags |= CT_SCTP_EXPTUPLE_SPORT;
+ break;
+ case 9:
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ *flags |= CT_SCTP_EXPTUPLE_DPORT;
+ break;
+ case 10:
+ vtag = htonl(atoi(optarg));
+ nfct_set_attr_u32(ct, ATTR_SCTP_VTAG_ORIG, vtag);
+ *flags |= CT_SCTP_ORIG_VTAG;
+ break;
+ case 11:
+ vtag = htonl(atoi(optarg));
+ nfct_set_attr_u32(ct, ATTR_SCTP_VTAG_REPL, vtag);
+ *flags |= CT_SCTP_REPL_VTAG;
+ break;
+ }
+ return 1;
+}
+
+#define SCTP_VALID_FLAGS_MAX 2
+static unsigned int dccp_valid_flags[SCTP_VALID_FLAGS_MAX] = {
+ CT_SCTP_ORIG_SPORT | CT_SCTP_ORIG_DPORT,
+ CT_SCTP_REPL_SPORT | CT_SCTP_REPL_DPORT,
+};
+
+static void
+final_check(unsigned int flags, unsigned int cmd, struct nf_conntrack *ct)
+{
+ int ret, partial;
+
+ ret = generic_opt_check(flags, SCTP_OPT_MAX,
+ sctp_commands_v_options[cmd], sctp_optflags,
+ dccp_valid_flags, SCTP_VALID_FLAGS_MAX,
+ &partial);
+ if (!ret) {
+ switch(partial) {
+ case -1:
+ case 0:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--sport' and "
+ "`--dport'");
+ break;
+ case 1:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--reply-src-port' and "
+ "`--reply-dst-port'");
+ break;
+ }
+ }
+}
+
+static struct ctproto_handler sctp = {
+ .name = "sctp",
+ .protonum = IPPROTO_SCTP,
+ .parse_opts = parse_options,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_sctp(void)
+{
+ register_proto(&sctp);
+}
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
new file mode 100644
index 0000000..cb573d0
--- /dev/null
+++ b/extensions/libct_proto_tcp.c
@@ -0,0 +1,234 @@
+/*
+ * (C) 2005-2007 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h> /* For htons */
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+#include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>
+
+#include "conntrack.h"
+
+enum {
+ CT_TCP_ORIG_SPORT = (1 << 0),
+ CT_TCP_ORIG_DPORT = (1 << 1),
+ CT_TCP_REPL_SPORT = (1 << 2),
+ CT_TCP_REPL_DPORT = (1 << 3),
+ CT_TCP_MASK_SPORT = (1 << 4),
+ CT_TCP_MASK_DPORT = (1 << 5),
+ CT_TCP_STATE = (1 << 6),
+ CT_TCP_EXPTUPLE_SPORT = (1 << 7),
+ CT_TCP_EXPTUPLE_DPORT = (1 << 8)
+};
+
+static struct option opts[] = {
+ {"orig-port-src", 1, 0, '1'},
+ {"sport", 1, 0, '1'},
+ {"orig-port-dst", 1, 0, '2'},
+ {"dport", 1, 0, '2'},
+ {"reply-port-src", 1, 0, '3'},
+ {"reply-port-dst", 1, 0, '4'},
+ {"mask-port-src", 1, 0, '5'},
+ {"mask-port-dst", 1, 0, '6'},
+ {"state", 1, 0, '7'},
+ {"tuple-port-src", 1, 0, '8'},
+ {"tuple-port-dst", 1, 0, '9'},
+ {0, 0, 0, 0}
+};
+
+#define TCP_NUMBER_OF_OPT 10
+
+static const char *tcp_optflags[TCP_NUMBER_OF_OPT] = {
+"sport", "dport", "reply-port-src", "reply-port-dst", "mask-port-src",
+"mask-port-dst", "state", "tuple-port-src", "tuple-port-dst"
+};
+
+static char tcp_commands_v_options[NUMBER_OF_CMD][TCP_NUMBER_OF_OPT] =
+/* Well, it's better than "Re: Sevilla vs Betis" */
+{
+ /* 1 2 3 4 5 6 7 8 9 */
+/*CT_LIST*/ {2,2,2,2,0,0,2,0,0},
+/*CT_CREATE*/ {3,3,3,3,0,0,1,0,0},
+/*CT_UPDATE*/ {2,2,2,2,0,0,2,0,0},
+/*CT_DELETE*/ {2,2,2,2,0,0,2,0,0},
+/*CT_GET*/ {3,3,3,3,0,0,2,0,0},
+/*CT_FLUSH*/ {0,0,0,0,0,0,0,0,0},
+/*CT_EVENT*/ {2,2,2,2,0,0,2,0,0},
+/*CT_VERSION*/ {0,0,0,0,0,0,0,0,0},
+/*CT_HELP*/ {0,0,0,0,0,0,0,0,0},
+/*EXP_LIST*/ {0,0,0,0,0,0,0,0,0},
+/*EXP_CREATE*/ {1,1,1,1,1,1,0,1,1},
+/*EXP_DELETE*/ {1,1,1,1,0,0,0,0,0},
+/*EXP_GET*/ {1,1,1,1,0,0,0,0,0},
+/*EXP_FLUSH*/ {0,0,0,0,0,0,0,0,0},
+/*EXP_EVENT*/ {0,0,0,0,0,0,0,0,0},
+};
+
+static const char *tcp_states[TCP_CONNTRACK_MAX] = {
+ [TCP_CONNTRACK_NONE] = "NONE",
+ [TCP_CONNTRACK_SYN_SENT] = "SYN_SENT",
+ [TCP_CONNTRACK_SYN_RECV] = "SYN_RECV",
+ [TCP_CONNTRACK_ESTABLISHED] = "ESTABLISHED",
+ [TCP_CONNTRACK_FIN_WAIT] = "FIN_WAIT",
+ [TCP_CONNTRACK_CLOSE_WAIT] = "CLOSE_WAIT",
+ [TCP_CONNTRACK_LAST_ACK] = "LAST_ACK",
+ [TCP_CONNTRACK_TIME_WAIT] = "TIME_WAIT",
+ [TCP_CONNTRACK_CLOSE] = "CLOSE",
+ [TCP_CONNTRACK_LISTEN] = "LISTEN"
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --orig-port-src\t\toriginal source port\n");
+ fprintf(stdout, " --orig-port-dst\t\toriginal destination port\n");
+ fprintf(stdout, " --reply-port-src\t\treply source port\n");
+ fprintf(stdout, " --reply-port-dst\t\treply destination port\n");
+ fprintf(stdout, " --mask-port-src\t\tmask source port\n");
+ fprintf(stdout, " --mask-port-dst\t\tmask destination port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple src port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple dst port\n");
+ fprintf(stdout, " --state\t\t\tTCP state, fe. ESTABLISHED\n");
+}
+
+static int parse_options(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ int i;
+ u_int16_t port;
+
+ switch(c) {
+ case '1':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_TCP);
+ *flags |= CT_TCP_ORIG_SPORT;
+ break;
+ case '2':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_TCP);
+ *flags |= CT_TCP_ORIG_DPORT;
+ break;
+ case '3':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_TCP);
+ *flags |= CT_TCP_REPL_SPORT;
+ break;
+ case '4':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_TCP);
+ *flags |= CT_TCP_REPL_DPORT;
+ break;
+ case '5':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_TCP);
+ *flags |= CT_TCP_MASK_SPORT;
+ break;
+ case '6':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_TCP);
+ *flags |= CT_TCP_MASK_DPORT;
+ break;
+ case '7':
+ for (i=0; i<TCP_CONNTRACK_MAX; i++) {
+ if (strcmp(optarg, tcp_states[i]) == 0) {
+ nfct_set_attr_u8(ct, ATTR_TCP_STATE, i);
+ break;
+ }
+ }
+ if (i == TCP_CONNTRACK_MAX)
+ exit_error(PARAMETER_PROBLEM,
+ "unknown TCP state `%s'", optarg);
+ *flags |= CT_TCP_STATE;
+ break;
+ case '8':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ *flags |= CT_TCP_EXPTUPLE_SPORT;
+ break;
+ case '9':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, port);
+ *flags |= CT_TCP_EXPTUPLE_DPORT;
+ break;
+ }
+ return 1;
+}
+
+#define TCP_VALID_FLAGS_MAX 2
+static unsigned int tcp_valid_flags[TCP_VALID_FLAGS_MAX] = {
+ CT_TCP_ORIG_SPORT | CT_TCP_ORIG_DPORT,
+ CT_TCP_REPL_SPORT | CT_TCP_REPL_DPORT,
+};
+
+static void final_check(unsigned int flags,
+ unsigned int cmd,
+ struct nf_conntrack *ct)
+{
+ int ret, partial;
+
+ ret = generic_opt_check(flags, TCP_NUMBER_OF_OPT,
+ tcp_commands_v_options[cmd], tcp_optflags,
+ tcp_valid_flags, TCP_VALID_FLAGS_MAX, &partial);
+ if (!ret) {
+ switch(partial) {
+ case -1:
+ case 0:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--sport' and "
+ "`--dport'");
+ break;
+ case 1:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--reply-src-port' and "
+ "`--reply-dst-port'");
+ break;
+ }
+ }
+ /* Disable TCP window tracking for manually created TCP entries,
+ * otherwise this will not work. */
+ uint8_t tcp_flags = IP_CT_TCP_FLAG_BE_LIBERAL |
+ IP_CT_TCP_FLAG_SACK_PERM;
+
+ /* This allows to reopen a new connection directly from TIME-WAIT
+ * as RFC 1122 states. See nf_conntrack_proto_tcp.c for more info. */
+ if (nfct_get_attr_u8(ct, ATTR_TCP_STATE) >= TCP_CONNTRACK_TIME_WAIT)
+ tcp_flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
+
+ nfct_set_attr_u8(ct, ATTR_TCP_FLAGS_ORIG, tcp_flags);
+ nfct_set_attr_u8(ct, ATTR_TCP_MASK_ORIG, tcp_flags);
+ nfct_set_attr_u8(ct, ATTR_TCP_FLAGS_REPL, tcp_flags);
+ nfct_set_attr_u8(ct, ATTR_TCP_MASK_REPL, tcp_flags);
+}
+
+static struct ctproto_handler tcp = {
+ .name = "tcp",
+ .protonum = IPPROTO_TCP,
+ .parse_opts = parse_options,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_tcp(void)
+{
+ register_proto(&tcp);
+}
diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c
new file mode 100644
index 0000000..d7c4da1
--- /dev/null
+++ b/extensions/libct_proto_udp.c
@@ -0,0 +1,192 @@
+/*
+ * (C) 2005-2007 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <netinet/in.h> /* For htons */
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+
+#include "conntrack.h"
+
+enum {
+ CT_UDP_ORIG_SPORT = (1 << 0),
+ CT_UDP_ORIG_DPORT = (1 << 1),
+ CT_UDP_REPL_SPORT = (1 << 2),
+ CT_UDP_REPL_DPORT = (1 << 3),
+ CT_UDP_MASK_SPORT = (1 << 4),
+ CT_UDP_MASK_DPORT = (1 << 5),
+ CT_UDP_EXPTUPLE_SPORT = (1 << 6),
+ CT_UDP_EXPTUPLE_DPORT = (1 << 7)
+};
+
+static struct option opts[] = {
+ {"orig-port-src", 1, 0, '1'},
+ {"sport", 1, 0, '1'},
+ {"orig-port-dst", 1, 0, '2'},
+ {"dport", 1, 0, '2'},
+ {"reply-port-src", 1, 0, '3'},
+ {"reply-port-dst", 1, 0, '4'},
+ {"mask-port-src", 1, 0, '5'},
+ {"mask-port-dst", 1, 0, '6'},
+ {"tuple-port-src", 1, 0, '7'},
+ {"tuple-port-dst", 1, 0, '8'},
+ {0, 0, 0, 0}
+};
+
+#define UDP_NUMBER_OF_OPT 9
+
+static const char *udp_optflags[UDP_NUMBER_OF_OPT] = {
+"sport", "dport", "reply-port-src", "reply-port-dst", "mask-port-src",
+"mask-port-dst", "tuple-port-src", "tuple-port-dst"
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --orig-port-src\t\toriginal source port\n");
+ fprintf(stdout, " --orig-port-dst\t\toriginal destination port\n");
+ fprintf(stdout, " --reply-port-src\t\treply source port\n");
+ fprintf(stdout, " --reply-port-dst\t\treply destination port\n");
+ fprintf(stdout, " --mask-port-src\t\tmask source port\n");
+ fprintf(stdout, " --mask-port-dst\t\tmask destination port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple src port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple dst port\n");
+}
+
+static char udp_commands_v_options[NUMBER_OF_CMD][UDP_NUMBER_OF_OPT] =
+/* Well, it's better than "Re: Galeano vs Vargas Llosa" */
+{
+ /* 1 2 3 4 5 6 7 8 */
+/*CT_LIST*/ {2,2,2,2,0,0,0,0},
+/*CT_CREATE*/ {3,3,3,3,0,0,0,0},
+/*CT_UPDATE*/ {2,2,2,2,0,0,0,0},
+/*CT_DELETE*/ {2,2,2,2,0,0,0,0},
+/*CT_GET*/ {3,3,3,3,0,0,0,0},
+/*CT_FLUSH*/ {0,0,0,0,0,0,0,0},
+/*CT_EVENT*/ {2,2,2,2,0,0,0,0},
+/*CT_VERSION*/ {0,0,0,0,0,0,0,0},
+/*CT_HELP*/ {0,0,0,0,0,0,0,0},
+/*EXP_LIST*/ {0,0,0,0,0,0,0,0},
+/*EXP_CREATE*/ {1,1,1,1,1,1,1,1},
+/*EXP_DELETE*/ {1,1,1,1,0,0,0,0},
+/*EXP_GET*/ {1,1,1,1,0,0,0,0},
+/*EXP_FLUSH*/ {0,0,0,0,0,0,0,0},
+/*EXP_EVENT*/ {0,0,0,0,0,0,0,0},
+};
+
+static int parse_options(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ switch(c) {
+ u_int16_t port;
+ case '1':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_UDP);
+ *flags |= CT_UDP_ORIG_SPORT;
+ break;
+ case '2':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_UDP);
+ *flags |= CT_UDP_ORIG_DPORT;
+ break;
+ case '3':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_UDP);
+ *flags |= CT_UDP_REPL_SPORT;
+ break;
+ case '4':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_UDP);
+ *flags |= CT_UDP_REPL_DPORT;
+ break;
+ case '5':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_UDP);
+ *flags |= CT_UDP_MASK_SPORT;
+ break;
+ case '6':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_UDP);
+ *flags |= CT_UDP_MASK_DPORT;
+ break;
+ case '7':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(exptuple,
+ ATTR_ORIG_L4PROTO,
+ IPPROTO_UDP);
+ *flags |= CT_UDP_EXPTUPLE_SPORT;
+ break;
+ case '8':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(exptuple,
+ ATTR_ORIG_L4PROTO,
+ IPPROTO_UDP);
+ *flags |= CT_UDP_EXPTUPLE_DPORT;
+ break;
+ }
+ return 1;
+}
+
+#define UDP_VALID_FLAGS_MAX 2
+static unsigned int udp_valid_flags[UDP_VALID_FLAGS_MAX] = {
+ CT_UDP_ORIG_SPORT | CT_UDP_ORIG_DPORT,
+ CT_UDP_REPL_SPORT | CT_UDP_REPL_DPORT,
+};
+
+static void final_check(unsigned int flags,
+ unsigned int cmd,
+ struct nf_conntrack *ct)
+{
+ int ret, partial;
+
+ ret = generic_opt_check(flags, UDP_NUMBER_OF_OPT,
+ udp_commands_v_options[cmd], udp_optflags,
+ udp_valid_flags, UDP_VALID_FLAGS_MAX, &partial);
+ if (!ret) {
+ switch(partial) {
+ case -1:
+ case 0:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--sport' and "
+ "`--dport'");
+ break;
+ case 1:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--reply-src-port' and "
+ "`--reply-dst-port'");
+ break;
+ }
+ }
+}
+
+static struct ctproto_handler udp = {
+ .name = "udp",
+ .protonum = IPPROTO_UDP,
+ .parse_opts = parse_options,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_udp(void)
+{
+ register_proto(&udp);
+}
diff --git a/extensions/libct_proto_udplite.c b/extensions/libct_proto_udplite.c
new file mode 100644
index 0000000..bffd5fe
--- /dev/null
+++ b/extensions/libct_proto_udplite.c
@@ -0,0 +1,197 @@
+/*
+ * (C) 2009 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <netinet/in.h> /* For htons */
+#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+
+#include "conntrack.h"
+
+#ifndef IPPROTO_UDPLITE
+#define IPPROTO_UDPLITE 136
+#endif
+
+enum {
+ CT_UDPLITE_ORIG_SPORT = (1 << 0),
+ CT_UDPLITE_ORIG_DPORT = (1 << 1),
+ CT_UDPLITE_REPL_SPORT = (1 << 2),
+ CT_UDPLITE_REPL_DPORT = (1 << 3),
+ CT_UDPLITE_MASK_SPORT = (1 << 4),
+ CT_UDPLITE_MASK_DPORT = (1 << 5),
+ CT_UDPLITE_EXPTUPLE_SPORT = (1 << 6),
+ CT_UDPLITE_EXPTUPLE_DPORT = (1 << 7)
+};
+
+#define UDP_OPT_MAX 11
+static struct option opts[UDP_OPT_MAX] = {
+ { .name = "orig-port-src", .has_arg = 1, .val = '1' },
+ { .name = "orig-port-dst", .has_arg = 1, .val = '2' },
+ { .name = "reply-port-src", .has_arg = 1, .val = '3' },
+ { .name = "reply-port-dst", .has_arg = 1, .val = '4' },
+ { .name = "mask-port-src", .has_arg = 1, .val = '5' },
+ { .name = "mask-port-dst", .has_arg = 1, .val = '6' },
+ { .name = "tuple-port-src", .has_arg = 1, .val = '7' },
+ { .name = "tuple-port-dst", .has_arg = 1, .val = '8' },
+ { .name = "sport", .has_arg = 1, .val = '1' },
+ { .name = "dport", .has_arg = 1, .val = '2' },
+ {0, 0, 0, 0}
+};
+
+static const char *udplite_optflags[UDP_OPT_MAX] = {
+ [0] = "sport",
+ [1] = "dport",
+ [2] = "reply-port-src",
+ [3] = "reply-port-dst",
+ [4] = "mask-port-src",
+ [5] = "mask-port-dst",
+ [6] = "tuple-port-src",
+ [7] = "tuple-port-dst"
+};
+
+static void help(void)
+{
+ fprintf(stdout, " --orig-port-src\t\toriginal source port\n");
+ fprintf(stdout, " --orig-port-dst\t\toriginal destination port\n");
+ fprintf(stdout, " --reply-port-src\t\treply source port\n");
+ fprintf(stdout, " --reply-port-dst\t\treply destination port\n");
+ fprintf(stdout, " --mask-port-src\t\tmask source port\n");
+ fprintf(stdout, " --mask-port-dst\t\tmask destination port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple src port\n");
+ fprintf(stdout, " --tuple-port-src\t\texpectation tuple dst port\n");
+}
+
+static char udplite_commands_v_options[NUMBER_OF_CMD][UDP_OPT_MAX] =
+{
+ /* 1 2 3 4 5 6 7 8 */
+/*CT_LIST*/ {2,2,2,2,0,0,0,0},
+/*CT_CREATE*/ {3,3,3,3,0,0,0,0},
+/*CT_UPDATE*/ {2,2,2,2,0,0,0,0},
+/*CT_DELETE*/ {2,2,2,2,0,0,0,0},
+/*CT_GET*/ {3,3,3,3,0,0,0,0},
+/*CT_FLUSH*/ {0,0,0,0,0,0,0,0},
+/*CT_EVENT*/ {2,2,2,2,0,0,0,0},
+/*CT_VERSION*/ {0,0,0,0,0,0,0,0},
+/*CT_HELP*/ {0,0,0,0,0,0,0,0},
+/*EXP_LIST*/ {0,0,0,0,0,0,0,0},
+/*EXP_CREATE*/ {1,1,1,1,1,1,1,1},
+/*EXP_DELETE*/ {1,1,1,1,0,0,0,0},
+/*EXP_GET*/ {1,1,1,1,0,0,0,0},
+/*EXP_FLUSH*/ {0,0,0,0,0,0,0,0},
+/*EXP_EVENT*/ {0,0,0,0,0,0,0,0},
+};
+
+static int parse_options(char c,
+ struct nf_conntrack *ct,
+ struct nf_conntrack *exptuple,
+ struct nf_conntrack *mask,
+ unsigned int *flags)
+{
+ switch(c) {
+ u_int16_t port;
+ case '1':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_ORIG_SPORT;
+ break;
+ case '2':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_ORIG_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_ORIG_DPORT;
+ break;
+ case '3':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_SRC, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_REPL_SPORT;
+ break;
+ case '4':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(ct, ATTR_REPL_PORT_DST, port);
+ nfct_set_attr_u8(ct, ATTR_REPL_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_REPL_DPORT;
+ break;
+ case '5':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_MASK_SPORT;
+ break;
+ case '6':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(mask, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(mask, ATTR_ORIG_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_MASK_DPORT;
+ break;
+ case '7':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_SRC, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_EXPTUPLE_SPORT;
+ break;
+ case '8':
+ port = htons(atoi(optarg));
+ nfct_set_attr_u16(exptuple, ATTR_ORIG_PORT_DST, port);
+ nfct_set_attr_u8(exptuple, ATTR_ORIG_L4PROTO, IPPROTO_UDPLITE);
+ *flags |= CT_UDPLITE_EXPTUPLE_DPORT;
+ break;
+ }
+ return 1;
+}
+
+#define UDPLITE_VALID_FLAGS_MAX 2
+static unsigned int udplite_valid_flags[UDPLITE_VALID_FLAGS_MAX] = {
+ CT_UDPLITE_ORIG_SPORT | CT_UDPLITE_ORIG_DPORT,
+ CT_UDPLITE_REPL_SPORT | CT_UDPLITE_REPL_DPORT,
+};
+
+static void
+final_check(unsigned int flags, unsigned int cmd, struct nf_conntrack *ct)
+{
+ int ret, partial;
+
+ ret = generic_opt_check(flags, UDP_OPT_MAX,
+ udplite_commands_v_options[cmd],
+ udplite_optflags,
+ udplite_valid_flags, UDPLITE_VALID_FLAGS_MAX,
+ &partial);
+ if (!ret) {
+ switch(partial) {
+ case -1:
+ case 0:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--sport' and "
+ "`--dport'");
+ break;
+ case 1:
+ exit_error(PARAMETER_PROBLEM, "you have to specify "
+ "`--reply-src-port' and "
+ "`--reply-dst-port'");
+ break;
+ }
+ }
+}
+
+static struct ctproto_handler udplite = {
+ .name = "udplite",
+ .protonum = IPPROTO_UDPLITE,
+ .parse_opts = parse_options,
+ .final_check = final_check,
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_udplite(void)
+{
+ register_proto(&udplite);
+}
diff --git a/extensions/libct_proto_unknown.c b/extensions/libct_proto_unknown.c
new file mode 100644
index 0000000..2a47704
--- /dev/null
+++ b/extensions/libct_proto_unknown.c
@@ -0,0 +1,34 @@
+/*
+ * (C) 2005-2008 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <getopt.h>
+
+#include "conntrack.h"
+
+static struct option opts[] = {
+ {0, 0, 0, 0}
+};
+
+static void help(void)
+{
+ fprintf(stdout, " no options (unsupported)\n");
+}
+
+struct ctproto_handler ct_proto_unknown = {
+ .name = "unknown",
+ .help = help,
+ .opts = opts,
+ .version = VERSION,
+};
+
+void register_unknown(void)
+{
+ /* we don't actually insert this protocol in the list */
+}