From bddf022e9c08ccb535ffb6b259031e1198c3b705 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 22 Apr 2010 19:49:25 +0200 Subject: fix busybox compile, when ipkg is choosen and udhcpd is not --- package/busybox/Makefile | 10 +- package/busybox/patches/001-ipkg.patch | 236 +++++++++++++++++++-------------- 2 files changed, 146 insertions(+), 100 deletions(-) (limited to 'package') diff --git a/package/busybox/Makefile b/package/busybox/Makefile index 2f1d9369f..4881762a1 100644 --- a/package/busybox/Makefile +++ b/package/busybox/Makefile @@ -22,6 +22,10 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,BUSYBOX,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,UDHCPD,udhcpd,${PKG_VERSION}-${PKG_RELEASE},busybox,${PKG_DESCR_UDHCPD},${PKG_SECTION_UDHCPD})) +SUB_INSTALLS-y:= +SUB_INSTALLS-m:= +SUB_INSTALLS-${ADK_PACKAGE_UDHCPD}+= udhcpd-install + CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual @@ -56,7 +60,7 @@ else IPKG_ARCH="$(CPU_ARCH)" ARCH="$(ARCH)" HOSTCC="$(HOSTCC)" -C $(WRKBUILD) busybox endif -do-install: $(TOPDIR)/.busyboxcfg ${WRKBUILD}/.config +do-install: $(TOPDIR)/.busyboxcfg ${WRKBUILD}/.config ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ifeq ($(ADK_NATIVE),y) $(MAKE) V=1 \ IPKG_ARCH="$(CPU_ARCH)" ARCH="$(ARCH)" HOSTCC="$(HOSTCC)" -C $(WRKBUILD) install $(MAKE_TRACE) @@ -69,10 +73,10 @@ ifeq ($(ADK_DEBUG),y) ${INSTALL_BIN} $(WRKBUILD)/busybox_unstripped \ $(IDIR_BUSYBOX)/bin/busybox endif -ifeq ($(ADK_PACKAGE_UDHCPD),y) + +udhcpd-install: ${INSTALL_DIR} ${IDIR_UDHCPD}/etc/ ${INSTALL_DATA} ./files/udhcpd.conf ${IDIR_UDHCPD}/etc/ -endif fake: $(TOPDIR)/.busyboxcfg do-configure do-install diff --git a/package/busybox/patches/001-ipkg.patch b/package/busybox/patches/001-ipkg.patch index b28473e02..7295e4c49 100644 --- a/package/busybox/patches/001-ipkg.patch +++ b/package/busybox/patches/001-ipkg.patch @@ -1,6 +1,6 @@ diff -Nur busybox-1.16.1.orig/archival/Config.in busybox-1.16.1/archival/Config.in --- busybox-1.16.1.orig/archival/Config.in 2010-03-28 19:43:35.000000000 +0200 -+++ busybox-1.16.1/archival/Config.in 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/Config.in 2010-04-22 19:18:12.000000000 +0200 @@ -187,6 +187,14 @@ are actually slower than gzip at equivalent compression ratios and take up 3.2K of code. @@ -18,7 +18,7 @@ diff -Nur busybox-1.16.1.orig/archival/Config.in busybox-1.16.1/archival/Config. default n diff -Nur busybox-1.16.1.orig/archival/ipkg.c busybox-1.16.1/archival/ipkg.c --- busybox-1.16.1.orig/archival/ipkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/ipkg.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/ipkg.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,28 @@ +/* ipkg.c - the itsy package management system + @@ -50,7 +50,7 @@ diff -Nur busybox-1.16.1.orig/archival/ipkg.c busybox-1.16.1/archival/ipkg.c +} diff -Nur busybox-1.16.1.orig/archival/Kbuild busybox-1.16.1/archival/Kbuild --- busybox-1.16.1.orig/archival/Kbuild 2010-03-20 03:58:07.000000000 +0100 -+++ busybox-1.16.1/archival/Kbuild 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/Kbuild 2010-04-22 19:18:12.000000000 +0200 @@ -16,6 +16,7 @@ lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o lib-$(CONFIG_GUNZIP) += bbunzip.o @@ -61,7 +61,7 @@ diff -Nur busybox-1.16.1.orig/archival/Kbuild busybox-1.16.1/archival/Kbuild lib-$(CONFIG_RPM2CPIO) += rpm2cpio.o diff -Nur busybox-1.16.1.orig/archival/libipkg/args.c busybox-1.16.1/archival/libipkg/args.c --- busybox-1.16.1.orig/archival/libipkg/args.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/args.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/args.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,242 @@ +/* args.c - parse command-line args + @@ -307,7 +307,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/args.c busybox-1.16.1/archival/li +} diff -Nur busybox-1.16.1.orig/archival/libipkg/args.h busybox-1.16.1/archival/libipkg/args.h --- busybox-1.16.1.orig/archival/libipkg/args.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/args.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/args.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,72 @@ +/* args.h - parse command-line args + @@ -383,7 +383,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/args.h busybox-1.16.1/archival/li +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile.c busybox-1.16.1/archival/libipkg/conffile.c --- busybox-1.16.1.orig/archival/libipkg/conffile.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/conffile.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/conffile.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,65 @@ +/* conffile.c - the itsy package management system + @@ -452,7 +452,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile.c busybox-1.16.1/archiva +} diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile.h busybox-1.16.1/archival/libipkg/conffile.h --- busybox-1.16.1.orig/archival/libipkg/conffile.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/conffile.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/conffile.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,30 @@ +/* conffile.h - the itsy package management system + @@ -486,7 +486,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile.h busybox-1.16.1/archiva + diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile_list.c busybox-1.16.1/archival/libipkg/conffile_list.c --- busybox-1.16.1.orig/archival/libipkg/conffile_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/conffile_list.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/conffile_list.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,47 @@ +/* conffile_list.c - the itsy package management system + @@ -537,7 +537,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile_list.c busybox-1.16.1/ar + diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile_list.h busybox-1.16.1/archival/libipkg/conffile_list.h --- busybox-1.16.1.orig/archival/libipkg/conffile_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/conffile_list.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/conffile_list.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,36 @@ +/* conffile_list.h - the itsy package management system + @@ -577,7 +577,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/conffile_list.h busybox-1.16.1/ar + diff -Nur busybox-1.16.1.orig/archival/libipkg/file_util.c busybox-1.16.1/archival/libipkg/file_util.c --- busybox-1.16.1.orig/archival/libipkg/file_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/file_util.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/file_util.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,186 @@ +/* file_util.c - convenience routines for common stat operations + @@ -767,7 +767,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/file_util.c busybox-1.16.1/archiv + diff -Nur busybox-1.16.1.orig/archival/libipkg/file_util.h busybox-1.16.1/archival/libipkg/file_util.h --- busybox-1.16.1.orig/archival/libipkg/file_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/file_util.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/file_util.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,29 @@ +/* file_util.h - convenience routines for common file operations + @@ -800,7 +800,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/file_util.h busybox-1.16.1/archiv +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/hash_table.c busybox-1.16.1/archival/libipkg/hash_table.c --- busybox-1.16.1.orig/archival/libipkg/hash_table.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/hash_table.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/hash_table.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,155 @@ +/* hash.c - hash tables for ipkg + @@ -959,7 +959,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/hash_table.c busybox-1.16.1/archi + diff -Nur busybox-1.16.1.orig/archival/libipkg/hash_table.h busybox-1.16.1/archival/libipkg/hash_table.h --- busybox-1.16.1.orig/archival/libipkg/hash_table.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/hash_table.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/hash_table.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,44 @@ +/* hash.h - hash tables for ipkg + @@ -1007,7 +1007,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/hash_table.h busybox-1.16.1/archi +#endif /* _HASH_TABLE_H_ */ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_cmd.c busybox-1.16.1/archival/libipkg/ipkg_cmd.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_cmd.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_cmd.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_cmd.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,1386 @@ +/* ipkg_cmd.c - the itsy package management system + @@ -2397,7 +2397,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_cmd.c busybox-1.16.1/archiva + diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_cmd.h busybox-1.16.1/archival/libipkg/ipkg_cmd.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_cmd.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_cmd.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_cmd.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,41 @@ +/* ipkg_cmd.h - the itsy package management system + @@ -2442,7 +2442,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_cmd.h busybox-1.16.1/archiva +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_conf.c busybox-1.16.1/archival/libipkg/ipkg_conf.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_conf.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_conf.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_conf.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,711 @@ +/* ipkg_conf.c - the itsy package management system + @@ -3157,7 +3157,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_conf.c busybox-1.16.1/archiv +} diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_conf.h busybox-1.16.1/archival/libipkg/ipkg_conf.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_conf.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_conf.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_conf.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,107 @@ +/* ipkg_conf.h - the itsy package management system + @@ -3268,7 +3268,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_conf.h busybox-1.16.1/archiv +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_configure.c busybox-1.16.1/archival/libipkg/ipkg_configure.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_configure.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_configure.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_configure.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,40 @@ +/* ipkg_configure.c - the itsy package management system + @@ -3312,7 +3312,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_configure.c busybox-1.16.1/a + diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_configure.h busybox-1.16.1/archival/libipkg/ipkg_configure.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_configure.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_configure.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_configure.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,25 @@ +/* ipkg_configure.h - the itsy package management system + @@ -3341,7 +3341,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_configure.h busybox-1.16.1/a +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_download.c busybox-1.16.1/archival/libipkg/ipkg_download.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_download.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_download.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_download.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,195 @@ +/* ipkg_download.c - the itsy package management system + @@ -3540,7 +3540,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_download.c busybox-1.16.1/ar +} diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_download.h busybox-1.16.1/archival/libipkg/ipkg_download.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_download.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_download.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_download.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,30 @@ +/* ipkg_download.h - the itsy package management system + @@ -3574,7 +3574,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_download.h busybox-1.16.1/ar +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg.h busybox-1.16.1/archival/libipkg/ipkg.h --- busybox-1.16.1.orig/archival/libipkg/ipkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,68 @@ +/* ipkg.h - the itsy package management system + @@ -3646,7 +3646,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg.h busybox-1.16.1/archival/li +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_includes.h busybox-1.16.1/archival/libipkg/ipkg_includes.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_includes.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_includes.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_includes.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,79 @@ +#ifndef IPKG_INCLUDES_H +#define IPKG_INCLUDES_H @@ -3729,7 +3729,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_includes.h busybox-1.16.1/ar +#endif /* IPKG_INCLUDES_H */ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_install.c busybox-1.16.1/archival/libipkg/ipkg_install.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_install.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_install.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_install.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,1982 @@ +/* ipkg_install.c - the itsy package management system + @@ -5715,7 +5715,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_install.c busybox-1.16.1/arc +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_install.h busybox-1.16.1/archival/libipkg/ipkg_install.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_install.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_install.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_install.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,35 @@ +/* ipkg_install.h - the itsy package management system + @@ -5754,7 +5754,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_install.h busybox-1.16.1/arc +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_message.c busybox-1.16.1/archival/libipkg/ipkg_message.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_message.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_message.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_message.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,35 @@ +/* ipkg_message.c - the itsy package management system + @@ -5793,7 +5793,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_message.c busybox-1.16.1/arc +} diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_message.h busybox-1.16.1/archival/libipkg/ipkg_message.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_message.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_message.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_message.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,32 @@ +/* ipkg_message.h - the itsy package management system + @@ -5829,7 +5829,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_message.h busybox-1.16.1/arc +#endif /* _IPKG_MESSAGE_H_ */ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_remove.c busybox-1.16.1/archival/libipkg/ipkg_remove.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_remove.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_remove.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_remove.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,385 @@ +/* ipkg_remove.c - the itsy package management system + @@ -6218,7 +6218,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_remove.c busybox-1.16.1/arch +} diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_remove.h busybox-1.16.1/archival/libipkg/ipkg_remove.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_remove.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_remove.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_remove.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,33 @@ +/* ipkg_remove.h - the itsy package management system + @@ -6255,7 +6255,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_remove.h busybox-1.16.1/arch +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_upgrade.c busybox-1.16.1/archival/libipkg/ipkg_upgrade.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_upgrade.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_upgrade.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_upgrade.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,79 @@ +/* ipkg_upgrade.c - the itsy package management system + @@ -6338,7 +6338,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_upgrade.c busybox-1.16.1/arc +} diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_upgrade.h busybox-1.16.1/archival/libipkg/ipkg_upgrade.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_upgrade.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_upgrade.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_upgrade.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,18 @@ +/* ipkg_upgrade.c - the itsy package management system + @@ -6360,7 +6360,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_upgrade.h busybox-1.16.1/arc +int ipkg_upgrade_pkg(ipkg_conf_t *conf, pkg_t *old); diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_utils.c busybox-1.16.1/archival/libipkg/ipkg_utils.c --- busybox-1.16.1.orig/archival/libipkg/ipkg_utils.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_utils.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_utils.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,185 @@ +/* ipkg_utils.c - the itsy package management system + @@ -6549,7 +6549,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_utils.c busybox-1.16.1/archi + diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_utils.h busybox-1.16.1/archival/libipkg/ipkg_utils.h --- busybox-1.16.1.orig/archival/libipkg/ipkg_utils.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/ipkg_utils.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/ipkg_utils.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,29 @@ +/* ipkg_utils.h - the itsy package management system + @@ -6582,7 +6582,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/ipkg_utils.h busybox-1.16.1/archi +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/Kbuild busybox-1.16.1/archival/libipkg/Kbuild --- busybox-1.16.1.orig/archival/libipkg/Kbuild 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/Kbuild 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/Kbuild 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,60 @@ +# Makefile for busybox +# @@ -6646,7 +6646,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/Kbuild busybox-1.16.1/archival/li +CFLAGS += -DIPKGLIBDIR="\"/usr/lib\"" -DHOST_CPU_STR="\"$(IPKG_ARCH)\"" diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.c busybox-1.16.1/archival/libipkg/libipkg.c --- busybox-1.16.1.orig/archival/libipkg/libipkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/libipkg.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/libipkg.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,525 @@ +/* ipkglib.c - the itsy package management system + @@ -7175,7 +7175,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.c busybox-1.16.1/archival +} diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.h busybox-1.16.1/archival/libipkg/libipkg.h --- busybox-1.16.1.orig/archival/libipkg/libipkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/libipkg.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/libipkg.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,78 @@ +/* ipkglib.h - the itsy package management system + @@ -7257,7 +7257,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.h busybox-1.16.1/archival +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair.c busybox-1.16.1/archival/libipkg/nv_pair.c --- busybox-1.16.1.orig/archival/libipkg/nv_pair.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/nv_pair.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/nv_pair.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,40 @@ +/* nv_pair.c - the itsy package management system + @@ -7301,7 +7301,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair.c busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair.h busybox-1.16.1/archival/libipkg/nv_pair.h --- busybox-1.16.1.orig/archival/libipkg/nv_pair.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/nv_pair.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/nv_pair.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,32 @@ +/* nv_pair.h - the itsy package management system + @@ -7337,7 +7337,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair.h busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair_list.c busybox-1.16.1/archival/libipkg/nv_pair_list.c --- busybox-1.16.1.orig/archival/libipkg/nv_pair_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/nv_pair_list.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/nv_pair_list.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,98 @@ +/* nv_pair_list.c - the itsy package management system + @@ -7439,7 +7439,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair_list.c busybox-1.16.1/arc +} diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair_list.h busybox-1.16.1/archival/libipkg/nv_pair_list.h --- busybox-1.16.1.orig/archival/libipkg/nv_pair_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/nv_pair_list.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/nv_pair_list.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,60 @@ +/* nv_pair_list.h - the itsy package management system + @@ -7503,7 +7503,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/nv_pair_list.h busybox-1.16.1/arc + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg.c busybox-1.16.1/archival/libipkg/pkg.c --- busybox-1.16.1.orig/archival/libipkg/pkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,1757 @@ +/* pkg.c - the itsy package management system + @@ -9264,7 +9264,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg.c busybox-1.16.1/archival/lib +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_depends.c busybox-1.16.1/archival/libipkg/pkg_depends.c --- busybox-1.16.1.orig/archival/libipkg/pkg_depends.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_depends.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_depends.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,1032 @@ +/* pkg_depends.c - the itsy package management system + @@ -10300,7 +10300,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_depends.c busybox-1.16.1/arch +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_depends.h busybox-1.16.1/archival/libipkg/pkg_depends.h --- busybox-1.16.1.orig/archival/libipkg/pkg_depends.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_depends.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_depends.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,105 @@ +/* pkg_depends.h - the itsy package management system + @@ -10409,7 +10409,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_depends.h busybox-1.16.1/arch +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest.c busybox-1.16.1/archival/libipkg/pkg_dest.c --- busybox-1.16.1.orig/archival/libipkg/pkg_dest.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_dest.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_dest.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,92 @@ +/* pkg_dest.c - the itsy package management system + @@ -10505,7 +10505,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest.c busybox-1.16.1/archiva +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest.h busybox-1.16.1/archival/libipkg/pkg_dest.h --- busybox-1.16.1.orig/archival/libipkg/pkg_dest.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_dest.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_dest.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,38 @@ +/* pkg_dest.h - the itsy package management system + @@ -10547,7 +10547,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest.h busybox-1.16.1/archiva + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest_list.c busybox-1.16.1/archival/libipkg/pkg_dest_list.c --- busybox-1.16.1.orig/archival/libipkg/pkg_dest_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_dest_list.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_dest_list.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,85 @@ +/* pkg_dest_list.c - the itsy package management system + @@ -10636,7 +10636,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest_list.c busybox-1.16.1/ar +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest_list.h busybox-1.16.1/archival/libipkg/pkg_dest_list.h --- busybox-1.16.1.orig/archival/libipkg/pkg_dest_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_dest_list.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_dest_list.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,50 @@ +/* pkg_dest_list.h - the itsy package management system + @@ -10690,8 +10690,8 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_dest_list.h busybox-1.16.1/ar + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/archival/libipkg/pkg_extract.c --- busybox-1.16.1.orig/archival/libipkg/pkg_extract.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_extract.c 2010-04-04 13:52:46.000000000 +0200 -@@ -0,0 +1,225 @@ ++++ busybox-1.16.1/archival/libipkg/pkg_extract.c 2010-04-22 19:33:49.000000000 +0200 +@@ -0,0 +1,255 @@ +/* pkg_extract.c - the itsy package management system + + Carl D. Worth @@ -10725,6 +10725,36 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch +#define IPKG_DATA_ARCHIVE "data.tar.gz" +#define IPKG_CONTROL_FILE "control" + ++static void FAST_FUNC ipkg_data_extract_all_prefix(archive_handle_t *archive_handle) ++{ ++ char *name_ptr = archive_handle->file_header->name; ++ ++ /* Skip all leading "/" */ ++ while (*name_ptr == '/') ++ name_ptr++; ++ /* Skip all leading "./" and "../" */ ++ while (name_ptr[0] == '.') { ++ if (name_ptr[1] == '.' && name_ptr[2] == '/') ++ name_ptr++; ++ if (name_ptr[1] != '/') ++ break; ++ name_ptr += 2; ++ } ++ ++ if (name_ptr[0] != '\0') { ++ archive_handle->file_header->name = xasprintf("%s%s", archive_handle->dpkg__buffer, name_ptr); ++ data_extract_all(archive_handle); ++ } ++} ++ ++static void FAST_FUNC ipkg_data_extract_to_buffer(archive_handle_t *archive_handle) ++{ ++ unsigned size = archive_handle->file_header->size; ++ ++ archive_handle->dpkg__buffer = xzalloc(size + 1); ++ xread(archive_handle->src_fd, archive_handle->dpkg__buffer, size); ++} ++ +static void extract_ipkg_file_to_dir(pkg_t *pkg, const char *dir, const char *filename) +{ + archive_handle_t *archive; @@ -10735,9 +10765,9 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch + archive->src_fd = xopen(pkg->local_filename, O_RDONLY); + archive->filter = filter_accept_list; + llist_add_to(&(archive->accept), (char *)filename); -+ archive->buffer = path; -+ archive->action_data = data_extract_all_prefix; -+ archive->ah_flags |= ARCHIVE_EXTRACT_UNCONDITIONAL; ++ archive->dpkg__buffer = path; ++ archive->action_data = ipkg_data_extract_all_prefix; ++ archive->ah_flags |= ARCHIVE_UNLINK_OLD; + while( get_header_tar_gz(archive) == EXIT_SUCCESS ); + close(archive->src_fd); + free(archive->accept); @@ -10749,15 +10779,15 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch +{ + unsigned int size = strlen(archive->file_header->name) + 2; + -+ if (archive->buffer == NULL) { -+ archive->buffer = xmalloc(size); -+ strcpy(archive->buffer, archive->file_header->name); ++ if (archive->dpkg__buffer == NULL) { ++ archive->dpkg__buffer = xmalloc(size); ++ strcpy(archive->dpkg__buffer, archive->file_header->name); + } else { -+ size += strlen(archive->buffer); -+ archive->buffer = xrealloc(archive->buffer, size); -+ strcat(archive->buffer, archive->file_header->name); ++ size += strlen(archive->dpkg__buffer); ++ archive->dpkg__buffer = xrealloc(archive->dpkg__buffer, size); ++ strcat(archive->dpkg__buffer, archive->file_header->name); + } -+ strcat(archive->buffer, "\n"); ++ strcat(archive->dpkg__buffer, "\n"); + data_skip(archive); +} + @@ -10773,11 +10803,11 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch + archive->src_fd = xopen(name, O_RDONLY); + archive->filter = filter_accept_list; + llist_add_to(&(archive->accept), (char *)filename); -+ archive->action_data = data_extract_to_buffer; ++ archive->action_data = ipkg_data_extract_to_buffer; + while( get_header_tar_gz(archive) == EXIT_SUCCESS ); + close(archive->src_fd); -+ fputs(archive->buffer, stream); -+ free(archive->buffer); ++ fputs(archive->dpkg__buffer, stream); ++ free(archive->dpkg__buffer); + free(archive->accept); + free(archive); + free(name); @@ -10802,9 +10832,9 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch + archive = init_handle(); + archive->src_fd = xopen(name, O_RDONLY); + archive->filter = filter_accept_all; -+ archive->buffer = path; -+ archive->action_data = data_extract_all_prefix; -+ archive->ah_flags |= ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL; ++ archive->dpkg__buffer = path; ++ archive->action_data = ipkg_data_extract_all_prefix; ++ archive->ah_flags |= ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_RESTORE_DATE | ARCHIVE_UNLINK_OLD; + while( get_header_tar_gz(archive) == EXIT_SUCCESS ); + close(archive->src_fd); + free(archive); @@ -10826,9 +10856,9 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch + archive = init_handle(); + archive->src_fd = xopen(name, O_RDONLY); + archive->filter = filter_accept_all; -+ archive->buffer = path; -+ archive->action_data = data_extract_all_prefix; -+ archive->ah_flags |= ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL; ++ archive->dpkg__buffer = path; ++ archive->action_data = ipkg_data_extract_all_prefix; ++ archive->ah_flags |= ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_RESTORE_DATE | ARCHIVE_UNLINK_OLD; + while( get_header_tar_gz(archive) == EXIT_SUCCESS ); + close(archive->src_fd); + free(archive); @@ -10910,8 +10940,8 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch + archive->action_data = data_extract_file_name_to_buffer; + while( get_header_tar_gz(archive) == EXIT_SUCCESS ); + close(archive->src_fd); -+ fputs(archive->buffer, file); -+ free(archive->buffer); ++ fputs(archive->dpkg__buffer, file); ++ free(archive->dpkg__buffer); + free(archive); + free(name); + @@ -10919,7 +10949,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.c busybox-1.16.1/arch +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.h busybox-1.16.1/archival/libipkg/pkg_extract.h --- busybox-1.16.1.orig/archival/libipkg/pkg_extract.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_extract.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_extract.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,32 @@ +/* pkg_extract.c - the itsy package management system + @@ -10955,7 +10985,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_extract.h busybox-1.16.1/arch +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg.h busybox-1.16.1/archival/libipkg/pkg.h --- busybox-1.16.1.orig/archival/libipkg/pkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,229 @@ +/* pkg.h - the itsy package management system + @@ -11188,7 +11218,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg.h busybox-1.16.1/archival/lib +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_hash.c busybox-1.16.1/archival/libipkg/pkg_hash.c --- busybox-1.16.1.orig/archival/libipkg/pkg_hash.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_hash.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_hash.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,623 @@ +/* ipkg_hash.c - the itsy package management system + @@ -11815,7 +11845,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_hash.c busybox-1.16.1/archiva + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_hash.h busybox-1.16.1/archival/libipkg/pkg_hash.h --- busybox-1.16.1.orig/archival/libipkg/pkg_hash.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_hash.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_hash.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,61 @@ +/* pkg_hash.h - the itsy package management system + @@ -11880,7 +11910,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_hash.h busybox-1.16.1/archiva + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_parse.c busybox-1.16.1/archival/libipkg/pkg_parse.c --- busybox-1.16.1.orig/archival/libipkg/pkg_parse.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_parse.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_parse.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,368 @@ +/* pkg_parse.c - the itsy package management system + @@ -12252,7 +12282,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_parse.c busybox-1.16.1/archiv +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_parse.h busybox-1.16.1/archival/libipkg/pkg_parse.h --- busybox-1.16.1.orig/archival/libipkg/pkg_parse.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_parse.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_parse.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,31 @@ +/* pkg_parse.h - the itsy package management system + @@ -12287,7 +12317,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_parse.h busybox-1.16.1/archiv +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src.c busybox-1.16.1/archival/libipkg/pkg_src.c --- busybox-1.16.1.orig/archival/libipkg/pkg_src.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_src.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_src.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,43 @@ +/* pkg_src.c - the itsy package management system + @@ -12334,7 +12364,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src.c busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src.h busybox-1.16.1/archival/libipkg/pkg_src.h --- busybox-1.16.1.orig/archival/libipkg/pkg_src.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_src.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_src.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,34 @@ +/* pkg_src.h - the itsy package management system + @@ -12372,7 +12402,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src.h busybox-1.16.1/archival +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src_list.c busybox-1.16.1/archival/libipkg/pkg_src_list.c --- busybox-1.16.1.orig/archival/libipkg/pkg_src_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_src_list.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_src_list.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,75 @@ +/* pkg_src_list.c - the itsy package management system + @@ -12451,7 +12481,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src_list.c busybox-1.16.1/arc +} diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src_list.h busybox-1.16.1/archival/libipkg/pkg_src_list.h --- busybox-1.16.1.orig/archival/libipkg/pkg_src_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_src_list.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_src_list.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,57 @@ +/* pkg_src_list.h - the itsy package management system + @@ -12512,7 +12542,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_src_list.h busybox-1.16.1/arc + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_vec.c busybox-1.16.1/archival/libipkg/pkg_vec.c --- busybox-1.16.1.orig/archival/libipkg/pkg_vec.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_vec.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_vec.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,231 @@ +/* pkg_vec.c - the itsy package management system + @@ -12747,7 +12777,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_vec.c busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_vec.h busybox-1.16.1/archival/libipkg/pkg_vec.h --- busybox-1.16.1.orig/archival/libipkg/pkg_vec.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/pkg_vec.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/pkg_vec.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,62 @@ +/* pkg_vec.h - the itsy package management system + @@ -12813,7 +12843,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/pkg_vec.h busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libipkg/sprintf_alloc.h busybox-1.16.1/archival/libipkg/sprintf_alloc.h --- busybox-1.16.1.orig/archival/libipkg/sprintf_alloc.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/sprintf_alloc.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/sprintf_alloc.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,25 @@ +/* sprintf_alloca.c -- like sprintf with memory allocation + @@ -12842,7 +12872,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/sprintf_alloc.h busybox-1.16.1/ar +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/str_list.c busybox-1.16.1/archival/libipkg/str_list.c --- busybox-1.16.1.orig/archival/libipkg/str_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/str_list.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/str_list.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,76 @@ +/* str_list.c - the itsy package management system + @@ -12922,7 +12952,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/str_list.c busybox-1.16.1/archiva +} diff -Nur busybox-1.16.1.orig/archival/libipkg/str_list.h busybox-1.16.1/archival/libipkg/str_list.h --- busybox-1.16.1.orig/archival/libipkg/str_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/str_list.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/str_list.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,51 @@ +/* str_list.h - the itsy package management system + @@ -12977,7 +13007,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/str_list.h busybox-1.16.1/archiva +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/str_util.c busybox-1.16.1/archival/libipkg/str_util.c --- busybox-1.16.1.orig/archival/libipkg/str_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/str_util.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/str_util.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,69 @@ +/* str_utils.c - the itsy package management system + @@ -13050,7 +13080,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/str_util.c busybox-1.16.1/archiva + diff -Nur busybox-1.16.1.orig/archival/libipkg/str_util.h busybox-1.16.1/archival/libipkg/str_util.h --- busybox-1.16.1.orig/archival/libipkg/str_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/str_util.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/str_util.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,27 @@ +/* str_utils.h - the itsy package management system + @@ -13081,7 +13111,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/str_util.h busybox-1.16.1/archiva +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/user.c busybox-1.16.1/archival/libipkg/user.c --- busybox-1.16.1.orig/archival/libipkg/user.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/user.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/user.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,49 @@ +/* user.c - the itsy package management system + @@ -13134,7 +13164,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/user.c busybox-1.16.1/archival/li +} diff -Nur busybox-1.16.1.orig/archival/libipkg/user.h busybox-1.16.1/archival/libipkg/user.h --- busybox-1.16.1.orig/archival/libipkg/user.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/user.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/user.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,23 @@ +/* user.c - the itsy package management system + @@ -13161,7 +13191,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/user.h busybox-1.16.1/archival/li + diff -Nur busybox-1.16.1.orig/archival/libipkg/void_list.c busybox-1.16.1/archival/libipkg/void_list.c --- busybox-1.16.1.orig/archival/libipkg/void_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/void_list.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/void_list.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,194 @@ +/* void_list.c - the itsy package management system + @@ -13359,7 +13389,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/void_list.c busybox-1.16.1/archiv +} diff -Nur busybox-1.16.1.orig/archival/libipkg/void_list.h busybox-1.16.1/archival/libipkg/void_list.h --- busybox-1.16.1.orig/archival/libipkg/void_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/void_list.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/void_list.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,59 @@ +/* void_list.h - the itsy package management system + @@ -13422,7 +13452,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/void_list.h busybox-1.16.1/archiv +#endif diff -Nur busybox-1.16.1.orig/archival/libipkg/xsystem.c busybox-1.16.1/archival/libipkg/xsystem.c --- busybox-1.16.1.orig/archival/libipkg/xsystem.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/xsystem.c 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/xsystem.c 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,64 @@ +/* xsystem.c - system(3) with error messages + @@ -13490,7 +13520,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/xsystem.c busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libipkg/xsystem.h busybox-1.16.1/archival/libipkg/xsystem.h --- busybox-1.16.1.orig/archival/libipkg/xsystem.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.16.1/archival/libipkg/xsystem.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libipkg/xsystem.h 2010-04-22 19:18:12.000000000 +0200 @@ -0,0 +1,34 @@ +/* xsystem.h - system(3) with error messages + @@ -13528,7 +13558,7 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/xsystem.h busybox-1.16.1/archival + diff -Nur busybox-1.16.1.orig/archival/libunarchive/Kbuild busybox-1.16.1/archival/libunarchive/Kbuild --- busybox-1.16.1.orig/archival/libunarchive/Kbuild 2010-03-20 03:58:07.000000000 +0100 -+++ busybox-1.16.1/archival/libunarchive/Kbuild 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/archival/libunarchive/Kbuild 2010-04-22 19:18:12.000000000 +0200 @@ -40,6 +40,7 @@ lib-$(CONFIG_DPKG) += $(DPKG_FILES) lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) @@ -13539,7 +13569,7 @@ diff -Nur busybox-1.16.1.orig/archival/libunarchive/Kbuild busybox-1.16.1/archiv lib-$(CONFIG_TAR) += get_header_tar.o diff -Nur busybox-1.16.1.orig/include/applets.h busybox-1.16.1/include/applets.h --- busybox-1.16.1.orig/include/applets.h 2010-03-28 19:43:35.000000000 +0200 -+++ busybox-1.16.1/include/applets.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/include/applets.h 2010-04-22 19:18:12.000000000 +0200 @@ -214,6 +214,7 @@ IF_IPCALC(APPLET(ipcalc, _BB_DIR_BIN, _BB_SUID_DROP)) IF_IPCRM(APPLET(ipcrm, _BB_DIR_USR_BIN, _BB_SUID_REQUIRE)) @@ -13548,9 +13578,21 @@ diff -Nur busybox-1.16.1.orig/include/applets.h busybox-1.16.1/include/applets.h IF_IPLINK(APPLET(iplink, _BB_DIR_BIN, _BB_SUID_DROP)) IF_IPROUTE(APPLET(iproute, _BB_DIR_BIN, _BB_SUID_DROP)) IF_IPRULE(APPLET(iprule, _BB_DIR_BIN, _BB_SUID_DROP)) +diff -Nur busybox-1.16.1.orig/include/unarchive.h busybox-1.16.1/include/unarchive.h +--- busybox-1.16.1.orig/include/unarchive.h 2010-03-28 19:43:35.000000000 +0200 ++++ busybox-1.16.1/include/unarchive.h 2010-04-22 19:21:25.000000000 +0200 +@@ -65,7 +65,7 @@ + struct hardlinks_t *cpio__hardlinks_to_create; + struct hardlinks_t *cpio__created_hardlinks; + #endif +-#if ENABLE_DPKG || ENABLE_DPKG_DEB ++#if ENABLE_DPKG || ENABLE_DPKG_DEB || ENABLE_IPKG + /* Temporary storage */ + char *dpkg__buffer; + /* How to process any sub archive, e.g. get_header_tar_gz */ diff -Nur busybox-1.16.1.orig/include/usage.h busybox-1.16.1/include/usage.h --- busybox-1.16.1.orig/include/usage.h 2010-03-28 19:44:04.000000000 +0200 -+++ busybox-1.16.1/include/usage.h 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/include/usage.h 2010-04-22 19:18:12.000000000 +0200 @@ -1592,6 +1592,82 @@ "$ ls -la /tmp/busybox*\n" \ "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n" @@ -13636,7 +13678,7 @@ diff -Nur busybox-1.16.1.orig/include/usage.h busybox-1.16.1/include/usage.h #define halt_full_usage "\n\n" \ diff -Nur busybox-1.16.1.orig/Makefile busybox-1.16.1/Makefile --- busybox-1.16.1.orig/Makefile 2010-03-28 19:44:09.000000000 +0200 -+++ busybox-1.16.1/Makefile 2010-04-04 13:52:46.000000000 +0200 ++++ busybox-1.16.1/Makefile 2010-04-22 19:18:12.000000000 +0200 @@ -454,6 +454,7 @@ libs-y := \ -- cgit v1.2.3 From 34d2b54db29ec5878f98f5f4c5f2a077946f1b93 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 22 Apr 2010 22:46:01 +0200 Subject: sync busybox config --- package/busybox/config/Config.in | 28 +++++--- package/busybox/config/archival/Config.in | 25 +++++-- package/busybox/config/coreutils/Config.in | 52 +++++++++++++-- package/busybox/config/editors/Config.in | 19 ++---- package/busybox/config/findutils/Config.in | 27 +++++--- package/busybox/config/libbb/Config.in | 5 +- package/busybox/config/miscutils/Config.in | 23 +++++-- package/busybox/config/modutils/Config.in | 16 +++++ package/busybox/config/networking/Config.in | 80 ++++++++++++++++++++--- package/busybox/config/networking/udhcp/Config.in | 28 ++++---- package/busybox/config/procps/Config.in | 14 ++-- package/busybox/config/shell/Config.in | 29 ++++---- package/busybox/config/sysklogd/Config.in | 2 +- package/busybox/config/util-linux/Config.in | 44 ++++++++++++- 14 files changed, 289 insertions(+), 103 deletions(-) (limited to 'package') diff --git a/package/busybox/config/Config.in b/package/busybox/config/Config.in index 427a45b4a..3478eaab5 100644 --- a/package/busybox/config/Config.in +++ b/package/busybox/config/Config.in @@ -30,6 +30,23 @@ config BUSYBOX_EXTRA_COMPAT some GNU extensions in libc. You probably only need this option if you plan to run busybox on desktop. +config BUSYBOX_INCLUDE_SUSv2 + bool "Enable obsolete features removed before SUSv3" + default y + help + This option will enable backwards compatibility with SuSv2, + specifically, old-style numeric options ('command -1 ') + will be supported in head, tail, and fold. (Note: should + affect renice too.) + +config BUSYBOX_USE_PORTABLE_CODE + bool "Avoid using GCC-specific code constructs" + default n + help + Use this option if you are trying to compile busybox with + compiler other than gcc. + If you do use gcc, this option may needlessly increase code size. + choice prompt "Buffer allocation policy" default FEATURE_BUFFERS_USE_MALLOC @@ -503,17 +520,8 @@ config BUSYBOX_EFENCE endchoice -config BUSYBOX_INCLUDE_SUSv2 - bool "Enable obsolete features removed before SUSv3?" - default y - help - This option will enable backwards compatibility with SuSv2, - specifically, old-style numeric options ('command -1 ') - will be supported in head, tail, and fold. (Note: should - affect renice too.) - ### config PARSE -### bool "Uniform config file parser debugging applet: parse" +### bool "Uniform config file parser debugging applet: parse" endmenu diff --git a/package/busybox/config/archival/Config.in b/package/busybox/config/archival/Config.in index fa08ebd42..529496780 100644 --- a/package/busybox/config/archival/Config.in +++ b/package/busybox/config/archival/Config.in @@ -92,8 +92,8 @@ config BUSYBOX_BZIP2 config BUSYBOX_CPIO bool "cpio" - depends on !ADK_PACKAGE_CPIO default n + depends on !ADK_PACKAGE_CPIO help cpio is an archival utility program used to create, modify, and extract contents from archives. @@ -168,6 +168,13 @@ config BUSYBOX_GZIP gzip is used to compress files. It's probably the most widely used UNIX compression program. +config BUSYBOX_FEATURE_GZIP_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_GZIP && BUSYBOX_LONG_OPTS + help + Enable use of long options, increases size by about 106 Bytes + config BUSYBOX_LZOP bool "lzop" default n @@ -227,7 +234,7 @@ config BUSYBOX_FEATURE_TAR_CREATE config BUSYBOX_FEATURE_TAR_AUTODETECT bool "Autodetect compressed tarballs" - default n + default y depends on BUSYBOX_FEATURE_SEAMLESS_Z || BUSYBOX_FEATURE_SEAMLESS_GZ || BUSYBOX_FEATURE_SEAMLESS_BZ2 || BUSYBOX_FEATURE_SEAMLESS_LZMA help With this option tar can automatically detect compressed @@ -277,13 +284,21 @@ config BUSYBOX_FEATURE_TAR_LONG_OPTIONS config BUSYBOX_FEATURE_TAR_UNAME_GNAME bool "Enable use of user and group names" - default p + default y depends on BUSYBOX_TAR help Enables use of user and group names in tar. This affects contents listings (-t) and preserving permissions when unpacking (-p). +200 bytes. +config BUSYBOX_FEATURE_TAR_NOPRESERVE_TIME + bool "Enable -m (do not preserve time) option" + default n + depends on BUSYBOX_TAR + help + With this option busybox supports GNU tar -m + (do not preserve time) option. + endif #tar config BUSYBOX_UNCOMPRESS @@ -313,8 +328,8 @@ config BUSYBOX_FEATURE_LZMA_FAST default n depends on BUSYBOX_UNLZMA help - This option reduces decompression time by about 33% at the cost of - a 2K bigger binary. + This option reduces decompression time by about 25% at the cost of + a 1K bigger binary. config BUSYBOX_UNZIP bool "unzip" diff --git a/package/busybox/config/coreutils/Config.in b/package/busybox/config/coreutils/Config.in index d0bebc11f..015c2de5c 100644 --- a/package/busybox/config/coreutils/Config.in +++ b/package/busybox/config/coreutils/Config.in @@ -52,6 +52,13 @@ config BUSYBOX_CHOWN chown is used to change the user and/or group ownership of files. +config BUSYBOX_FEATURE_CHOWN_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CHOWN && BUSYBOX_LONG_OPTS + help + Enable use of long options + config BUSYBOX_CHROOT bool "chroot" default y @@ -78,6 +85,14 @@ config BUSYBOX_CP help cp is used to copy files and directories. +config BUSYBOX_FEATURE_CP_LONG_OPTIONS + bool "Enable long options for cp" + default n + depends on BUSYBOX_CP && BUSYBOX_LONG_OPTS + help + Enable long options for cp. + Also add support for --parents option. + config BUSYBOX_CUT bool "cut" default y @@ -100,6 +115,22 @@ config BUSYBOX_FEATURE_DATE_ISOFMT Enable option (-I) to output an ISO-8601 compliant date/time string. +config BUSYBOX_FEATURE_DATE_COMPAT + bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format" + default y + depends on BUSYBOX_DATE + help + System time can be set by 'date -s DATE' and simply 'date DATE', + but formats of DATE string are different. 'date DATE' accepts + a rather weird MMDDhhmm[[YY]YY][.ss] format with completely + unnatural placement of year between minutes and seconds. + date -s (and other commands like touch -d) use more sensible + formats (for one, ISO format YYYY-MM-DD hh:mm:ss.ssssss). + + With this option off, 'date DATE' is 'date -s DATE' support + the same format. With it on, 'date DATE' additionally supports + MMDDhhmm[[YY]YY][.ss] format. + config BUSYBOX_DD bool "dd" default y @@ -113,13 +144,22 @@ config BUSYBOX_FEATURE_DD_SIGNAL_HANDLING default y depends on BUSYBOX_DD help - sending a SIGUSR1 signal to a running `dd' process makes it + Sending a SIGUSR1 signal to a running `dd' process makes it print to standard error the number of records read and written so far, then to resume copying. $ dd if=/dev/zero of=/dev/null& $ pid=$! kill -USR1 $pid; sleep 1; kill $pid - 10899206+0 records in 10899206+0 records out + 10899206+0 records in + 10899206+0 records out + +config BUSYBOX_FEATURE_DD_THIRD_STATUS_LINE + bool "Enable the third status line upon signal" + default n + depends on BUSYBOX_DD && BUSYBOX_FEATURE_DD_SIGNAL_HANDLING + help + Displays a coreutils-like third status line with transferred bytes, + elapsed time and speed. config BUSYBOX_FEATURE_DD_IBS_OBS bool "Enable ibs, obs and conv options" @@ -505,7 +545,7 @@ config BUSYBOX_FEATURE_RMDIR_LONG_OPTIONS config BUSYBOX_SEQ bool "seq" - default n + default y help print a sequence of numbers @@ -829,13 +869,13 @@ config BUSYBOX_FEATURE_HUMAN_READABLE help Allow df, du, and ls to have human readable output. -comment "Common options for md5sum, sha1sum" - depends on BUSYBOX_MD5SUM || BUSYBOX_SHA1SUM +comment "Common options for md5sum, sha1sum, sha256sum, sha512sum" + depends on BUSYBOX_MD5SUM || BUSYBOX_SHA1SUM || BUSYBOX_SHA256SUM || BUSYBOX_SHA512SUM config BUSYBOX_FEATURE_MD5_SHA1_SUM_CHECK bool "Enable -c, -s and -w options" default n - depends on BUSYBOX_MD5SUM || BUSYBOX_SHA1SUM + depends on BUSYBOX_MD5SUM || BUSYBOX_SHA1SUM || BUSYBOX_SHA256SUM || BUSYBOX_SHA512SUM help Enabling the -c options allows files to be checked against pre-calculated hash values. diff --git a/package/busybox/config/editors/Config.in b/package/busybox/config/editors/Config.in index 2d04fe99b..3ebb16a6f 100644 --- a/package/busybox/config/editors/Config.in +++ b/package/busybox/config/editors/Config.in @@ -36,13 +36,12 @@ config BUSYBOX_DIFF differences between them in a form that can be given to the patch command. -config BUSYBOX_FEATURE_DIFF_BINARY - bool "Enable checks for binary files" - default y - depends on BUSYBOX_DIFF +config BUSYBOX_FEATURE_DIFF_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_DIFF && BUSYBOX_LONG_OPTS help - This option enables support for checking for binary files - before a comparison is carried out. + Enable use of long options. config BUSYBOX_FEATURE_DIFF_DIR bool "Enable directory support" @@ -52,14 +51,6 @@ config BUSYBOX_FEATURE_DIFF_DIR This option enables support for directory and subdirectory comparison. -config BUSYBOX_FEATURE_DIFF_MINIMAL - bool "Enable -d option to find smaller sets of changes" - default n - depends on BUSYBOX_DIFF - help - Enabling this option allows the use of -d to make diff - try hard to find the smallest possible set of changes. - config BUSYBOX_ED bool "ed" default n diff --git a/package/busybox/config/findutils/Config.in b/package/busybox/config/findutils/Config.in index 1a1e0f4d5..e60537448 100644 --- a/package/busybox/config/findutils/Config.in +++ b/package/busybox/config/findutils/Config.in @@ -7,11 +7,19 @@ menu "Finding Utilities" config BUSYBOX_FIND bool "find" - default y depends on !ADK_PACKAGE_FINDUTILS + default y help find is used to search your system to find specified files. +config BUSYBOX_FEATURE_FIND_EMPTY + bool "Enable -empty option matching empty files and directories" + default y + depends on BUSYBOX_FIND + help + Support the 'find -empty' option for searching empty files + and directories. + config BUSYBOX_FEATURE_FIND_PRINT0 bool "Enable -print0: NUL-terminated output" default y @@ -82,14 +90,6 @@ config BUSYBOX_FEATURE_FIND_INUM help Support the 'find -inum' option for searching by inode number. -config BUSYBOX_FEATURE_FIND_EMPTY - bool "Enable -empty option matching empty files and directories" - default y - depends on BUSYBOX_FIND - help - Support the 'find -empty' option for searching empty files - and directories. - config BUSYBOX_FEATURE_FIND_EXEC bool "Enable -exec: execute commands" default y @@ -180,10 +180,17 @@ config BUSYBOX_FEATURE_FIND_CONTEXT help Support the 'find -context' option for matching security context. +config BUSYBOX_FEATURE_FIND_LINKS + bool "Enable -links: link count matching" + default n + depends on BUSYBOX_FIND + help + Support the 'find -links' option for matching number of links. + config BUSYBOX_GREP bool "grep" - default y if !ADK_PACKAGE_GREP depends on !ADK_PACKAGE_GREP + default y help grep is used to search files for a specified pattern. diff --git a/package/busybox/config/libbb/Config.in b/package/busybox/config/libbb/Config.in index 708839b4c..1fc888630 100644 --- a/package/busybox/config/libbb/Config.in +++ b/package/busybox/config/libbb/Config.in @@ -111,7 +111,7 @@ config BUSYBOX_FEATURE_EDITING_ASK_TERMINAL current cursor position. This information is used to make line editing more robust in some cases. If you are not sure whether your terminals respond to this code - correctly, or want to save on code size (about 300 bytes), + correctly, or want to save on code size (about 400 bytes), then do not turn this option on. config BUSYBOX_FEATURE_NON_POSIX_CP @@ -134,9 +134,8 @@ config BUSYBOX_FEATURE_VERBOSE_CP_MESSAGE $ cp file /vmlinuz/file cp: cannot stat '/vmlinuz/file': Path has non-directory component If this feature is not enabled, they will be, respectively: - cp: cannot remove '/does_not_exist/file': No such file or directory + cp: cannot create '/does_not_exist/file': No such file or directory cp: cannot stat '/vmlinuz/file': Not a directory - respectively. This will cost you ~60 bytes. config BUSYBOX_FEATURE_COPYBUF_KB diff --git a/package/busybox/config/miscutils/Config.in b/package/busybox/config/miscutils/Config.in index 8346391a9..e28539204 100644 --- a/package/busybox/config/miscutils/Config.in +++ b/package/busybox/config/miscutils/Config.in @@ -137,11 +137,11 @@ config BUSYBOX_FEATURE_CROND_D -d sets loglevel to 0 (most verbose) and directs all output to stderr. config BUSYBOX_FEATURE_CROND_CALL_SENDMAIL - bool "Using /usr/sbin/sendmail?" + bool "Report command output via email (using sendmail)" default n depends on BUSYBOX_CROND help - Support calling /usr/sbin/sendmail for send cmd outputs. + Command output will be sent to corresponding user via email. config BUSYBOX_FEATURE_CROND_DIR string "crond spool directory" @@ -272,6 +272,13 @@ config BUSYBOX_FBSPLASH "NN" (ASCII decimal number) - percentage to show on progress bar "exit" - well you guessed it +config BUSYBOX_FLASHCP + bool "flashcp" + default n + help + The flashcp binary, inspired by mtd-utils as of git head 5eceb74f7. + This utility is used to copy images into a MTD device. + config BUSYBOX_FLASH_LOCK bool "flash_lock" default n @@ -334,8 +341,8 @@ endchoice config BUSYBOX_LESS bool "less" - default y depends on !ADK_PACKAGE_LESS + default y help 'less' is a pager, meaning that it displays text files. It possesses a wide array of features, and is an improvement over 'more'. @@ -347,7 +354,7 @@ config BUSYBOX_FEATURE_LESS_MAXLINES config BUSYBOX_FEATURE_LESS_BRACKETS bool "Enable bracket searching" - default n + default y depends on BUSYBOX_LESS help This option adds the capability to search for matching left and right @@ -355,7 +362,7 @@ config BUSYBOX_FEATURE_LESS_BRACKETS config BUSYBOX_FEATURE_LESS_FLAGS bool "Enable extra flags" - default n + default y depends on BUSYBOX_LESS help The extra flags provided do the following: @@ -614,6 +621,12 @@ config BUSYBOX_VOLNAME help Prints a CD-ROM volume name. +config BUSYBOX_WALL + bool "wall" + default n + help + Write a message to all users that are logged in. + config BUSYBOX_WATCHDOG bool "watchdog" depends on !ADK_PACKAGE_WATCHDOG diff --git a/package/busybox/config/modutils/Config.in b/package/busybox/config/modutils/Config.in index 82500e18a..2e23c7b84 100644 --- a/package/busybox/config/modutils/Config.in +++ b/package/busybox/config/modutils/Config.in @@ -121,6 +121,22 @@ config BUSYBOX_FEATURE_2_4_MODULES This increases size considerably. Say N unless you plan to run ancient kernels. +config BUSYBOX_FEATURE_INSMOD_TRY_MMAP + bool "Try to load module from a mmap'ed area" + default n + depends on BUSYBOX_INSMOD || BUSYBOX_MODPROBE_SMALL + help + This option causes module loading code to try to mmap + module first. If it does not work (for example, + it does not work for compressed modules), module will be read + (and unpacked if needed) into a memory block allocated by malloc. + + The only case when mmap works but malloc does not is when + you are trying to load a big module on a very memory-constrained + machine. Malloc will momentarily need 2x as much memory as mmap. + + Choosing N saves about 250 bytes of code (on 32-bit x86). + config BUSYBOX_FEATURE_INSMOD_VERSION_CHECKING bool "Enable module version checking" default n diff --git a/package/busybox/config/networking/Config.in b/package/busybox/config/networking/Config.in index 20c583388..2e0bfd36f 100644 --- a/package/busybox/config/networking/Config.in +++ b/package/busybox/config/networking/Config.in @@ -93,8 +93,8 @@ config BUSYBOX_DNSD config BUSYBOX_ETHER_WAKE bool "ether-wake" - default n depends on !ADK_PACKAGE_ETHER_WAKE + default n help Send a magic packet to wake up sleeping machines. @@ -119,6 +119,17 @@ config BUSYBOX_FEATURE_FTP_WRITE help Enable all kinds of FTP upload commands (-w option) +config BUSYBOX_FEATURE_FTPD_ACCEPT_BROKEN_LIST + bool "Enable workaround for RFC-violating clients" + default y + depends on BUSYBOX_FTPD + help + Some ftp-clients (among them KDE's Konqueror) issue illegal + "LIST -la" requests. This option works around those problems. + It might prevent you from listing files starting with "-" and + it increases the code size by ~40 bytes. + Most other ftp servers seem to behave similar to this. + config BUSYBOX_FTPGET bool "ftpget" default n @@ -411,7 +422,7 @@ config BUSYBOX_FEATURE_IFUPDOWN_MAPPING config BUSYBOX_FEATURE_IFUPDOWN_EXTERNAL_DHCP bool "Support for external dhcp clients" - default n + default y depends on BUSYBOX_IFUPDOWN help This enables support for the external dhcp clients. Clients are @@ -652,7 +663,7 @@ config BUSYBOX_FEATURE_NETSTAT_WIDE config BUSYBOX_FEATURE_NETSTAT_PRG bool "Enable PID/Program name output" - default n + default y depends on BUSYBOX_NETSTAT help Add support for -p flag to print out PID and program name. @@ -664,6 +675,20 @@ config BUSYBOX_NSLOOKUP help nslookup is a tool to query Internet name servers. +config BUSYBOX_NTPD + bool "ntpd" + default n + help + The NTP client/server daemon. + +config BUSYBOX_FEATURE_NTPD_SERVER + bool "Make ntpd usable as a NTP server" + default y + depends on BUSYBOX_NTPD + help + Make ntpd usable as a NTP server. If you disable this option + ntpd will be usable only as a NTP client. + config BUSYBOX_PING bool "ping" default y @@ -717,7 +742,7 @@ config BUSYBOX_SLATTACH config BUSYBOX_TELNET bool "telnet" - default n + default y help Telnet is an interface to the TELNET protocol, but is also commonly used to test other simple protocols. @@ -791,6 +816,27 @@ config BUSYBOX_FEATURE_TELNETD_STANDALONE help Selecting this will make telnetd able to run standalone. +config BUSYBOX_FEATURE_TELNETD_INETD_WAIT + bool "Support -w SEC option (inetd wait mode)" + default n + depends on BUSYBOX_FEATURE_TELNETD_STANDALONE + help + This option allows you to run telnetd in "inet wait" mode. + Example inetd.conf line (note "wait", not usual "nowait"): + + telnet stream tcp wait root /bin/telnetd telnetd -w10 + + In this example, inetd passes _listening_ socket_ as fd 0 + to telnetd when connection appears. + telnetd will wait for connections until all existing + connections are closed, and no new connections + appear during 10 seconds. Then it exits, and inetd continues + to listen for new connections. + + This option is rarely used. "tcp nowait" is much more usual + way of running tcp services, including telnetd. + You most probably want to say N here. + config BUSYBOX_TFTP bool "tftp" default n @@ -828,12 +874,19 @@ config BUSYBOX_FEATURE_TFTP_PUT Also enable download support in tftpd, if tftpd is selected. config BUSYBOX_FEATURE_TFTP_BLOCKSIZE - bool "Enable \"blksize\" protocol option" + bool "Enable 'blksize' and 'tsize' protocol options" default n depends on BUSYBOX_TFTP || BUSYBOX_TFTPD help Allow tftp to specify block size, and tftpd to understand - "blksize" option. + "blksize" and "tsize" options. + +config BUSYBOX_FEATURE_TFTP_PROGRESS_BAR + bool "Enable tftp progress meter" + default n + depends on BUSYBOX_TFTP && BUSYBOX_FEATURE_TFTP_BLOCKSIZE + help + Show progress bar. config BUSYBOX_TFTP_DEBUG bool "Enable debug" @@ -845,10 +898,17 @@ config BUSYBOX_TFTP_DEBUG config BUSYBOX_TRACEROUTE bool "traceroute" - default n + default y help Utility to trace the route of IP packets. +config BUSYBOX_TRACEROUTE6 + bool "traceroute6" + default y + depends on BUSYBOX_FEATURE_IPV6 && BUSYBOX_TRACEROUTE + help + Utility to trace the route of IPv6 packets. + config BUSYBOX_FEATURE_TRACEROUTE_VERBOSE bool "Enable verbose output" default n @@ -867,7 +927,7 @@ config BUSYBOX_FEATURE_TRACEROUTE_SOURCE_ROUTE config BUSYBOX_FEATURE_TRACEROUTE_USE_ICMP bool "Use ICMP instead of UDP" - default n + default y depends on BUSYBOX_TRACEROUTE help Add option -I to use ICMP ECHO instead of UDP datagrams. @@ -877,7 +937,7 @@ source package/busybox/config/networking/udhcp/Config.in config BUSYBOX_IFUPDOWN_UDHCPC_CMD_OPTIONS string "ifup udhcpc command line options" default "-b -R" - depends on BUSYBOX_IFUPDOWN && BUSYBOX_APP_UDHCPC + depends on BUSYBOX_IFUPDOWN && BUSYBOX_UDHCPC help Command line options to pass to udhcpc from ifup. Intended to alter options not available in /etc/network/interfaces. @@ -892,8 +952,8 @@ config BUSYBOX_VCONFIG config BUSYBOX_WGET bool "wget" - default y depends on !ADK_PACKAGE_WGET + default y help wget is a utility for non-interactive download of files from HTTP, HTTPS, and FTP servers. diff --git a/package/busybox/config/networking/udhcp/Config.in b/package/busybox/config/networking/udhcp/Config.in index 05b9ffb67..5b2586f66 100644 --- a/package/busybox/config/networking/udhcp/Config.in +++ b/package/busybox/config/networking/udhcp/Config.in @@ -3,26 +3,26 @@ # see scripts/kbuild/config-language.txt. # -config BUSYBOX_APP_UDHCPD +config BUSYBOX_UDHCPD bool "udhcp server (udhcpd)" default n help udhcpd is a DHCP server geared primarily toward embedded systems, while striving to be fully functional and RFC compliant. -config BUSYBOX_APP_DHCPRELAY +config BUSYBOX_DHCPRELAY bool "dhcprelay" default n - depends on BUSYBOX_APP_UDHCPD + depends on BUSYBOX_UDHCPD help dhcprelay listens for dhcp requests on one or more interfaces and forwards these requests to a different interface or dhcp server. -config BUSYBOX_APP_DUMPLEASES +config BUSYBOX_DUMPLEASES bool "Lease display utility (dumpleases)" default n - depends on BUSYBOX_APP_UDHCPD + depends on BUSYBOX_UDHCPD help dumpleases displays the leases written out by the udhcpd server. Lease times are stored in the file by time remaining in lease, or @@ -31,7 +31,7 @@ config BUSYBOX_APP_DUMPLEASES config BUSYBOX_FEATURE_UDHCPD_WRITE_LEASES_EARLY bool "Rewrite the lease file at every new acknowledge" default n - depends on BUSYBOX_APP_UDHCPD + depends on BUSYBOX_UDHCPD help If selected, udhcpd will write a new file with leases every time a new lease has been accepted, thus eliminating the need @@ -41,12 +41,12 @@ config BUSYBOX_FEATURE_UDHCPD_WRITE_LEASES_EARLY config BUSYBOX_DHCPD_LEASES_FILE string "Absolute path to lease file" default "/var/lib/misc/udhcpd.leases" - depends on BUSYBOX_APP_UDHCPD + depends on BUSYBOX_UDHCPD help udhcpd stores addresses in a lease file. This is the absolute path of the file. Normally it is safe to leave it untouched. -config BUSYBOX_APP_UDHCPC +config BUSYBOX_UDHCPC bool "udhcp client (udhcpc)" default y help @@ -59,7 +59,7 @@ config BUSYBOX_APP_UDHCPC config BUSYBOX_FEATURE_UDHCPC_ARPING bool "Verify that the offered address is free, using ARP ping" default y - depends on BUSYBOX_APP_UDHCPC + depends on BUSYBOX_UDHCPC help If selected, udhcpc will send ARP probes and make sure the offered address is really not in use by anyone. The client @@ -69,7 +69,7 @@ config BUSYBOX_FEATURE_UDHCPC_ARPING config BUSYBOX_FEATURE_UDHCP_PORT bool "Enable '-P port' option for udhcpd and udhcpc" default n - depends on BUSYBOX_APP_UDHCPD || BUSYBOX_APP_UDHCPC + depends on BUSYBOX_UDHCPD || BUSYBOX_UDHCPC help At the cost of ~300 bytes, enables -P port option. This feature is typically not needed. @@ -78,7 +78,7 @@ config BUSYBOX_UDHCP_DEBUG int "Maximum verbosity level for udhcp applets (0..9)" default 0 range 0 9 - depends on BUSYBOX_APP_UDHCPD || BUSYBOX_APP_UDHCPC || BUSYBOX_APP_DHCPRELAY + depends on BUSYBOX_UDHCPD || BUSYBOX_UDHCPC || BUSYBOX_DHCPRELAY help Verbosity can be increased with multiple -v options. This options controls how high it can be cranked up. @@ -89,7 +89,7 @@ config BUSYBOX_UDHCP_DEBUG config BUSYBOX_FEATURE_UDHCP_RFC3397 bool "Support for RFC3397 domain search (experimental)" default n - depends on BUSYBOX_APP_UDHCPD || BUSYBOX_APP_UDHCPC + depends on BUSYBOX_UDHCPD || BUSYBOX_UDHCPC help If selected, both client and server will support passing of domain search lists via option 119, specified in RFC3397. @@ -97,7 +97,7 @@ config BUSYBOX_FEATURE_UDHCP_RFC3397 config BUSYBOX_UDHCPC_DEFAULT_SCRIPT string "Absolute path to config script" default "/usr/share/udhcpc/default.script" - depends on BUSYBOX_APP_UDHCPC + depends on BUSYBOX_UDHCPC help This script is called after udhcpc receives an answer. See examples/udhcp for a working example. Normally it is safe @@ -107,7 +107,7 @@ config BUSYBOX_UDHCPC_SLACK_FOR_BUGGY_SERVERS int "DHCP options slack buffer size" default 80 range 0 924 - depends on BUSYBOX_APP_UDHCPD || BUSYBOX_APP_UDHCPC + depends on BUSYBOX_UDHCPD || BUSYBOX_UDHCPC help Some buggy DHCP servers send DHCP offer packets with option field larger than we expect (which might also be considered a diff --git a/package/busybox/config/procps/Config.in b/package/busybox/config/procps/Config.in index c0c600b4e..ec2c8cfaa 100644 --- a/package/busybox/config/procps/Config.in +++ b/package/busybox/config/procps/Config.in @@ -57,21 +57,21 @@ config BUSYBOX_PGREP config BUSYBOX_PIDOF bool "pidof" - default y + default n help Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. config BUSYBOX_FEATURE_PIDOF_SINGLE bool "Enable argument for single shot (-s)" - default y + default n depends on BUSYBOX_PIDOF help Support argument '-s' for returning only the first pid found. config BUSYBOX_FEATURE_PIDOF_OMIT bool "Enable argument for omitting pids (-o)" - default y + default n depends on BUSYBOX_PIDOF help Support argument '-o' for omitting the given pids in output. @@ -188,6 +188,13 @@ config BUSYBOX_FEATURE_TOPMEM help Enable 's' in top (gives lots of memory info). +config BUSYBOX_FEATURE_SHOW_THREADS + bool "Support for showing threads in ps/top" + default y + depends on BUSYBOX_PS || BUSYBOX_TOP + help + Enables ps -T option and 'h' command in top + config BUSYBOX_UPTIME bool "uptime" default y @@ -203,5 +210,4 @@ config BUSYBOX_WATCH watch is used to execute a program periodically, showing output to the screen. - endmenu diff --git a/package/busybox/config/shell/Config.in b/package/busybox/config/shell/Config.in index 82718cd1a..30ed639c2 100644 --- a/package/busybox/config/shell/Config.in +++ b/package/busybox/config/shell/Config.in @@ -15,6 +15,7 @@ choice config BUSYBOX_FEATURE_SH_IS_ASH select BUSYBOX_ASH bool "ash" + depends on !BUSYBOX_NOMMU config BUSYBOX_FEATURE_SH_IS_HUSH select BUSYBOX_HUSH @@ -36,6 +37,7 @@ endchoice config BUSYBOX_ASH bool "ash" default y + depends on !BUSYBOX_NOMMU help Tha 'ash' shell adds about 60k in the default configuration and is the most complete and most pedantically correct shell included with @@ -57,23 +59,6 @@ config BUSYBOX_ASH_JOB_CONTROL help Enable job control in the ash shell. -config BUSYBOX_ASH_READ_NCHARS - bool "'read -n N' and 'read -s' support" - default n - depends on BUSYBOX_ASH - help - 'read -n N' will return a value after N characters have been read. - 'read -s' will read without echoing the user's input. - -config BUSYBOX_ASH_READ_TIMEOUT - bool "'read -t S' support" - default n - depends on BUSYBOX_ASH - help - 'read -t S' will return a value after S seconds have passed. - This implementation will allow fractional seconds, expressed - as a decimal fraction, e.g. 'read -t 2.5 foo'. - config BUSYBOX_ASH_ALIAS bool "alias support" default y @@ -187,7 +172,7 @@ config BUSYBOX_HUSH_INTERACTIVE help Enable interactive mode (prompt and command editing). Without this, hush simply reads and executes commands - from stdin just like a shell script from the file. + from stdin just like a shell script from a file. No prompt, no PS1/PS2 magic shell variables. config BUSYBOX_HUSH_JOB @@ -250,6 +235,14 @@ config BUSYBOX_HUSH_EXPORT_N help Enable support for export '-n' option in hush. It is a bash extension. +config BUSYBOX_HUSH_RANDOM_SUPPORT + bool "Pseudorandom generator and $RANDOM variable" + default n + depends on BUSYBOX_HUSH + help + Enable pseudorandom generator and dynamic variable "$RANDOM". + Each read of "$RANDOM" will generate a new pseudorandom value. + config BUSYBOX_LASH bool "lash (deprecated: aliased to hush)" default n diff --git a/package/busybox/config/sysklogd/Config.in b/package/busybox/config/sysklogd/Config.in index 0df67053c..6bc26d977 100644 --- a/package/busybox/config/sysklogd/Config.in +++ b/package/busybox/config/sysklogd/Config.in @@ -66,7 +66,7 @@ config BUSYBOX_FEATURE_IPC_SYSLOG config BUSYBOX_FEATURE_IPC_SYSLOG_BUFFER_SIZE int "Circular buffer size in Kbytes (minimum 4KB)" - default 16 + default 32 range 4 2147483647 depends on BUSYBOX_FEATURE_IPC_SYSLOG help diff --git a/package/busybox/config/util-linux/Config.in b/package/busybox/config/util-linux/Config.in index 5951e8dec..d4be6854b 100644 --- a/package/busybox/config/util-linux/Config.in +++ b/package/busybox/config/util-linux/Config.in @@ -213,6 +213,12 @@ config BUSYBOX_FSCK_MINIX check for and attempt to repair any corruption that occurs to a minix filesystem. +config BUSYBOX_MKFS_EXT2 + bool "mkfs_ext2" + default n + help + Utility to create EXT2 filesystems. + config BUSYBOX_MKFS_MINIX bool "mkfs_minix" default n @@ -233,6 +239,12 @@ config BUSYBOX_FEATURE_MINIX2 this. If you enabled 'mkfs_minix' then you almost certainly want to be using the version 2 filesystem support. +config BUSYBOX_MKFS_REISER + bool "mkfs_reiser" + default n + help + Utility to create ReiserFS filesystems. + config BUSYBOX_MKFS_VFAT bool "mkfs_vfat" default n @@ -259,7 +271,7 @@ config BUSYBOX_FEATURE_GETOPT_LONG config BUSYBOX_HEXDUMP bool "hexdump" - default n + default y help The hexdump utility is used to display binary data in a readable way that is comparable to the output from most hex editors. @@ -337,6 +349,24 @@ config BUSYBOX_LOSETUP file or block device, and to query the status of a loop device. This version does not currently support enabling data encryption. +config BUSYBOX_LSPCI + bool "lspci" + default n + help + lspci is a utility for displaying information about PCI buses in the + system and devices connected to them. + + This version uses sysfs (/sys/bus/pci/devices) only. + +config BUSYBOX_LSUSB + bool "lsusb" + default n + help + lsusb is a utility for displaying information about USB buses in the + system and devices connected to them. + + This version uses sysfs (/sys/bus/usb/devices) only. + config BUSYBOX_MDEV bool "mdev" default y @@ -446,6 +476,13 @@ config BUSYBOX_FEATURE_VOLUMEID_EXT help TODO +config BUSYBOX_FEATURE_VOLUMEID_BTRFS + bool "btrfs filesystem" + default n + depends on BUSYBOX_VOLUMEID + help + TODO + config BUSYBOX_FEATURE_VOLUMEID_REISERFS bool "Reiser filesystem" default n @@ -684,12 +721,13 @@ config BUSYBOX_FEATURE_MOUNT_HELPERS config BUSYBOX_FEATURE_MOUNT_LABEL bool "Support specifiying devices by label or UUID" - default n + default y depends on BUSYBOX_MOUNT select BUSYBOX_VOLUMEID help This allows for specifying a device by label or uuid, rather than by name. This feature utilizes the same functionality as blkid/findfs. + This also enables label or uuid support for swapon. config BUSYBOX_FEATURE_MOUNT_NFS bool "Support mounting NFS file systems" @@ -738,7 +776,7 @@ config BUSYBOX_PIVOT_ROOT config BUSYBOX_RDATE bool "rdate" - default n + default y help The rdate utility allows you to synchronize the date and time of your system clock with the date and time of a remote networked system using -- cgit v1.2.3 From 912809660534c8e2b7aa825d7056f1cfd1b0f96d Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 23 Apr 2010 19:04:52 +0200 Subject: fix subpackage creation --- package/krb5/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'package') diff --git a/package/krb5/Makefile b/package/krb5/Makefile index 533e50c39..6b553f35f 100644 --- a/package/krb5/Makefile +++ b/package/krb5/Makefile @@ -25,6 +25,10 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,KRB5_SERVER,krb5-server,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBKRB5,libkrb5,$(PKG_VERSION)-${PKG_RELEASE},,${PKG_DESCR_LIB},${PKG_SECTION_LIB})) +SUB_INSTALLS-y:= +SUB_INSTALLS-m:= +SUB_INSTALLS-${ADK_PACKAGE_LIBKRB5}+= libkrb5-install + TCFLAGS+= -I${STAGING_DIR}/usr/include/et CONFIGURE_ARGS+= --disable-static \ --disable-profiled \ @@ -40,7 +44,7 @@ CONFIGURE_ENV+= krb5_cv_attr_constructor_destructor=yes,yes \ post-extract: (cd ${WRKDIR}; tar xzf ${PKG_NAME}-${PKG_VERSION}.tar.gz) -post-install: +post-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ${INSTALL_DIR} ${IDIR_KRB5_SERVER}/etc ${INSTALL_DIR} ${IDIR_KRB5_SERVER}/etc/krb5kdc ${INSTALL_DIR} ${IDIR_KRB5_SERVER}/usr/sbin @@ -55,12 +59,14 @@ post-install: ${IDIR_KRB5_SERVER}/usr/lib/krb5/plugins/kdb ${CP} ${WRKINST}/usr/lib/lib{gssrpc,kadm5clnt,kadm5srv,kdb5}.so* \ ${IDIR_KRB5_SERVER}/usr/lib - # krb5-libs + +libkrb5-install: ${INSTALL_DIR} ${IDIR_LIBKRB5}/etc ${INSTALL_DIR} ${IDIR_LIBKRB5}/usr/lib ${INSTALL_DATA} ./files/krb5.conf ${IDIR_LIBKRB5}/etc ${CP} ${WRKINST}/usr/lib/lib{gssapi_krb5,k5crypto,krb5,krb5support}.so* \ ${IDIR_LIBKRB5}/usr/lib - echo '/usr/lib/libgssapi_krb5.so mechglue_internal_krb5_init' > ${IDIR_LIBKRB5}/etc/gssapi_mech.conf + echo '/usr/lib/libgssapi_krb5.so mechglue_internal_krb5_init' \ + > ${IDIR_LIBKRB5}/etc/gssapi_mech.conf include ${TOPDIR}/mk/pkg-bottom.mk -- cgit v1.2.3 From 7d19f814d203ae823d8dcaabbf411e26a99602a1 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 23 Apr 2010 19:05:04 +0200 Subject: remove unused comment --- package/zlib/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'package') diff --git a/package/zlib/Makefile b/package/zlib/Makefile index 64a47e4df..e58fadffd 100644 --- a/package/zlib/Makefile +++ b/package/zlib/Makefile @@ -38,7 +38,6 @@ ifeq ($(ADK_STATIC),) CONFIGURE_OPTS:= --shared endif -#--includedir=$(STAGING_DIR)/usr/include do-configure: (cd $(WRKBUILD); $(COPTS) \ CFLAGS="$(TARGET_CFLAGS) -fPIC" \ -- cgit v1.2.3 From 7c930f499fb6f007deec8235d99bdbd31d6e1255 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 23 Apr 2010 20:11:49 +0200 Subject: fix cfgfs status with latest busybox sort --- package/cfgfs/Makefile | 2 +- package/cfgfs/src/fwcf.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'package') diff --git a/package/cfgfs/Makefile b/package/cfgfs/Makefile index 6d8b0554f..1b9897807 100644 --- a/package/cfgfs/Makefile +++ b/package/cfgfs/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= cfgfs PKG_VERSION:= 1.0.7 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_DESCR:= compressed config filesystem PKG_SECTION:= base diff --git a/package/cfgfs/src/fwcf.sh b/package/cfgfs/src/fwcf.sh index e921dfbdf..ea07ff247 100644 --- a/package/cfgfs/src/fwcf.sh +++ b/package/cfgfs/src/fwcf.sh @@ -328,6 +328,8 @@ if test $1 = status; then echo " $name" >>$f done # this implementation of sort -o sucks: doesn't do in-place edits + # workaround a busybox bug? + touch sold_status snew_status sort -k2 -o sold_status $f sort -k2 -o snew_status cur_status gotany=0 -- cgit v1.2.3 From 2a9da8f27abee2f79e4921900633e876e674fa01 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 25 Apr 2010 02:56:13 +0200 Subject: add startup script --- package/igmpproxy/Makefile | 2 +- package/igmpproxy/files/igmpproxy.conffiles | 1 + package/igmpproxy/files/igmpproxy.init | 26 ++++++++++++++++++++++++++ package/igmpproxy/files/igmpproxy.postinst | 3 +++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 package/igmpproxy/files/igmpproxy.conffiles create mode 100644 package/igmpproxy/files/igmpproxy.init create mode 100644 package/igmpproxy/files/igmpproxy.postinst (limited to 'package') diff --git a/package/igmpproxy/Makefile b/package/igmpproxy/Makefile index 567b1c12f..185597939 100644 --- a/package/igmpproxy/Makefile +++ b/package/igmpproxy/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= igmpproxy PKG_VERSION:= 0.1 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= c56f41ec195bc1fe016369bf74efc5a1 PKG_DESCR:= a simple dynamic Multicast Routing Daemon PKG_SECTION:= net diff --git a/package/igmpproxy/files/igmpproxy.conffiles b/package/igmpproxy/files/igmpproxy.conffiles new file mode 100644 index 000000000..dc47ad317 --- /dev/null +++ b/package/igmpproxy/files/igmpproxy.conffiles @@ -0,0 +1 @@ +/etc/igmpproxy.conf diff --git a/package/igmpproxy/files/igmpproxy.init b/package/igmpproxy/files/igmpproxy.init new file mode 100644 index 000000000..807ffc038 --- /dev/null +++ b/package/igmpproxy/files/igmpproxy.init @@ -0,0 +1,26 @@ +#!/bin/sh +#PKG igmpproxy +#INIT 70 +. /etc/rc.conf + +case $1 in +autostop) ;; +autostart) + test x"${igmpproxy:-NO}" = x"NO" + exec sh $0 start + ;; +start) + /usr/sbin/igmpproxy /etc/igmpproxy.conf + ;; +stop) + pkill igmpproxy + ;; +restart) + sh $0 stop + sh $0 start + ;; +*) + echo "Usage: $0 {start | stop | restart}" + ;; +esac +exit $? diff --git a/package/igmpproxy/files/igmpproxy.postinst b/package/igmpproxy/files/igmpproxy.postinst new file mode 100644 index 000000000..5ebfa6d66 --- /dev/null +++ b/package/igmpproxy/files/igmpproxy.postinst @@ -0,0 +1,3 @@ +#!/bin/sh +. $IPKG_INSTROOT/etc/functions.sh +add_rcconf igmpproxy igmpproxy NO -- cgit v1.2.3 From 201380b2d06fef0ede1fd9777b7874950c220a2a Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 25 Apr 2010 03:14:04 +0200 Subject: need to put igmpproxy in the background --- package/igmpproxy/files/igmpproxy.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package') diff --git a/package/igmpproxy/files/igmpproxy.init b/package/igmpproxy/files/igmpproxy.init index 807ffc038..601538f04 100644 --- a/package/igmpproxy/files/igmpproxy.init +++ b/package/igmpproxy/files/igmpproxy.init @@ -10,7 +10,7 @@ autostart) exec sh $0 start ;; start) - /usr/sbin/igmpproxy /etc/igmpproxy.conf + /usr/sbin/igmpproxy /etc/igmpproxy.conf & ;; stop) pkill igmpproxy -- cgit v1.2.3 From 4b2636bd2aea3aa4f5844083a1de0e9283f31a7a Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 25 Apr 2010 14:30:28 +0200 Subject: use latest version of rtsp as a package, instead of kernel patch --- package/rtsp/Makefile | 38 +++ package/rtsp/src/Makefile | 24 ++ package/rtsp/src/README.rst | 40 +++ package/rtsp/src/netfilter_helpers.h | 133 +++++++++ package/rtsp/src/netfilter_mime.h | 89 ++++++ package/rtsp/src/nf_conntrack_rtsp.c | 519 +++++++++++++++++++++++++++++++++++ package/rtsp/src/nf_conntrack_rtsp.h | 63 +++++ package/rtsp/src/nf_nat_rtsp.c | 489 +++++++++++++++++++++++++++++++++ 8 files changed, 1395 insertions(+) create mode 100644 package/rtsp/Makefile create mode 100644 package/rtsp/src/Makefile create mode 100644 package/rtsp/src/README.rst create mode 100644 package/rtsp/src/netfilter_helpers.h create mode 100644 package/rtsp/src/netfilter_mime.h create mode 100644 package/rtsp/src/nf_conntrack_rtsp.c create mode 100644 package/rtsp/src/nf_conntrack_rtsp.h create mode 100644 package/rtsp/src/nf_nat_rtsp.c (limited to 'package') diff --git a/package/rtsp/Makefile b/package/rtsp/Makefile new file mode 100644 index 000000000..c28467b9b --- /dev/null +++ b/package/rtsp/Makefile @@ -0,0 +1,38 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= rtsp +PKG_VERSION:= 1.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 92bb09883dd8a77ec5cfbff1c8932b15 +PKG_DESCR:= Netfilter connection tracking for RTSP +PKG_SECTION:= net +PKG_URL:= http://github.com/maru-sama/rtsp-linux-v2.6 + +NO_DISTFILES:= 1 + +include ${TOPDIR}/mk/package.mk + +$(eval $(call PKG_template,KMOD_RTSP,kmod-rtsp,${KERNEL_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKG_DESCR},${PKG_SECTION})) + +CONFIG_STYLE:= manual +BUILD_STYLE:= manual +INSTALL_STYLE:= manual + +pre-build: + V=1 ARCH=${ARCH} KERNELDIR=${LINUX_DIR} \ + PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \ + LD=$(TARGET_CROSS)gcc LDFLAGS="" \ + $(MAKE) -C ${WRKBUILD} debug + +do-install: + ${INSTALL_DIR} ${IDIR_KMOD_RTSP}/etc/modules.d/ + echo "nf_conntrack_rtsp" > ${IDIR_KMOD_RTSP}/etc/modules.d/60-nf-nat-rtsp + echo "nf_nat_rtsp" >> ${IDIR_KMOD_RTSP}/etc/modules.d/60-nf-nat-rtsp + ${INSTALL_DIR} ${IDIR_KMOD_RTSP}/lib/modules/${KERNEL_VERSION}/ + ${INSTALL_DATA} ${WRKBUILD}/*.ko \ + ${IDIR_KMOD_RTSP}/lib/modules/${KERNEL_VERSION} + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/rtsp/src/Makefile b/package/rtsp/src/Makefile new file mode 100644 index 000000000..d7be5bab8 --- /dev/null +++ b/package/rtsp/src/Makefile @@ -0,0 +1,24 @@ +ifneq ($(KERNELRELEASE),) +# kbuild part of makefile +ifndef CONFIG_NF_CONNTRACK +$(error ** You need to enable NF_CONNTRACK in your kernel **) +endif + +obj-m := nf_conntrack_rtsp.o nf_nat_rtsp.o +else + +# Normal Makefile + +all: + $(MAKE) -C $(KERNELDIR) M=`pwd` modules + +debug: + $(MAKE) -C $(KERNELDIR) EXTRA_CFLAGS=-DDEBUG M=`pwd` modules + +modules_install: + $(MAKE) -C $(KERNELDIR) M=`pwd` modules_install + +clean: + rm -rf *.o *.ko *.mod.c .*.cmd Module.symvers modules.order .tmp_versions + +endif diff --git a/package/rtsp/src/README.rst b/package/rtsp/src/README.rst new file mode 100644 index 000000000..dd20fe072 --- /dev/null +++ b/package/rtsp/src/README.rst @@ -0,0 +1,40 @@ +Disclaimer: +=========== + +This software is provided as is. I take no responsibility if it destroys your +data or opens up a security hole on your firewall. That said, I have yet to +hear something about this happening. + +I did not create this code myself, most was written by Tom Marshall, later on +Harald Welte and then Steven van Acker ported it to the new 2.6 netfilter API. +I just picked up this code in 2007 and made it compile and hopefully work with +the new changed netfilter API. + +Bugs: +===== + +Of course there are. One of the most important ones, is that you MUST NOT +filter outgoing connections otherwise the reply packes go missing. I tried to +figure out, why the _expect call is not taking care of the outgoing connections +but I was not able to figure this out. I gladly welcome patches that fix this +and other bugs. + +Build Instructions: +=================== + +Have the kernel source ready in some place and NF_CONNTRACK_NAT enabled in the +configuration otherwise you will get an error during make. The Kbuild setup +looks in /lib/modules/\`uname -r\`/build for the source. + +If the source is located in another place set the KERNELDIR environment +variable accordingly. + +After that a: + + * make + * make modules_install (as root) + +should be enough. +Then do a "modprobe nf_nat_rtsp" as root and try to connect to a RTSP +service. + diff --git a/package/rtsp/src/netfilter_helpers.h b/package/rtsp/src/netfilter_helpers.h new file mode 100644 index 000000000..903f37455 --- /dev/null +++ b/package/rtsp/src/netfilter_helpers.h @@ -0,0 +1,133 @@ +/* + * Helpers for netfiler modules. This file provides implementations for basic + * functions such as strncasecmp(), etc. + * + * gcc will warn for defined but unused functions, so we only include the + * functions requested. The following macros are used: + * NF_NEED_STRNCASECMP nf_strncasecmp() + * NF_NEED_STRTOU16 nf_strtou16() + * NF_NEED_STRTOU32 nf_strtou32() + */ +#ifndef _NETFILTER_HELPERS_H +#define _NETFILTER_HELPERS_H + +/* Only include these functions for kernel code. */ +#ifdef __KERNEL__ + +#include +#define iseol(c) ( (c) == '\r' || (c) == '\n' ) + +/* + * The standard strncasecmp() + */ +#ifdef NF_NEED_STRNCASECMP +static int +nf_strncasecmp(const char* s1, const char* s2, u_int32_t len) +{ + if (s1 == NULL || s2 == NULL) + { + if (s1 == NULL && s2 == NULL) + { + return 0; + } + return (s1 == NULL) ? -1 : 1; + } + while (len > 0 && tolower(*s1) == tolower(*s2)) + { + len--; + s1++; + s2++; + } + return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) ); +} +#endif /* NF_NEED_STRNCASECMP */ + +/* + * Parse a string containing a 16-bit unsigned integer. + * Returns the number of chars used, or zero if no number is found. + */ +#ifdef NF_NEED_STRTOU16 +static int +nf_strtou16(const char* pbuf, u_int16_t* pval) +{ + int n = 0; + + *pval = 0; + while (isdigit(pbuf[n])) + { + *pval = (*pval * 10) + (pbuf[n] - '0'); + n++; + } + + return n; +} +#endif /* NF_NEED_STRTOU16 */ + +/* + * Parse a string containing a 32-bit unsigned integer. + * Returns the number of chars used, or zero if no number is found. + */ +#ifdef NF_NEED_STRTOU32 +static int +nf_strtou32(const char* pbuf, u_int32_t* pval) +{ + int n = 0; + + *pval = 0; + while (pbuf[n] >= '0' && pbuf[n] <= '9') + { + *pval = (*pval * 10) + (pbuf[n] - '0'); + n++; + } + + return n; +} +#endif /* NF_NEED_STRTOU32 */ + +/* + * Given a buffer and length, advance to the next line and mark the current + * line. + */ +#ifdef NF_NEED_NEXTLINE +static int +nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) +{ + uint off = *poff; + uint physlen = 0; + + if (off >= len) + { + return 0; + } + + while (p[off] != '\n') + { + if (len-off <= 1) + { + return 0; + } + + physlen++; + off++; + } + + /* if we saw a crlf, physlen needs adjusted */ + if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') + { + physlen--; + } + + /* advance past the newline */ + off++; + + *plineoff = *poff; + *plinelen = physlen; + *poff = off; + + return 1; +} +#endif /* NF_NEED_NEXTLINE */ + +#endif /* __KERNEL__ */ + +#endif /* _NETFILTER_HELPERS_H */ diff --git a/package/rtsp/src/netfilter_mime.h b/package/rtsp/src/netfilter_mime.h new file mode 100644 index 000000000..7eeb18352 --- /dev/null +++ b/package/rtsp/src/netfilter_mime.h @@ -0,0 +1,89 @@ +/* + * MIME functions for netfilter modules. This file provides implementations + * for basic MIME parsing. MIME headers are used in many protocols, such as + * HTTP, RTSP, SIP, etc. + * + * gcc will warn for defined but unused functions, so we only include the + * functions requested. The following macros are used: + * NF_NEED_MIME_NEXTLINE nf_mime_nextline() + */ +#ifndef _NETFILTER_MIME_H +#define _NETFILTER_MIME_H + +/* Only include these functions for kernel code. */ +#ifdef __KERNEL__ + +#include + +/* + * Given a buffer and length, advance to the next line and mark the current + * line. If the current line is empty, *plinelen will be set to zero. If + * not, it will be set to the actual line length (including CRLF). + * + * 'line' in this context means logical line (includes LWS continuations). + * Returns 1 on success, 0 on failure. + */ +#ifdef NF_NEED_MIME_NEXTLINE +static int +nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) +{ + uint off = *poff; + uint physlen = 0; + int is_first_line = 1; + + if (off >= len) + { + return 0; + } + + do + { + while (p[off] != '\n') + { + if (len-off <= 1) + { + return 0; + } + + physlen++; + off++; + } + + /* if we saw a crlf, physlen needs adjusted */ + if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') + { + physlen--; + } + + /* advance past the newline */ + off++; + + /* check for an empty line */ + if (physlen == 0) + { + break; + } + + /* check for colon on the first physical line */ + if (is_first_line) + { + is_first_line = 0; + if (memchr(p+(*poff), ':', physlen) == NULL) + { + return 0; + } + } + } + while (p[off] == ' ' || p[off] == '\t'); + + *plineoff = *poff; + *plinelen = (physlen == 0) ? 0 : (off - *poff); + *poff = off; + + return 1; +} +#endif /* NF_NEED_MIME_NEXTLINE */ + +#endif /* __KERNEL__ */ + +#endif /* _NETFILTER_MIME_H */ diff --git a/package/rtsp/src/nf_conntrack_rtsp.c b/package/rtsp/src/nf_conntrack_rtsp.c new file mode 100644 index 000000000..c1002aca9 --- /dev/null +++ b/package/rtsp/src/nf_conntrack_rtsp.c @@ -0,0 +1,519 @@ +/* + * RTSP extension for IP connection tracking + * (C) 2003 by Tom Marshall + * based on ip_conntrack_irc.c + * + * 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. + * + * Module load syntax: + * insmod nf_conntrack_rtsp.o ports=port1,port2,...port + * max_outstanding=n setup_timeout=secs + * + * If no ports are specified, the default will be port 554. + * + * With max_outstanding you can define the maximum number of not yet + * answered SETUP requests per RTSP session (default 8). + * With setup_timeout you can specify how long the system waits for + * an expected data channel (default 300 seconds). + * + * 2005-02-13: Harald Welte + * - port to 2.6 + * - update to recent post-2.6.11 api changes + * 2006-09-14: Steven Van Acker + * - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack + * 2007-04-18: Michael Guntsche + * - Port to new NF API + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include "nf_conntrack_rtsp.h" + +#define NF_NEED_STRNCASECMP +#define NF_NEED_STRTOU16 +#define NF_NEED_STRTOU32 +#define NF_NEED_NEXTLINE +#include "netfilter_helpers.h" +#define NF_NEED_MIME_NEXTLINE +#include "netfilter_mime.h" + +#include +#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */ + +#define MAX_PORTS 8 +static int ports[MAX_PORTS]; +static int num_ports = 0; +static int max_outstanding = 8; +static unsigned int setup_timeout = 300; + +MODULE_AUTHOR("Tom Marshall "); +MODULE_DESCRIPTION("RTSP connection tracking module"); +MODULE_LICENSE("GPL"); +module_param_array(ports, int, &num_ports, 0400); +MODULE_PARM_DESC(ports, "port numbers of RTSP servers"); +module_param(max_outstanding, int, 0400); +MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session"); +module_param(setup_timeout, int, 0400); +MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels"); + +static char *rtsp_buffer; +static DEFINE_SPINLOCK(rtsp_buffer_lock); + +static struct nf_conntrack_expect_policy rtsp_exp_policy; + +unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, + enum ip_conntrack_info ctinfo, + unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp, + struct nf_conntrack_expect *exp); +void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); + +EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook); + +/* + * Max mappings we will allow for one RTSP connection (for RTP, the number + * of allocated ports is twice this value). Note that SMIL burns a lot of + * ports so keep this reasonably high. If this is too low, you will see a + * lot of "no free client map entries" messages. + */ +#define MAX_PORT_MAPS 16 + +/*** default port list was here in the masq code: 554, 3030, 4040 ***/ + +#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } + +/* + * Parse an RTSP packet. + * + * Returns zero if parsing failed. + * + * Parameters: + * IN ptcp tcp data pointer + * IN tcplen tcp data len + * IN/OUT ptcpoff points to current tcp offset + * OUT phdrsoff set to offset of rtsp headers + * OUT phdrslen set to length of rtsp headers + * OUT pcseqoff set to offset of CSeq header + * OUT pcseqlen set to length of CSeq header + */ +static int +rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff, + uint* phdrsoff, uint* phdrslen, + uint* pcseqoff, uint* pcseqlen, + uint* transoff, uint* translen) +{ + uint entitylen = 0; + uint lineoff; + uint linelen; + + if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) + return 0; + + *phdrsoff = *ptcpoff; + while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) { + if (linelen == 0) { + if (entitylen > 0) + *ptcpoff += min(entitylen, tcplen - *ptcpoff); + break; + } + if (lineoff+linelen > tcplen) { + pr_info("!! overrun !!\n"); + break; + } + + if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) { + *pcseqoff = lineoff; + *pcseqlen = linelen; + } + + if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) { + *transoff = lineoff; + *translen = linelen; + } + + if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) { + uint off = lineoff+15; + SKIP_WSPACE(ptcp+lineoff, linelen, off); + nf_strtou32(ptcp+off, &entitylen); + } + } + *phdrslen = (*ptcpoff) - (*phdrsoff); + + return 1; +} + +/* + * Find lo/hi client ports (if any) in transport header + * In: + * ptcp, tcplen = packet + * tranoff, tranlen = buffer to search + * + * Out: + * pport_lo, pport_hi = lo/hi ports (host endian) + * + * Returns nonzero if any client ports found + * + * Note: it is valid (and expected) for the client to request multiple + * transports, so we need to parse the entire line. + */ +static int +rtsp_parse_transport(char* ptran, uint tranlen, + struct ip_ct_rtsp_expect* prtspexp) +{ + int rc = 0; + uint off = 0; + + if (tranlen < 10 || !iseol(ptran[tranlen-1]) || + nf_strncasecmp(ptran, "Transport:", 10) != 0) { + pr_info("sanity check failed\n"); + return 0; + } + + pr_debug("tran='%.*s'\n", (int)tranlen, ptran); + off += 10; + SKIP_WSPACE(ptran, tranlen, off); + + /* Transport: tran;field;field=val,tran;field;field=val,... */ + while (off < tranlen) { + const char* pparamend; + uint nextparamoff; + + pparamend = memchr(ptran+off, ',', tranlen-off); + pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; + nextparamoff = pparamend-ptran; + + while (off < nextparamoff) { + const char* pfieldend; + uint nextfieldoff; + + pfieldend = memchr(ptran+off, ';', nextparamoff-off); + nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; + + if (strncmp(ptran+off, "client_port=", 12) == 0) { + u_int16_t port; + uint numlen; + + off += 12; + numlen = nf_strtou16(ptran+off, &port); + off += numlen; + if (prtspexp->loport != 0 && prtspexp->loport != port) + pr_debug("multiple ports found, port %hu ignored\n", port); + else { + pr_debug("lo port found : %hu\n", port); + prtspexp->loport = prtspexp->hiport = port; + if (ptran[off] == '-') { + off++; + numlen = nf_strtou16(ptran+off, &port); + off += numlen; + prtspexp->pbtype = pb_range; + prtspexp->hiport = port; + + // If we have a range, assume rtp: + // loport must be even, hiport must be loport+1 + if ((prtspexp->loport & 0x0001) != 0 || + prtspexp->hiport != prtspexp->loport+1) { + pr_debug("incorrect range: %hu-%hu, correcting\n", + prtspexp->loport, prtspexp->hiport); + prtspexp->loport &= 0xfffe; + prtspexp->hiport = prtspexp->loport+1; + } + } else if (ptran[off] == '/') { + off++; + numlen = nf_strtou16(ptran+off, &port); + off += numlen; + prtspexp->pbtype = pb_discon; + prtspexp->hiport = port; + } + rc = 1; + } + } + + /* + * Note we don't look for the destination parameter here. + * If we are using NAT, the NAT module will handle it. If not, + * and the client is sending packets elsewhere, the expectation + * will quietly time out. + */ + + off = nextfieldoff; + } + + off = nextparamoff; + } + + return rc; +} + +void expected(struct nf_conn *ct, struct nf_conntrack_expect *exp) +{ + typeof(nf_nat_rtsp_hook_expectfn) nf_nat_rtsp_expectfn; + nf_nat_rtsp_expectfn = rcu_dereference(nf_nat_rtsp_hook_expectfn); + if(nf_nat_rtsp_expectfn && ct->master->status & IPS_NAT_MASK) { + nf_nat_rtsp_expectfn(ct,exp); + } +} + +/*** conntrack functions ***/ + +/* outbound packet: client->server */ + +static inline int +help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen, + struct nf_conn *ct, enum ip_conntrack_info ctinfo) +{ + struct ip_ct_rtsp_expect expinfo; + + int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */ + //struct tcphdr* tcph = (void*)iph + iph->ihl * 4; + //uint tcplen = pktlen - iph->ihl * 4; + char* pdata = rb_ptr; + //uint datalen = tcplen - tcph->doff * 4; + uint dataoff = 0; + int ret = NF_ACCEPT; + + struct nf_conntrack_expect *exp; + + __be16 be_loport; + + typeof(nf_nat_rtsp_hook) nf_nat_rtsp; + + memset(&expinfo, 0, sizeof(expinfo)); + + while (dataoff < datalen) { + uint cmdoff = dataoff; + uint hdrsoff = 0; + uint hdrslen = 0; + uint cseqoff = 0; + uint cseqlen = 0; + uint transoff = 0; + uint translen = 0; + uint off; + + if (!rtsp_parse_message(pdata, datalen, &dataoff, + &hdrsoff, &hdrslen, + &cseqoff, &cseqlen, + &transoff, &translen)) + break; /* not a valid message */ + + if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0) + continue; /* not a SETUP message */ + pr_debug("found a setup message\n"); + + off = 0; + if(translen) { + rtsp_parse_transport(pdata+transoff, translen, &expinfo); + } + + if (expinfo.loport == 0) { + pr_debug("no udp transports found\n"); + continue; /* no udp transports found */ + } + + pr_debug("udp transport found, ports=(%d,%hu,%hu)\n", + (int)expinfo.pbtype, expinfo.loport, expinfo.hiport); + + exp = nf_ct_expect_alloc(ct); + if (!exp) { + ret = NF_DROP; + goto out; + } + + be_loport = htons(expinfo.loport); + + nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct), + &ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3, + IPPROTO_UDP, NULL, &be_loport); + + exp->master = ct; + + exp->expectfn = expected; + exp->flags = 0; + + if (expinfo.pbtype == pb_range) { + pr_debug("Changing expectation mask to handle multiple ports\n"); + //exp->mask.dst.u.udp.port = 0xfffe; + } + + pr_debug("expect_related %u.%u.%u.%u:%u-%u.%u.%u.%u:%u\n", + NIPQUAD(exp->tuple.src.u3.ip), + ntohs(exp->tuple.src.u.udp.port), + NIPQUAD(exp->tuple.dst.u3.ip), + ntohs(exp->tuple.dst.u.udp.port)); + + nf_nat_rtsp = rcu_dereference(nf_nat_rtsp_hook); + if (nf_nat_rtsp && ct->status & IPS_NAT_MASK) + /* pass the request off to the nat helper */ + ret = nf_nat_rtsp(skb, ctinfo, hdrsoff, hdrslen, &expinfo, exp); + else if (nf_ct_expect_related(exp) != 0) { + pr_info("nf_conntrack_expect_related failed\n"); + ret = NF_DROP; + } + nf_ct_expect_put(exp); + goto out; + } +out: + + return ret; +} + + +static inline int +help_in(struct sk_buff *skb, size_t pktlen, + struct nf_conn* ct, enum ip_conntrack_info ctinfo) +{ + return NF_ACCEPT; +} + +static int help(struct sk_buff *skb, unsigned int protoff, + struct nf_conn *ct, enum ip_conntrack_info ctinfo) +{ + struct tcphdr _tcph, *th; + unsigned int dataoff, datalen; + char *rb_ptr; + int ret = NF_DROP; + + /* Until there's been traffic both ways, don't look in packets. */ + if (ctinfo != IP_CT_ESTABLISHED && + ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { + pr_debug("conntrackinfo = %u\n", ctinfo); + return NF_ACCEPT; + } + + /* Not whole TCP header? */ + th = skb_header_pointer(skb,protoff, sizeof(_tcph), &_tcph); + + if (!th) + return NF_ACCEPT; + + /* No data ? */ + dataoff = protoff + th->doff*4; + datalen = skb->len - dataoff; + if (dataoff >= skb->len) + return NF_ACCEPT; + + spin_lock_bh(&rtsp_buffer_lock); + rb_ptr = skb_header_pointer(skb, dataoff, + skb->len - dataoff, rtsp_buffer); + BUG_ON(rb_ptr == NULL); + +#if 0 + /* Checksum invalid? Ignore. */ + /* FIXME: Source route IP option packets --RR */ + if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, + csum_partial((char*)tcph, tcplen, 0))) + { + DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", + tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); + return NF_ACCEPT; + } +#endif + + switch (CTINFO2DIR(ctinfo)) { + case IP_CT_DIR_ORIGINAL: + ret = help_out(skb, rb_ptr, datalen, ct, ctinfo); + break; + case IP_CT_DIR_REPLY: + pr_debug("IP_CT_DIR_REPLY\n"); + /* inbound packet: server->client */ + ret = NF_ACCEPT; + break; + } + + spin_unlock_bh(&rtsp_buffer_lock); + + return ret; +} + +static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS]; +static char rtsp_names[MAX_PORTS][10]; + +/* This function is intentionally _NOT_ defined as __exit */ +static void +fini(void) +{ + int i; + for (i = 0; i < num_ports; i++) { + pr_debug("unregistering port %d\n", ports[i]); + nf_conntrack_helper_unregister(&rtsp_helpers[i]); + } + kfree(rtsp_buffer); +} + +static int __init +init(void) +{ + int i, ret; + struct nf_conntrack_helper *hlpr; + char *tmpname; + + printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n"); + + if (max_outstanding < 1) { + printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n"); + return -EBUSY; + } + if (setup_timeout < 0) { + printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n"); + return -EBUSY; + } + + rtsp_exp_policy.max_expected = max_outstanding; + rtsp_exp_policy.timeout = setup_timeout; + + rtsp_buffer = kmalloc(65536, GFP_KERNEL); + if (!rtsp_buffer) + return -ENOMEM; + + /* If no port given, default to standard rtsp port */ + if (ports[0] == 0) { + ports[0] = RTSP_PORT; + } + + for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { + hlpr = &rtsp_helpers[i]; + memset(hlpr, 0, sizeof(struct nf_conntrack_helper)); + hlpr->tuple.src.l3num = AF_INET; + hlpr->tuple.src.u.tcp.port = htons(ports[i]); + hlpr->tuple.dst.protonum = IPPROTO_TCP; + //hlpr->mask.src.u.tcp.port = 0xFFFF; + //hlpr->mask.dst.protonum = 0xFF; + hlpr->expect_policy = &rtsp_exp_policy; + hlpr->me = THIS_MODULE; + hlpr->help = help; + + tmpname = &rtsp_names[i][0]; + if (ports[i] == RTSP_PORT) { + sprintf(tmpname, "rtsp"); + } else { + sprintf(tmpname, "rtsp-%d", i); + } + hlpr->name = tmpname; + + pr_debug("port #%d: %d\n", i, ports[i]); + + ret = nf_conntrack_helper_register(hlpr); + + if (ret) { + printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]); + fini(); + return -EBUSY; + } + num_ports++; + } + return 0; +} + +module_init(init); +module_exit(fini); + +EXPORT_SYMBOL(nf_nat_rtsp_hook_expectfn); + diff --git a/package/rtsp/src/nf_conntrack_rtsp.h b/package/rtsp/src/nf_conntrack_rtsp.h new file mode 100644 index 000000000..0c9e3b848 --- /dev/null +++ b/package/rtsp/src/nf_conntrack_rtsp.h @@ -0,0 +1,63 @@ +/* + * RTSP extension for IP connection tracking. + * (C) 2003 by Tom Marshall + * based on ip_conntrack_irc.h + * + * 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. + */ +#ifndef _IP_CONNTRACK_RTSP_H +#define _IP_CONNTRACK_RTSP_H + +//#define IP_NF_RTSP_DEBUG 1 +#define IP_NF_RTSP_VERSION "0.6.21" + +#ifdef __KERNEL__ +/* port block types */ +typedef enum { + pb_single, /* client_port=x */ + pb_range, /* client_port=x-y */ + pb_discon /* client_port=x/y (rtspbis) */ +} portblock_t; + +/* We record seq number and length of rtsp headers here, all in host order. */ + +/* + * This structure is per expected connection. It is a member of struct + * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored + * there and we are expected to only store the length of the data which + * needs replaced. If a packet contains multiple RTSP messages, we create + * one expected connection per message. + * + * We use these variables to mark the entire header block. This may seem + * like overkill, but the nature of RTSP requires it. A header may appear + * multiple times in a message. We must treat two Transport headers the + * same as one Transport header with two entries. + */ +struct ip_ct_rtsp_expect +{ + u_int32_t len; /* length of header block */ + portblock_t pbtype; /* Type of port block that was requested */ + u_int16_t loport; /* Port that was requested, low or first */ + u_int16_t hiport; /* Port that was requested, high or second */ +#if 0 + uint method; /* RTSP method */ + uint cseq; /* CSeq from request */ +#endif +}; + +extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, + enum ip_conntrack_info ctinfo, + unsigned int matchoff, unsigned int matchlen, + struct ip_ct_rtsp_expect *prtspexp, + struct nf_conntrack_expect *exp); + +extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); + +#define RTSP_PORT 554 + +#endif /* __KERNEL__ */ + +#endif /* _IP_CONNTRACK_RTSP_H */ diff --git a/package/rtsp/src/nf_nat_rtsp.c b/package/rtsp/src/nf_nat_rtsp.c new file mode 100644 index 000000000..6ec6aa4f8 --- /dev/null +++ b/package/rtsp/src/nf_nat_rtsp.c @@ -0,0 +1,489 @@ +/* + * RTSP extension for TCP NAT alteration + * (C) 2003 by Tom Marshall + * based on ip_nat_irc.c + * + * 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. + * + * Module load syntax: + * insmod nf_nat_rtsp.o ports=port1,port2,...port + * stunaddr=
+ * destaction=[auto|strip|none] + * + * If no ports are specified, the default will be port 554 only. + * + * stunaddr specifies the address used to detect that a client is using STUN. + * If this address is seen in the destination parameter, it is assumed that + * the client has already punched a UDP hole in the firewall, so we don't + * mangle the client_port. If none is specified, it is autodetected. It + * only needs to be set if you have multiple levels of NAT. It should be + * set to the external address that the STUN clients detect. Note that in + * this case, it will not be possible for clients to use UDP with servers + * between the NATs. + * + * If no destaction is specified, auto is used. + * destaction=auto: strip destination parameter if it is not stunaddr. + * destaction=strip: always strip destination parameter (not recommended). + * destaction=none: do not touch destination parameter (not recommended). + */ + +#include +#include +#include +#include +#include "nf_conntrack_rtsp.h" +#include + +#include +#include +#define NF_NEED_STRNCASECMP +#define NF_NEED_STRTOU16 +#include "netfilter_helpers.h" +#define NF_NEED_MIME_NEXTLINE +#include "netfilter_mime.h" + +#define MAX_PORTS 8 +#define DSTACT_AUTO 0 +#define DSTACT_STRIP 1 +#define DSTACT_NONE 2 + +static char* stunaddr = NULL; +static char* destaction = NULL; + +static u_int32_t extip = 0; +static int dstact = 0; + +MODULE_AUTHOR("Tom Marshall "); +MODULE_DESCRIPTION("RTSP network address translation module"); +MODULE_LICENSE("GPL"); +module_param(stunaddr, charp, 0644); +MODULE_PARM_DESC(stunaddr, "Address for detecting STUN"); +module_param(destaction, charp, 0644); +MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)"); + +#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } + +/*** helper functions ***/ + +static void +get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen) +{ + struct iphdr* iph = ip_hdr(skb); + struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb); + + *pptcpdata = (char*)tcph + tcph->doff*4; + *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata; +} + +/*** nat functions ***/ + +/* + * Mangle the "Transport:" header: + * - Replace all occurences of "client_port=" + * - Handle destination parameter + * + * In: + * ct, ctinfo = conntrack context + * skb = packet + * tranoff = Transport header offset from TCP data + * tranlen = Transport header length (incl. CRLF) + * rport_lo = replacement low port (host endian) + * rport_hi = replacement high port (host endian) + * + * Returns packet size difference. + * + * Assumes that a complete transport header is present, ending with CR or LF + */ +static int +rtsp_mangle_tran(enum ip_conntrack_info ctinfo, + struct nf_conntrack_expect* exp, + struct ip_ct_rtsp_expect* prtspexp, + struct sk_buff* skb, uint tranoff, uint tranlen) +{ + char* ptcp; + uint tcplen; + char* ptran; + char rbuf1[16]; /* Replacement buffer (one port) */ + uint rbuf1len; /* Replacement len (one port) */ + char rbufa[16]; /* Replacement buffer (all ports) */ + uint rbufalen; /* Replacement len (all ports) */ + u_int32_t newip; + u_int16_t loport, hiport; + uint off = 0; + uint diff; /* Number of bytes we removed */ + + struct nf_conn *ct = exp->master; + struct nf_conntrack_tuple *t; + + char szextaddr[15+1]; + uint extaddrlen; + int is_stun; + + get_skb_tcpdata(skb, &ptcp, &tcplen); + ptran = ptcp+tranoff; + + if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen || + tranlen < 10 || !iseol(ptran[tranlen-1]) || + nf_strncasecmp(ptran, "Transport:", 10) != 0) + { + pr_info("sanity check failed\n"); + return 0; + } + off += 10; + SKIP_WSPACE(ptcp+tranoff, tranlen, off); + + newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; + t = &exp->tuple; + t->dst.u3.ip = newip; + + extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip)) + : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip)); + pr_debug("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto")); + + rbuf1len = rbufalen = 0; + switch (prtspexp->pbtype) + { + case pb_single: + for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ + { + t->dst.u.udp.port = htons(loport); + if (nf_ct_expect_related(exp) == 0) + { + pr_debug("using port %hu\n", loport); + break; + } + } + if (loport != 0) + { + rbuf1len = sprintf(rbuf1, "%hu", loport); + rbufalen = sprintf(rbufa, "%hu", loport); + } + break; + case pb_range: + for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */ + { + t->dst.u.udp.port = htons(loport); + if (nf_ct_expect_related(exp) == 0) + { + hiport = loport + 1; //~exp->mask.dst.u.udp.port; + pr_debug("using ports %hu-%hu\n", loport, hiport); + break; + } + } + if (loport != 0) + { + rbuf1len = sprintf(rbuf1, "%hu", loport); + rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1); + } + break; + case pb_discon: + for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ + { + t->dst.u.udp.port = htons(loport); + if (nf_ct_expect_related(exp) == 0) + { + pr_debug("using port %hu (1 of 2)\n", loport); + break; + } + } + for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */ + { + t->dst.u.udp.port = htons(hiport); + if (nf_ct_expect_related(exp) == 0) + { + pr_debug("using port %hu (2 of 2)\n", hiport); + break; + } + } + if (loport != 0 && hiport != 0) + { + rbuf1len = sprintf(rbuf1, "%hu", loport); + if (hiport == loport+1) + { + rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport); + } + else + { + rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport); + } + } + break; + } + + if (rbuf1len == 0) + { + return 0; /* cannot get replacement port(s) */ + } + + /* Transport: tran;field;field=val,tran;field;field=val,... */ + while (off < tranlen) + { + uint saveoff; + const char* pparamend; + uint nextparamoff; + + pparamend = memchr(ptran+off, ',', tranlen-off); + pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; + nextparamoff = pparamend-ptcp; + + /* + * We pass over each param twice. On the first pass, we look for a + * destination= field. It is handled by the security policy. If it + * is present, allowed, and equal to our external address, we assume + * that STUN is being used and we leave the client_port= field alone. + */ + is_stun = 0; + saveoff = off; + while (off < nextparamoff) + { + const char* pfieldend; + uint nextfieldoff; + + pfieldend = memchr(ptran+off, ';', nextparamoff-off); + nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; + + if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) + { + if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0) + { + is_stun = 1; + } + if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun)) + { + diff = nextfieldoff-off; + if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, + off, diff, NULL, 0)) + { + /* mangle failed, all we can do is bail */ + nf_ct_unexpect_related(exp); + return 0; + } + get_skb_tcpdata(skb, &ptcp, &tcplen); + ptran = ptcp+tranoff; + tranlen -= diff; + nextparamoff -= diff; + nextfieldoff -= diff; + } + } + + off = nextfieldoff; + } + if (is_stun) + { + continue; + } + off = saveoff; + while (off < nextparamoff) + { + const char* pfieldend; + uint nextfieldoff; + + pfieldend = memchr(ptran+off, ';', nextparamoff-off); + nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; + + if (strncmp(ptran+off, "client_port=", 12) == 0) + { + u_int16_t port; + uint numlen; + uint origoff; + uint origlen; + char* rbuf = rbuf1; + uint rbuflen = rbuf1len; + + off += 12; + origoff = (ptran-ptcp)+off; + origlen = 0; + numlen = nf_strtou16(ptran+off, &port); + off += numlen; + origlen += numlen; + if (port != prtspexp->loport) + { + pr_debug("multiple ports found, port %hu ignored\n", port); + } + else + { + if (ptran[off] == '-' || ptran[off] == '/') + { + off++; + origlen++; + numlen = nf_strtou16(ptran+off, &port); + off += numlen; + origlen += numlen; + rbuf = rbufa; + rbuflen = rbufalen; + } + + /* + * note we cannot just memcpy() if the sizes are the same. + * the mangle function does skb resizing, checks for a + * cloned skb, and updates the checksums. + * + * parameter 4 below is offset from start of tcp data. + */ + diff = origlen-rbuflen; + if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, + origoff, origlen, rbuf, rbuflen)) + { + /* mangle failed, all we can do is bail */ + nf_ct_unexpect_related(exp); + return 0; + } + get_skb_tcpdata(skb, &ptcp, &tcplen); + ptran = ptcp+tranoff; + tranlen -= diff; + nextparamoff -= diff; + nextfieldoff -= diff; + } + } + + off = nextfieldoff; + } + + off = nextparamoff; + } + + return 1; +} + +static uint +help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, + unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, + struct nf_conntrack_expect* exp) +{ + char* ptcp; + uint tcplen; + uint hdrsoff; + uint hdrslen; + uint lineoff; + uint linelen; + uint off; + + //struct iphdr* iph = (struct iphdr*)(*pskb)->nh.iph; + //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4); + + get_skb_tcpdata(skb, &ptcp, &tcplen); + hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq); + hdrslen = matchlen; + off = hdrsoff; + pr_debug("NAT rtsp help_out\n"); + + while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen)) + { + if (linelen == 0) + { + break; + } + if (off > hdrsoff+hdrslen) + { + pr_info("!! overrun !!"); + break; + } + pr_debug("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); + + if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) + { + uint oldtcplen = tcplen; + pr_debug("hdr: Transport\n"); + if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen)) + { + pr_debug("hdr: Transport mangle failed"); + break; + } + get_skb_tcpdata(skb, &ptcp, &tcplen); + hdrslen -= (oldtcplen-tcplen); + off -= (oldtcplen-tcplen); + lineoff -= (oldtcplen-tcplen); + linelen -= (oldtcplen-tcplen); + pr_debug("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); + } + } + + return NF_ACCEPT; +} + +static unsigned int +help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, + unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, + struct nf_conntrack_expect* exp) +{ + int dir = CTINFO2DIR(ctinfo); + int rc = NF_ACCEPT; + + switch (dir) + { + case IP_CT_DIR_ORIGINAL: + rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp); + break; + case IP_CT_DIR_REPLY: + pr_debug("unmangle ! %u\n", ctinfo); + /* XXX: unmangle */ + rc = NF_ACCEPT; + break; + } + //UNLOCK_BH(&ip_rtsp_lock); + + return rc; +} + +static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp) +{ + struct nf_nat_multi_range_compat mr; + u_int32_t newdstip, newsrcip, newip; + + struct nf_conn *master = ct->master; + + newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; + newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; + //FIXME (how to port that ?) + //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip; + newip = newdstip; + + pr_debug("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n", + NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip)); + + mr.rangesize = 1; + // We don't want to manip the per-protocol, just the IPs. + mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; + mr.range[0].min_ip = mr.range[0].max_ip = newip; + + nf_nat_setup_info(ct, &mr.range[0], IP_NAT_MANIP_DST); +} + + +static void __exit fini(void) +{ + nf_nat_rtsp_hook = NULL; + nf_nat_rtsp_hook_expectfn = NULL; + synchronize_net(); +} + +static int __init init(void) +{ + printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n"); + + BUG_ON(nf_nat_rtsp_hook); + nf_nat_rtsp_hook = help; + nf_nat_rtsp_hook_expectfn = &expected; + + if (stunaddr != NULL) + extip = in_aton(stunaddr); + + if (destaction != NULL) { + if (strcmp(destaction, "auto") == 0) + dstact = DSTACT_AUTO; + + if (strcmp(destaction, "strip") == 0) + dstact = DSTACT_STRIP; + + if (strcmp(destaction, "none") == 0) + dstact = DSTACT_NONE; + } + + return 0; +} + +module_init(init); +module_exit(fini); -- cgit v1.2.3 From e42433d7127f9a50b5dae57fff331ecfdc9883c4 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 27 Apr 2010 20:58:44 +0200 Subject: iptv via natting now works at last sometime. alice iptv seems to use destination=ip:port instead of client_port=port, like RFC suggesting it. But destination= is also used by STUN method. As a quick hack I commented out STUN method to avoid crashes. Now at least I can see some tv streams. still not 100% good. --- mk/modules.mk | 8 +- package/Config.in | 1 + package/nand/src/nand.c | 2 +- package/rtsp/Makefile | 6 +- package/rtsp/src/nf_conntrack_rtsp.c | 30 +- package/rtsp/src/nf_nat_rtsp.c | 48 +- target/linux/config/Config.in.netfilter | 1 + target/linux/config/Config.in.netfilter.core | 10 +- target/linux/patches/2.6.33/rtsp.patch | 2316 -------------------------- 9 files changed, 88 insertions(+), 2334 deletions(-) delete mode 100644 target/linux/patches/2.6.33/rtsp.patch (limited to 'package') diff --git a/mk/modules.mk b/mk/modules.mk index 7ab35b74d..fce15c190 100644 --- a/mk/modules.mk +++ b/mk/modules.mk @@ -394,10 +394,10 @@ $(eval $(call KMOD_template,NF_CONNTRACK_TFTP,nf-conntrack-tftp,\ $(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_nat_tftp \ ,55)) -$(eval $(call KMOD_template,NF_CONNTRACK_RTSP,nf-conntrack-rtsp,\ - $(MODULES_DIR)/kernel/net/netfilter/nf_conntrack_rtsp \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_nat_rtsp \ -,55)) +#$(eval $(call KMOD_template,NF_CONNTRACK_RTSP,nf-conntrack-rtsp,\ +# $(MODULES_DIR)/kernel/net/netfilter/nf_conntrack_rtsp \ +# $(MODULES_DIR)/kernel/net/ipv4/netfilter/nf_nat_rtsp \ +#,55)) # broken #$(eval $(call KMOD_template,NF_CONNTRACK_AMANDA,nf-conntrack-amanda,\ diff --git a/package/Config.in b/package/Config.in index 37f1e4e92..5f1a0bdd4 100644 --- a/package/Config.in +++ b/package/Config.in @@ -693,4 +693,5 @@ endmenu menu "Kernel configuration" source "target/linux/Config.in" +source "package/rtsp/Config.in" endmenu diff --git a/package/nand/src/nand.c b/package/nand/src/nand.c index 0d5d7f0e4..225e866e2 100644 --- a/package/nand/src/nand.c +++ b/package/nand/src/nand.c @@ -494,7 +494,7 @@ usage(void) " -q quiet mode\n" " -r reboot after successful command\n" "Example: To write linux.img to mtd partition labeled as linux\n" - " mtd write linux.img linux\n\n"); + " nand write linux.img linux\n\n"); exit(1); } diff --git a/package/rtsp/Makefile b/package/rtsp/Makefile index c28467b9b..994852f04 100644 --- a/package/rtsp/Makefile +++ b/package/rtsp/Makefile @@ -22,10 +22,10 @@ BUILD_STYLE:= manual INSTALL_STYLE:= manual pre-build: - V=1 ARCH=${ARCH} KERNELDIR=${LINUX_DIR} \ + ARCH=${ARCH} KERNELDIR=${LINUX_DIR} \ PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \ - LD=$(TARGET_CROSS)gcc LDFLAGS="" \ - $(MAKE) -C ${WRKBUILD} debug + LD=$(TARGET_CROSS)gcc LDFLAGS="" CFLAGS="-Wall" \ + $(MAKE) -C ${WRKBUILD} debug V=1 do-install: ${INSTALL_DIR} ${IDIR_KMOD_RTSP}/etc/modules.d/ diff --git a/package/rtsp/src/nf_conntrack_rtsp.c b/package/rtsp/src/nf_conntrack_rtsp.c index c1002aca9..7b5d2be67 100644 --- a/package/rtsp/src/nf_conntrack_rtsp.c +++ b/package/rtsp/src/nf_conntrack_rtsp.c @@ -177,14 +177,15 @@ rtsp_parse_transport(char* ptran, uint tranlen, pr_info("sanity check failed\n"); return 0; } - - pr_debug("tran='%.*s'\n", (int)tranlen, ptran); + + pr_debug("t='%.*s'\n", (int)tranlen-2, ptran); off += 10; SKIP_WSPACE(ptran, tranlen, off); /* Transport: tran;field;field=val,tran;field;field=val,... */ while (off < tranlen) { const char* pparamend; + const char* pdestport; uint nextparamoff; pparamend = memchr(ptran+off, ',', tranlen-off); @@ -236,6 +237,31 @@ rtsp_parse_transport(char* ptran, uint tranlen, rc = 1; } } + else if ((strncmp(ptran+off, "destination=",12) == 0) && + ((pdestport = memchr(ptran+off, ':', nextparamoff-off)) != NULL)) + { + u_int16_t port; + uint numlen; + + off += 12; + pdestport++; + + off = pdestport - ptran; + numlen = nf_strtou16(ptran + off, &port); + off += numlen + 1; + + if (prtspexp->loport != 0 && prtspexp->loport != port) + { + pr_debug("multiple ports found, port %hu ignored\n", port); + } + else + { + prtspexp->pbtype = pb_single; + prtspexp->loport = port; + prtspexp->hiport = port; + rc = 1; + } + } /* * Note we don't look for the destination parameter here. diff --git a/package/rtsp/src/nf_nat_rtsp.c b/package/rtsp/src/nf_nat_rtsp.c index 6ec6aa4f8..adb44d0ae 100644 --- a/package/rtsp/src/nf_nat_rtsp.c +++ b/package/rtsp/src/nf_nat_rtsp.c @@ -129,7 +129,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo, tranlen < 10 || !iseol(ptran[tranlen-1]) || nf_strncasecmp(ptran, "Transport:", 10) != 0) { - pr_info("sanity check failed\n"); + pr_debug("sanity check failed\n"); return 0; } off += 10; @@ -245,6 +245,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo, pfieldend = memchr(ptran+off, ';', nextparamoff-off); nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; + /* if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) { if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0) @@ -257,7 +258,6 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo, if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, off, diff, NULL, 0)) { - /* mangle failed, all we can do is bail */ nf_ct_unexpect_related(exp); return 0; } @@ -268,6 +268,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo, nextfieldoff -= diff; } } + */ off = nextfieldoff; } @@ -279,6 +280,7 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo, while (off < nextparamoff) { const char* pfieldend; + const char* pdestport; uint nextfieldoff; pfieldend = memchr(ptran+off, ';', nextparamoff-off); @@ -338,6 +340,46 @@ rtsp_mangle_tran(enum ip_conntrack_info ctinfo, nextfieldoff -= diff; } } + else if ((strncmp(ptran+off, "destination=", 12) == 0) && ((pdestport = memchr(ptran+off+12, ':', nextparamoff-(off + 12))) != NULL)) + { + u_int16_t port; + uint numlen; + uint origoff; + uint origlen; + char rbuf[32]; + uint rbuflen = sprintf(rbuf, "%s:%s",szextaddr,rbuf1); + + pdestport++; + + off += 12; + origoff = (ptran + off) - ptcp; + origlen = pdestport - (ptran + off); + off += origlen; + numlen = nf_strtou16(ptran+off, &port); + off += numlen; + origlen += numlen; + + if (port != prtspexp->loport) + { + pr_debug("multiple ports found, port %hu ignored\n", port); + } + else + { + diff = origlen-rbuflen; + if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, + origoff, origlen, rbuf, rbuflen)) + { + /* mangle failed, all we can do is bail */ + nf_ct_unexpect_related(exp); + return 0; + } + get_skb_tcpdata(skb, &ptcp, &tcplen); + ptran = ptcp+tranoff; + tranlen -= diff; + nextparamoff -= diff; + nextfieldoff -= diff; + } + } off = nextfieldoff; } @@ -378,7 +420,7 @@ help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, } if (off > hdrsoff+hdrslen) { - pr_info("!! overrun !!"); + pr_debug("!! overrun !!"); break; } pr_debug("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); diff --git a/target/linux/config/Config.in.netfilter b/target/linux/config/Config.in.netfilter index cb71b6551..dbc686b0a 100644 --- a/target/linux/config/Config.in.netfilter +++ b/target/linux/config/Config.in.netfilter @@ -156,6 +156,7 @@ endmenu menu "Netfilter Addons" source package/ipset/Config.in.kmod +source package/rtsp/Config.in.kmod endmenu endmenu diff --git a/target/linux/config/Config.in.netfilter.core b/target/linux/config/Config.in.netfilter.core index 0231b2d13..e2e9a2bbb 100644 --- a/target/linux/config/Config.in.netfilter.core +++ b/target/linux/config/Config.in.netfilter.core @@ -82,11 +82,11 @@ config ADK_KPACKAGE_KMOD_NF_CONNTRACK_FTP required for tracking them, and doing masquerading and other forms of Network Address Translation on them. -config ADK_KPACKAGE_KMOD_NF_CONNTRACK_RTSP - tristate 'RTSP protocol support' - depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK - help - Tracking RTSP connections might be required for IPTV. +#config ADK_KPACKAGE_KMOD_NF_CONNTRACK_RTSP +# tristate 'RTSP protocol support' +# depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK +# help +# Tracking RTSP connections might be required for IPTV. config ADK_KPACKAGE_KMOD_NF_CONNTRACK_IRC tristate 'IRC protocol support' diff --git a/target/linux/patches/2.6.33/rtsp.patch b/target/linux/patches/2.6.33/rtsp.patch deleted file mode 100644 index 317c06d8e..000000000 --- a/target/linux/patches/2.6.33/rtsp.patch +++ /dev/null @@ -1,2316 +0,0 @@ -diff -Nur linux-2.6.33.orig/include/linux/netfilter/nf_conntrack_rtsp.h linux-2.6.33/include/linux/netfilter/nf_conntrack_rtsp.h ---- linux-2.6.33.orig/include/linux/netfilter/nf_conntrack_rtsp.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.33/include/linux/netfilter/nf_conntrack_rtsp.h 2010-04-25 01:09:20.000000000 +0200 -@@ -0,0 +1,63 @@ -+/* -+ * RTSP extension for IP connection tracking. -+ * (C) 2003 by Tom Marshall -+ * based on ip_conntrack_irc.h -+ * -+ * 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. -+ */ -+#ifndef _IP_CONNTRACK_RTSP_H -+#define _IP_CONNTRACK_RTSP_H -+ -+//#define IP_NF_RTSP_DEBUG 1 -+#define IP_NF_RTSP_VERSION "0.6.21" -+ -+#ifdef __KERNEL__ -+/* port block types */ -+typedef enum { -+ pb_single, /* client_port=x */ -+ pb_range, /* client_port=x-y */ -+ pb_discon /* client_port=x/y (rtspbis) */ -+} portblock_t; -+ -+/* We record seq number and length of rtsp headers here, all in host order. */ -+ -+/* -+ * This structure is per expected connection. It is a member of struct -+ * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored -+ * there and we are expected to only store the length of the data which -+ * needs replaced. If a packet contains multiple RTSP messages, we create -+ * one expected connection per message. -+ * -+ * We use these variables to mark the entire header block. This may seem -+ * like overkill, but the nature of RTSP requires it. A header may appear -+ * multiple times in a message. We must treat two Transport headers the -+ * same as one Transport header with two entries. -+ */ -+struct ip_ct_rtsp_expect -+{ -+ u_int32_t len; /* length of header block */ -+ portblock_t pbtype; /* Type of port block that was requested */ -+ u_int16_t loport; /* Port that was requested, low or first */ -+ u_int16_t hiport; /* Port that was requested, high or second */ -+#if 0 -+ uint method; /* RTSP method */ -+ uint cseq; /* CSeq from request */ -+#endif -+}; -+ -+extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, -+ enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen, -+ struct ip_ct_rtsp_expect *prtspexp, -+ struct nf_conntrack_expect *exp); -+ -+extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); -+ -+#define RTSP_PORT 554 -+ -+#endif /* __KERNEL__ */ -+ -+#endif /* _IP_CONNTRACK_RTSP_H */ -diff -Nur linux-2.6.33.orig/include/linux/netfilter_helpers.h linux-2.6.33/include/linux/netfilter_helpers.h ---- linux-2.6.33.orig/include/linux/netfilter_helpers.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.33/include/linux/netfilter_helpers.h 2010-04-25 01:09:20.000000000 +0200 -@@ -0,0 +1,133 @@ -+/* -+ * Helpers for netfiler modules. This file provides implementations for basic -+ * functions such as strncasecmp(), etc. -+ * -+ * gcc will warn for defined but unused functions, so we only include the -+ * functions requested. The following macros are used: -+ * NF_NEED_STRNCASECMP nf_strncasecmp() -+ * NF_NEED_STRTOU16 nf_strtou16() -+ * NF_NEED_STRTOU32 nf_strtou32() -+ */ -+#ifndef _NETFILTER_HELPERS_H -+#define _NETFILTER_HELPERS_H -+ -+/* Only include these functions for kernel code. */ -+#ifdef __KERNEL__ -+ -+#include -+#define iseol(c) ( (c) == '\r' || (c) == '\n' ) -+ -+/* -+ * The standard strncasecmp() -+ */ -+#ifdef NF_NEED_STRNCASECMP -+static int -+nf_strncasecmp(const char* s1, const char* s2, u_int32_t len) -+{ -+ if (s1 == NULL || s2 == NULL) -+ { -+ if (s1 == NULL && s2 == NULL) -+ { -+ return 0; -+ } -+ return (s1 == NULL) ? -1 : 1; -+ } -+ while (len > 0 && tolower(*s1) == tolower(*s2)) -+ { -+ len--; -+ s1++; -+ s2++; -+ } -+ return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) ); -+} -+#endif /* NF_NEED_STRNCASECMP */ -+ -+/* -+ * Parse a string containing a 16-bit unsigned integer. -+ * Returns the number of chars used, or zero if no number is found. -+ */ -+#ifdef NF_NEED_STRTOU16 -+static int -+nf_strtou16(const char* pbuf, u_int16_t* pval) -+{ -+ int n = 0; -+ -+ *pval = 0; -+ while (isdigit(pbuf[n])) -+ { -+ *pval = (*pval * 10) + (pbuf[n] - '0'); -+ n++; -+ } -+ -+ return n; -+} -+#endif /* NF_NEED_STRTOU16 */ -+ -+/* -+ * Parse a string containing a 32-bit unsigned integer. -+ * Returns the number of chars used, or zero if no number is found. -+ */ -+#ifdef NF_NEED_STRTOU32 -+static int -+nf_strtou32(const char* pbuf, u_int32_t* pval) -+{ -+ int n = 0; -+ -+ *pval = 0; -+ while (pbuf[n] >= '0' && pbuf[n] <= '9') -+ { -+ *pval = (*pval * 10) + (pbuf[n] - '0'); -+ n++; -+ } -+ -+ return n; -+} -+#endif /* NF_NEED_STRTOU32 */ -+ -+/* -+ * Given a buffer and length, advance to the next line and mark the current -+ * line. -+ */ -+#ifdef NF_NEED_NEXTLINE -+static int -+nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) -+{ -+ uint off = *poff; -+ uint physlen = 0; -+ -+ if (off >= len) -+ { -+ return 0; -+ } -+ -+ while (p[off] != '\n') -+ { -+ if (len-off <= 1) -+ { -+ return 0; -+ } -+ -+ physlen++; -+ off++; -+ } -+ -+ /* if we saw a crlf, physlen needs adjusted */ -+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') -+ { -+ physlen--; -+ } -+ -+ /* advance past the newline */ -+ off++; -+ -+ *plineoff = *poff; -+ *plinelen = physlen; -+ *poff = off; -+ -+ return 1; -+} -+#endif /* NF_NEED_NEXTLINE */ -+ -+#endif /* __KERNEL__ */ -+ -+#endif /* _NETFILTER_HELPERS_H */ -diff -Nur linux-2.6.33.orig/include/linux/netfilter_mime.h linux-2.6.33/include/linux/netfilter_mime.h ---- linux-2.6.33.orig/include/linux/netfilter_mime.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.33/include/linux/netfilter_mime.h 2010-04-25 01:09:20.000000000 +0200 -@@ -0,0 +1,89 @@ -+/* -+ * MIME functions for netfilter modules. This file provides implementations -+ * for basic MIME parsing. MIME headers are used in many protocols, such as -+ * HTTP, RTSP, SIP, etc. -+ * -+ * gcc will warn for defined but unused functions, so we only include the -+ * functions requested. The following macros are used: -+ * NF_NEED_MIME_NEXTLINE nf_mime_nextline() -+ */ -+#ifndef _NETFILTER_MIME_H -+#define _NETFILTER_MIME_H -+ -+/* Only include these functions for kernel code. */ -+#ifdef __KERNEL__ -+ -+#include -+ -+/* -+ * Given a buffer and length, advance to the next line and mark the current -+ * line. If the current line is empty, *plinelen will be set to zero. If -+ * not, it will be set to the actual line length (including CRLF). -+ * -+ * 'line' in this context means logical line (includes LWS continuations). -+ * Returns 1 on success, 0 on failure. -+ */ -+#ifdef NF_NEED_MIME_NEXTLINE -+static int -+nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) -+{ -+ uint off = *poff; -+ uint physlen = 0; -+ int is_first_line = 1; -+ -+ if (off >= len) -+ { -+ return 0; -+ } -+ -+ do -+ { -+ while (p[off] != '\n') -+ { -+ if (len-off <= 1) -+ { -+ return 0; -+ } -+ -+ physlen++; -+ off++; -+ } -+ -+ /* if we saw a crlf, physlen needs adjusted */ -+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') -+ { -+ physlen--; -+ } -+ -+ /* advance past the newline */ -+ off++; -+ -+ /* check for an empty line */ -+ if (physlen == 0) -+ { -+ break; -+ } -+ -+ /* check for colon on the first physical line */ -+ if (is_first_line) -+ { -+ is_first_line = 0; -+ if (memchr(p+(*poff), ':', physlen) == NULL) -+ { -+ return 0; -+ } -+ } -+ } -+ while (p[off] == ' ' || p[off] == '\t'); -+ -+ *plineoff = *poff; -+ *plinelen = (physlen == 0) ? 0 : (off - *poff); -+ *poff = off; -+ -+ return 1; -+} -+#endif /* NF_NEED_MIME_NEXTLINE */ -+ -+#endif /* __KERNEL__ */ -+ -+#endif /* _NETFILTER_MIME_H */ -diff -Nur linux-2.6.33.orig/net/ipv4/netfilter/Kconfig linux-2.6.33/net/ipv4/netfilter/Kconfig ---- linux-2.6.33.orig/net/ipv4/netfilter/Kconfig 2010-02-24 19:52:17.000000000 +0100 -+++ linux-2.6.33/net/ipv4/netfilter/Kconfig 2010-04-25 01:09:20.000000000 +0200 -@@ -257,6 +257,11 @@ - depends on NF_CONNTRACK && NF_NAT - default NF_NAT && NF_CONNTRACK_IRC - -+config NF_NAT_RTSP -+ tristate -+ depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT -+ default NF_NAT && NF_CONNTRACK_RTSP -+ - config NF_NAT_TFTP - tristate - depends on NF_CONNTRACK && NF_NAT -diff -Nur linux-2.6.33.orig/net/ipv4/netfilter/Makefile linux-2.6.33/net/ipv4/netfilter/Makefile ---- linux-2.6.33.orig/net/ipv4/netfilter/Makefile 2010-02-24 19:52:17.000000000 +0100 -+++ linux-2.6.33/net/ipv4/netfilter/Makefile 2010-04-25 01:09:20.000000000 +0200 -@@ -26,6 +26,7 @@ - obj-$(CONFIG_NF_NAT_FTP) += nf_nat_ftp.o - obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o - obj-$(CONFIG_NF_NAT_IRC) += nf_nat_irc.o -+obj-$(CONFIG_NF_NAT_RTSP) += nf_nat_rtsp.o - obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o - obj-$(CONFIG_NF_NAT_SIP) += nf_nat_sip.o - obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o -diff -Nur linux-2.6.33.orig/net/ipv4/netfilter/nf_nat_rtsp.c linux-2.6.33/net/ipv4/netfilter/nf_nat_rtsp.c ---- linux-2.6.33.orig/net/ipv4/netfilter/nf_nat_rtsp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.33/net/ipv4/netfilter/nf_nat_rtsp.c 2010-04-25 01:09:20.000000000 +0200 -@@ -0,0 +1,496 @@ -+/* -+ * RTSP extension for TCP NAT alteration -+ * (C) 2003 by Tom Marshall -+ * based on ip_nat_irc.c -+ * -+ * 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. -+ * -+ * Module load syntax: -+ * insmod nf_nat_rtsp.o ports=port1,port2,...port -+ * stunaddr=
-+ * destaction=[auto|strip|none] -+ * -+ * If no ports are specified, the default will be port 554 only. -+ * -+ * stunaddr specifies the address used to detect that a client is using STUN. -+ * If this address is seen in the destination parameter, it is assumed that -+ * the client has already punched a UDP hole in the firewall, so we don't -+ * mangle the client_port. If none is specified, it is autodetected. It -+ * only needs to be set if you have multiple levels of NAT. It should be -+ * set to the external address that the STUN clients detect. Note that in -+ * this case, it will not be possible for clients to use UDP with servers -+ * between the NATs. -+ * -+ * If no destaction is specified, auto is used. -+ * destaction=auto: strip destination parameter if it is not stunaddr. -+ * destaction=strip: always strip destination parameter (not recommended). -+ * destaction=none: do not touch destination parameter (not recommended). -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#define NF_NEED_STRNCASECMP -+#define NF_NEED_STRTOU16 -+#include -+#define NF_NEED_MIME_NEXTLINE -+#include -+ -+#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#if 0 -+#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#else -+#define DEBUGP(fmt, args...) -+#endif -+ -+#define MAX_PORTS 8 -+#define DSTACT_AUTO 0 -+#define DSTACT_STRIP 1 -+#define DSTACT_NONE 2 -+ -+static char* stunaddr = NULL; -+static char* destaction = NULL; -+ -+static u_int32_t extip = 0; -+static int dstact = 0; -+ -+MODULE_AUTHOR("Tom Marshall "); -+MODULE_DESCRIPTION("RTSP network address translation module"); -+MODULE_LICENSE("GPL"); -+module_param(stunaddr, charp, 0644); -+MODULE_PARM_DESC(stunaddr, "Address for detecting STUN"); -+module_param(destaction, charp, 0644); -+MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)"); -+ -+#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } -+ -+/*** helper functions ***/ -+ -+static void -+get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen) -+{ -+ struct iphdr* iph = ip_hdr(skb); -+ struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb); -+ -+ *pptcpdata = (char*)tcph + tcph->doff*4; -+ *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata; -+} -+ -+/*** nat functions ***/ -+ -+/* -+ * Mangle the "Transport:" header: -+ * - Replace all occurences of "client_port=" -+ * - Handle destination parameter -+ * -+ * In: -+ * ct, ctinfo = conntrack context -+ * skb = packet -+ * tranoff = Transport header offset from TCP data -+ * tranlen = Transport header length (incl. CRLF) -+ * rport_lo = replacement low port (host endian) -+ * rport_hi = replacement high port (host endian) -+ * -+ * Returns packet size difference. -+ * -+ * Assumes that a complete transport header is present, ending with CR or LF -+ */ -+static int -+rtsp_mangle_tran(enum ip_conntrack_info ctinfo, -+ struct nf_conntrack_expect* exp, -+ struct ip_ct_rtsp_expect* prtspexp, -+ struct sk_buff* skb, uint tranoff, uint tranlen) -+{ -+ char* ptcp; -+ uint tcplen; -+ char* ptran; -+ char rbuf1[16]; /* Replacement buffer (one port) */ -+ uint rbuf1len; /* Replacement len (one port) */ -+ char rbufa[16]; /* Replacement buffer (all ports) */ -+ uint rbufalen; /* Replacement len (all ports) */ -+ u_int32_t newip; -+ u_int16_t loport, hiport; -+ uint off = 0; -+ uint diff; /* Number of bytes we removed */ -+ -+ struct nf_conn *ct = exp->master; -+ struct nf_conntrack_tuple *t; -+ -+ char szextaddr[15+1]; -+ uint extaddrlen; -+ int is_stun; -+ -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ ptran = ptcp+tranoff; -+ -+ if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen || -+ tranlen < 10 || !iseol(ptran[tranlen-1]) || -+ nf_strncasecmp(ptran, "Transport:", 10) != 0) -+ { -+ INFOP("sanity check failed\n"); -+ return 0; -+ } -+ off += 10; -+ SKIP_WSPACE(ptcp+tranoff, tranlen, off); -+ -+ newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; -+ t = &exp->tuple; -+ t->dst.u3.ip = newip; -+ -+ extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip)) -+ : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip)); -+ DEBUGP("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto")); -+ -+ rbuf1len = rbufalen = 0; -+ switch (prtspexp->pbtype) -+ { -+ case pb_single: -+ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(loport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ DEBUGP("using port %hu\n", loport); -+ break; -+ } -+ } -+ if (loport != 0) -+ { -+ rbuf1len = sprintf(rbuf1, "%hu", loport); -+ rbufalen = sprintf(rbufa, "%hu", loport); -+ } -+ break; -+ case pb_range: -+ for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(loport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ hiport = loport + ~exp->mask.src.u.udp.port; -+ DEBUGP("using ports %hu-%hu\n", loport, hiport); -+ break; -+ } -+ } -+ if (loport != 0) -+ { -+ rbuf1len = sprintf(rbuf1, "%hu", loport); -+ rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1); -+ } -+ break; -+ case pb_discon: -+ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(loport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ DEBUGP("using port %hu (1 of 2)\n", loport); -+ break; -+ } -+ } -+ for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(hiport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ DEBUGP("using port %hu (2 of 2)\n", hiport); -+ break; -+ } -+ } -+ if (loport != 0 && hiport != 0) -+ { -+ rbuf1len = sprintf(rbuf1, "%hu", loport); -+ if (hiport == loport+1) -+ { -+ rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport); -+ } -+ else -+ { -+ rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport); -+ } -+ } -+ break; -+ } -+ -+ if (rbuf1len == 0) -+ { -+ return 0; /* cannot get replacement port(s) */ -+ } -+ -+ /* Transport: tran;field;field=val,tran;field;field=val,... */ -+ while (off < tranlen) -+ { -+ uint saveoff; -+ const char* pparamend; -+ uint nextparamoff; -+ -+ pparamend = memchr(ptran+off, ',', tranlen-off); -+ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; -+ nextparamoff = pparamend-ptcp; -+ -+ /* -+ * We pass over each param twice. On the first pass, we look for a -+ * destination= field. It is handled by the security policy. If it -+ * is present, allowed, and equal to our external address, we assume -+ * that STUN is being used and we leave the client_port= field alone. -+ */ -+ is_stun = 0; -+ saveoff = off; -+ while (off < nextparamoff) -+ { -+ const char* pfieldend; -+ uint nextfieldoff; -+ -+ pfieldend = memchr(ptran+off, ';', nextparamoff-off); -+ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; -+ -+ if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) -+ { -+ if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0) -+ { -+ is_stun = 1; -+ } -+ if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun)) -+ { -+ diff = nextfieldoff-off; -+ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, -+ off, diff, NULL, 0)) -+ { -+ /* mangle failed, all we can do is bail */ -+ nf_ct_unexpect_related(exp); -+ return 0; -+ } -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ ptran = ptcp+tranoff; -+ tranlen -= diff; -+ nextparamoff -= diff; -+ nextfieldoff -= diff; -+ } -+ } -+ -+ off = nextfieldoff; -+ } -+ if (is_stun) -+ { -+ continue; -+ } -+ off = saveoff; -+ while (off < nextparamoff) -+ { -+ const char* pfieldend; -+ uint nextfieldoff; -+ -+ pfieldend = memchr(ptran+off, ';', nextparamoff-off); -+ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; -+ -+ if (strncmp(ptran+off, "client_port=", 12) == 0) -+ { -+ u_int16_t port; -+ uint numlen; -+ uint origoff; -+ uint origlen; -+ char* rbuf = rbuf1; -+ uint rbuflen = rbuf1len; -+ -+ off += 12; -+ origoff = (ptran-ptcp)+off; -+ origlen = 0; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ origlen += numlen; -+ if (port != prtspexp->loport) -+ { -+ DEBUGP("multiple ports found, port %hu ignored\n", port); -+ } -+ else -+ { -+ if (ptran[off] == '-' || ptran[off] == '/') -+ { -+ off++; -+ origlen++; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ origlen += numlen; -+ rbuf = rbufa; -+ rbuflen = rbufalen; -+ } -+ -+ /* -+ * note we cannot just memcpy() if the sizes are the same. -+ * the mangle function does skb resizing, checks for a -+ * cloned skb, and updates the checksums. -+ * -+ * parameter 4 below is offset from start of tcp data. -+ */ -+ diff = origlen-rbuflen; -+ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, -+ origoff, origlen, rbuf, rbuflen)) -+ { -+ /* mangle failed, all we can do is bail */ -+ nf_ct_unexpect_related(exp); -+ return 0; -+ } -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ ptran = ptcp+tranoff; -+ tranlen -= diff; -+ nextparamoff -= diff; -+ nextfieldoff -= diff; -+ } -+ } -+ -+ off = nextfieldoff; -+ } -+ -+ off = nextparamoff; -+ } -+ -+ return 1; -+} -+ -+static uint -+help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, -+ struct nf_conntrack_expect* exp) -+{ -+ char* ptcp; -+ uint tcplen; -+ uint hdrsoff; -+ uint hdrslen; -+ uint lineoff; -+ uint linelen; -+ uint off; -+ -+ //struct iphdr* iph = (struct iphdr*)skb->nh.iph; -+ //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4); -+ -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq); -+ hdrslen = matchlen; -+ off = hdrsoff; -+ DEBUGP("NAT rtsp help_out\n"); -+ -+ while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen)) -+ { -+ if (linelen == 0) -+ { -+ break; -+ } -+ if (off > hdrsoff+hdrslen) -+ { -+ INFOP("!! overrun !!"); -+ break; -+ } -+ DEBUGP("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); -+ -+ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) -+ { -+ uint oldtcplen = tcplen; -+ DEBUGP("hdr: Transport\n"); -+ if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen)) -+ { -+ DEBUGP("hdr: Transport mangle failed"); -+ break; -+ } -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ hdrslen -= (oldtcplen-tcplen); -+ off -= (oldtcplen-tcplen); -+ lineoff -= (oldtcplen-tcplen); -+ linelen -= (oldtcplen-tcplen); -+ DEBUGP("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); -+ } -+ } -+ -+ return NF_ACCEPT; -+} -+ -+static unsigned int -+help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, -+ struct nf_conntrack_expect* exp) -+{ -+ int dir = CTINFO2DIR(ctinfo); -+ int rc = NF_ACCEPT; -+ -+ switch (dir) -+ { -+ case IP_CT_DIR_ORIGINAL: -+ rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp); -+ break; -+ case IP_CT_DIR_REPLY: -+ DEBUGP("unmangle ! %u\n", ctinfo); -+ /* XXX: unmangle */ -+ rc = NF_ACCEPT; -+ break; -+ } -+ //UNLOCK_BH(&ip_rtsp_lock); -+ -+ return rc; -+} -+ -+static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp) -+{ -+ struct nf_nat_multi_range_compat mr; -+ u_int32_t newdstip, newsrcip, newip; -+ -+ struct nf_conn *master = ct->master; -+ -+ newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; -+ newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; -+ //FIXME (how to port that ?) -+ //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip; -+ newip = newdstip; -+ -+ DEBUGP("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n", -+ NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip)); -+ -+ mr.rangesize = 1; -+ // We don't want to manip the per-protocol, just the IPs. -+ mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; -+ mr.range[0].min_ip = mr.range[0].max_ip = newip; -+ -+ nf_nat_setup_info(ct, &mr.range[0], IP_NAT_MANIP_DST); -+} -+ -+ -+static void __exit fini(void) -+{ -+ nf_nat_rtsp_hook = NULL; -+ nf_nat_rtsp_hook_expectfn = NULL; -+ synchronize_net(); -+} -+ -+static int __init init(void) -+{ -+ printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n"); -+ -+ BUG_ON(nf_nat_rtsp_hook); -+ nf_nat_rtsp_hook = help; -+ nf_nat_rtsp_hook_expectfn = &expected; -+ -+ if (stunaddr != NULL) -+ extip = in_aton(stunaddr); -+ -+ if (destaction != NULL) { -+ if (strcmp(destaction, "auto") == 0) -+ dstact = DSTACT_AUTO; -+ -+ if (strcmp(destaction, "strip") == 0) -+ dstact = DSTACT_STRIP; -+ -+ if (strcmp(destaction, "none") == 0) -+ dstact = DSTACT_NONE; -+ } -+ -+ return 0; -+} -+ -+module_init(init); -+module_exit(fini); -diff -Nur linux-2.6.33.orig/net/netfilter/Kconfig linux-2.6.33/net/netfilter/Kconfig ---- linux-2.6.33.orig/net/netfilter/Kconfig 2010-02-24 19:52:17.000000000 +0100 -+++ linux-2.6.33/net/netfilter/Kconfig 2010-04-25 01:09:20.000000000 +0200 -@@ -268,6 +268,16 @@ - - To compile it as a module, choose M here. If unsure, say N. - -+config NF_CONNTRACK_RTSP -+ tristate "RTSP protocol support" -+ depends on NF_CONNTRACK -+ help -+ Support the RTSP protocol. This allows UDP transports to be setup -+ properly, including RTP and RDT. -+ -+ If you want to compile it as a module, say 'M' here and read -+ Documentation/modules.txt. If unsure, say 'Y'. -+ - config NF_CT_NETLINK - tristate 'Connection tracking netlink interface' - select NETFILTER_NETLINK -diff -Nur linux-2.6.33.orig/net/netfilter/Kconfig.orig linux-2.6.33/net/netfilter/Kconfig.orig ---- linux-2.6.33.orig/net/netfilter/Kconfig.orig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.33/net/netfilter/Kconfig.orig 2010-02-24 19:52:17.000000000 +0100 -@@ -0,0 +1,937 @@ -+menu "Core Netfilter Configuration" -+ depends on NET && INET && NETFILTER -+ -+config NETFILTER_NETLINK -+ tristate -+ -+config NETFILTER_NETLINK_QUEUE -+ tristate "Netfilter NFQUEUE over NFNETLINK interface" -+ depends on NETFILTER_ADVANCED -+ select NETFILTER_NETLINK -+ help -+ If this option is enabled, the kernel will include support -+ for queueing packets via NFNETLINK. -+ -+config NETFILTER_NETLINK_LOG -+ tristate "Netfilter LOG over NFNETLINK interface" -+ default m if NETFILTER_ADVANCED=n -+ select NETFILTER_NETLINK -+ help -+ If this option is enabled, the kernel will include support -+ for logging packets via NFNETLINK. -+ -+ This obsoletes the existing ipt_ULOG and ebg_ulog mechanisms, -+ and is also scheduled to replace the old syslog-based ipt_LOG -+ and ip6t_LOG modules. -+ -+config NF_CONNTRACK -+ tristate "Netfilter connection tracking support" -+ default m if NETFILTER_ADVANCED=n -+ help -+ Connection tracking keeps a record of what packets have passed -+ through your machine, in order to figure out how they are related -+ into connections. -+ -+ This is required to do Masquerading or other kinds of Network -+ Address Translation. It can also be used to enhance packet -+ filtering (see `Connection state match support' below). -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+if NF_CONNTRACK -+ -+config NF_CT_ACCT -+ bool "Connection tracking flow accounting" -+ depends on NETFILTER_ADVANCED -+ help -+ If this option is enabled, the connection tracking code will -+ keep per-flow packet and byte counters. -+ -+ Those counters can be used for flow-based accounting or the -+ `connbytes' match. -+ -+ Please note that currently this option only sets a default state. -+ You may change it at boot time with nf_conntrack.acct=0/1 kernel -+ parameter or by loading the nf_conntrack module with acct=0/1. -+ -+ You may also disable/enable it on a running system with: -+ sysctl net.netfilter.nf_conntrack_acct=0/1 -+ -+ This option will be removed in 2.6.29. -+ -+ If unsure, say `N'. -+ -+config NF_CONNTRACK_MARK -+ bool 'Connection mark tracking support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option enables support for connection marks, used by the -+ `CONNMARK' target and `connmark' match. Similar to the mark value -+ of packets, but this mark value is kept in the conntrack session -+ instead of the individual packets. -+ -+config NF_CONNTRACK_SECMARK -+ bool 'Connection tracking security mark support' -+ depends on NETWORK_SECMARK -+ default m if NETFILTER_ADVANCED=n -+ help -+ This option enables security markings to be applied to -+ connections. Typically they are copied to connections from -+ packets using the CONNSECMARK target and copied back from -+ connections to packets with the same target, with the packets -+ being originally labeled via SECMARK. -+ -+ If unsure, say 'N'. -+ -+config NF_CONNTRACK_EVENTS -+ bool "Connection tracking events" -+ depends on NETFILTER_ADVANCED -+ help -+ If this option is enabled, the connection tracking code will -+ provide a notifier chain that can be used by other kernel code -+ to get notified about changes in the connection tracking state. -+ -+ If unsure, say `N'. -+ -+config NF_CT_PROTO_DCCP -+ tristate 'DCCP protocol connection tracking support (EXPERIMENTAL)' -+ depends on EXPERIMENTAL -+ depends on NETFILTER_ADVANCED -+ default IP_DCCP -+ help -+ With this option enabled, the layer 3 independent connection -+ tracking code will be able to do state tracking on DCCP connections. -+ -+ If unsure, say 'N'. -+ -+config NF_CT_PROTO_GRE -+ tristate -+ -+config NF_CT_PROTO_SCTP -+ tristate 'SCTP protocol connection tracking support (EXPERIMENTAL)' -+ depends on EXPERIMENTAL -+ depends on NETFILTER_ADVANCED -+ default IP_SCTP -+ help -+ With this option enabled, the layer 3 independent connection -+ tracking code will be able to do state tracking on SCTP connections. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NF_CT_PROTO_UDPLITE -+ tristate 'UDP-Lite protocol connection tracking support' -+ depends on NETFILTER_ADVANCED -+ help -+ With this option enabled, the layer 3 independent connection -+ tracking code will be able to do state tracking on UDP-Lite -+ connections. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_AMANDA -+ tristate "Amanda backup protocol support" -+ depends on NETFILTER_ADVANCED -+ select TEXTSEARCH -+ select TEXTSEARCH_KMP -+ help -+ If you are running the Amanda backup package -+ on this machine or machines that will be MASQUERADED through this -+ machine, then you may want to enable this feature. This allows the -+ connection tracking and natting code to allow the sub-channels that -+ Amanda requires for communication of the backup data, messages and -+ index. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_FTP -+ tristate "FTP protocol support" -+ default m if NETFILTER_ADVANCED=n -+ help -+ Tracking FTP connections is problematic: special helpers are -+ required for tracking them, and doing masquerading and other forms -+ of Network Address Translation on them. -+ -+ This is FTP support on Layer 3 independent connection tracking. -+ Layer 3 independent connection tracking is experimental scheme -+ which generalize ip_conntrack to support other layer 3 protocols. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_H323 -+ tristate "H.323 protocol support" -+ depends on (IPV6 || IPV6=n) -+ depends on NETFILTER_ADVANCED -+ help -+ H.323 is a VoIP signalling protocol from ITU-T. As one of the most -+ important VoIP protocols, it is widely used by voice hardware and -+ software including voice gateways, IP phones, Netmeeting, OpenPhone, -+ Gnomemeeting, etc. -+ -+ With this module you can support H.323 on a connection tracking/NAT -+ firewall. -+ -+ This module supports RAS, Fast Start, H.245 Tunnelling, Call -+ Forwarding, RTP/RTCP and T.120 based audio, video, fax, chat, -+ whiteboard, file transfer, etc. For more information, please -+ visit http://nath323.sourceforge.net/. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_IRC -+ tristate "IRC protocol support" -+ default m if NETFILTER_ADVANCED=n -+ help -+ There is a commonly-used extension to IRC called -+ Direct Client-to-Client Protocol (DCC). This enables users to send -+ files to each other, and also chat to each other without the need -+ of a server. DCC Sending is used anywhere you send files over IRC, -+ and DCC Chat is most commonly used by Eggdrop bots. If you are -+ using NAT, this extension will enable you to send files and initiate -+ chats. Note that you do NOT need this extension to get files or -+ have others initiate chats, or everything else in IRC. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_NETBIOS_NS -+ tristate "NetBIOS name service protocol support" -+ depends on NETFILTER_ADVANCED -+ help -+ NetBIOS name service requests are sent as broadcast messages from an -+ unprivileged port and responded to with unicast messages to the -+ same port. This make them hard to firewall properly because connection -+ tracking doesn't deal with broadcasts. This helper tracks locally -+ originating NetBIOS name service requests and the corresponding -+ responses. It relies on correct IP address configuration, specifically -+ netmask and broadcast address. When properly configured, the output -+ of "ip address show" should look similar to this: -+ -+ $ ip -4 address show eth0 -+ 4: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 -+ inet 172.16.2.252/24 brd 172.16.2.255 scope global eth0 -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_PPTP -+ tristate "PPtP protocol support" -+ depends on NETFILTER_ADVANCED -+ select NF_CT_PROTO_GRE -+ help -+ This module adds support for PPTP (Point to Point Tunnelling -+ Protocol, RFC2637) connection tracking and NAT. -+ -+ If you are running PPTP sessions over a stateful firewall or NAT -+ box, you may want to enable this feature. -+ -+ Please note that not all PPTP modes of operation are supported yet. -+ Specifically these limitations exist: -+ - Blindly assumes that control connections are always established -+ in PNS->PAC direction. This is a violation of RFC2637. -+ - Only supports a single call within each session -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_SANE -+ tristate "SANE protocol support (EXPERIMENTAL)" -+ depends on EXPERIMENTAL -+ depends on NETFILTER_ADVANCED -+ help -+ SANE is a protocol for remote access to scanners as implemented -+ by the 'saned' daemon. Like FTP, it uses separate control and -+ data connections. -+ -+ With this module you can support SANE on a connection tracking -+ firewall. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_SIP -+ tristate "SIP protocol support" -+ default m if NETFILTER_ADVANCED=n -+ help -+ SIP is an application-layer control protocol that can establish, -+ modify, and terminate multimedia sessions (conferences) such as -+ Internet telephony calls. With the ip_conntrack_sip and -+ the nf_nat_sip modules you can support the protocol on a connection -+ tracking/NATing firewall. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CONNTRACK_TFTP -+ tristate "TFTP protocol support" -+ depends on NETFILTER_ADVANCED -+ help -+ TFTP connection tracking helper, this is required depending -+ on how restrictive your ruleset is. -+ If you are using a tftp client behind -j SNAT or -j MASQUERADING -+ you will need this. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NF_CT_NETLINK -+ tristate 'Connection tracking netlink interface' -+ select NETFILTER_NETLINK -+ default m if NETFILTER_ADVANCED=n -+ help -+ This option enables support for a netlink-based userspace interface -+ -+endif # NF_CONNTRACK -+ -+# transparent proxy support -+config NETFILTER_TPROXY -+ tristate "Transparent proxying support (EXPERIMENTAL)" -+ depends on EXPERIMENTAL -+ depends on IP_NF_MANGLE -+ depends on NETFILTER_ADVANCED -+ help -+ This option enables transparent proxying support, that is, -+ support for handling non-locally bound IPv4 TCP and UDP sockets. -+ For it to work you will have to configure certain iptables rules -+ and use policy routing. For more information on how to set it up -+ see Documentation/networking/tproxy.txt. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XTABLES -+ tristate "Netfilter Xtables support (required for ip_tables)" -+ default m if NETFILTER_ADVANCED=n -+ help -+ This is required if you intend to use any of ip_tables, -+ ip6_tables or arp_tables. -+ -+if NETFILTER_XTABLES -+ -+# alphabetically ordered list of targets -+ -+config NETFILTER_XT_TARGET_CLASSIFY -+ tristate '"CLASSIFY" target support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `CLASSIFY' target, which enables the user to set -+ the priority of a packet. Some qdiscs can use this value for -+ classification, among these are: -+ -+ atm, cbq, dsmark, pfifo_fast, htb, prio -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_CONNMARK -+ tristate '"CONNMARK" target support' -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ select NF_CONNTRACK_MARK -+ help -+ This option adds a `CONNMARK' target, which allows one to manipulate -+ the connection mark value. Similar to the MARK target, but -+ affects the connection mark value rather than the packet mark value. -+ -+ If you want to compile it as a module, say M here and read -+ . The module will be called -+ ipt_CONNMARK. If unsure, say `N'. -+ -+config NETFILTER_XT_TARGET_CONNSECMARK -+ tristate '"CONNSECMARK" target support' -+ depends on NF_CONNTRACK && NF_CONNTRACK_SECMARK -+ default m if NETFILTER_ADVANCED=n -+ help -+ The CONNSECMARK target copies security markings from packets -+ to connections, and restores security markings from connections -+ to packets (if the packets are not already marked). This would -+ normally be used in conjunction with the SECMARK target. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_DSCP -+ tristate '"DSCP" and "TOS" target support' -+ depends on IP_NF_MANGLE || IP6_NF_MANGLE -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `DSCP' target, which allows you to manipulate -+ the IPv4/IPv6 header DSCP field (differentiated services codepoint). -+ -+ The DSCP field can have any value between 0x0 and 0x3f inclusive. -+ -+ It also adds the "TOS" target, which allows you to create rules in -+ the "mangle" table which alter the Type Of Service field of an IPv4 -+ or the Priority field of an IPv6 packet, prior to routing. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_HL -+ tristate '"HL" hoplimit target support' -+ depends on IP_NF_MANGLE || IP6_NF_MANGLE -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option adds the "HL" (for IPv6) and "TTL" (for IPv4) -+ targets, which enable the user to change the -+ hoplimit/time-to-live value of the IP header. -+ -+ While it is safe to decrement the hoplimit/TTL value, the -+ modules also allow to increment and set the hoplimit value of -+ the header to arbitrary values. This is EXTREMELY DANGEROUS -+ since you can easily create immortal packets that loop -+ forever on the network. -+ -+config NETFILTER_XT_TARGET_LED -+ tristate '"LED" target support' -+ depends on LEDS_CLASS && LEDS_TRIGGERS -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `LED' target, which allows you to blink LEDs in -+ response to particular packets passing through your machine. -+ -+ This can be used to turn a spare LED into a network activity LED, -+ which only flashes in response to FTP transfers, for example. Or -+ you could have an LED which lights up for a minute or two every time -+ somebody connects to your machine via SSH. -+ -+ You will need support for the "led" class to make this work. -+ -+ To create an LED trigger for incoming SSH traffic: -+ iptables -A INPUT -p tcp --dport 22 -j LED --led-trigger-id ssh --led-delay 1000 -+ -+ Then attach the new trigger to an LED on your system: -+ echo netfilter-ssh > /sys/class/leds//trigger -+ -+ For more information on the LEDs available on your system, see -+ Documentation/leds-class.txt -+ -+config NETFILTER_XT_TARGET_MARK -+ tristate '"MARK" target support' -+ default m if NETFILTER_ADVANCED=n -+ help -+ This option adds a `MARK' target, which allows you to create rules -+ in the `mangle' table which alter the netfilter mark (nfmark) field -+ associated with the packet prior to routing. This can change -+ the routing method (see `Use netfilter MARK value as routing -+ key') and can also be used by other subsystems to change their -+ behavior. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_NFLOG -+ tristate '"NFLOG" target support' -+ default m if NETFILTER_ADVANCED=n -+ select NETFILTER_NETLINK_LOG -+ help -+ This option enables the NFLOG target, which allows to LOG -+ messages through nfnetlink_log. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_NFQUEUE -+ tristate '"NFQUEUE" target Support' -+ depends on NETFILTER_ADVANCED -+ help -+ This target replaced the old obsolete QUEUE target. -+ -+ As opposed to QUEUE, it supports 65535 different queues, -+ not just one. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_NOTRACK -+ tristate '"NOTRACK" target support' -+ depends on IP_NF_RAW || IP6_NF_RAW -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ help -+ The NOTRACK target allows a select rule to specify -+ which packets *not* to enter the conntrack/NAT -+ subsystem with all the consequences (no ICMP error tracking, -+ no protocol helpers for the selected packets). -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_TARGET_RATEEST -+ tristate '"RATEEST" target support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `RATEEST' target, which allows to measure -+ rates similar to TC estimators. The `rateest' match can be -+ used to match on the measured rates. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_TPROXY -+ tristate '"TPROXY" target support (EXPERIMENTAL)' -+ depends on EXPERIMENTAL -+ depends on NETFILTER_TPROXY -+ depends on NETFILTER_XTABLES -+ depends on NETFILTER_ADVANCED -+ select NF_DEFRAG_IPV4 -+ help -+ This option adds a `TPROXY' target, which is somewhat similar to -+ REDIRECT. It can only be used in the mangle table and is useful -+ to redirect traffic to a transparent proxy. It does _not_ depend -+ on Netfilter connection tracking and NAT, unlike REDIRECT. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_TRACE -+ tristate '"TRACE" target support' -+ depends on IP_NF_RAW || IP6_NF_RAW -+ depends on NETFILTER_ADVANCED -+ help -+ The TRACE target allows you to mark packets so that the kernel -+ will log every rule which match the packets as those traverse -+ the tables, chains, rules. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_TARGET_SECMARK -+ tristate '"SECMARK" target support' -+ depends on NETWORK_SECMARK -+ default m if NETFILTER_ADVANCED=n -+ help -+ The SECMARK target allows security marking of network -+ packets, for use with security subsystems. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_TCPMSS -+ tristate '"TCPMSS" target support' -+ depends on (IPV6 || IPV6=n) -+ default m if NETFILTER_ADVANCED=n -+ ---help--- -+ This option adds a `TCPMSS' target, which allows you to alter the -+ MSS value of TCP SYN packets, to control the maximum size for that -+ connection (usually limiting it to your outgoing interface's MTU -+ minus 40). -+ -+ This is used to overcome criminally braindead ISPs or servers which -+ block ICMP Fragmentation Needed packets. The symptoms of this -+ problem are that everything works fine from your Linux -+ firewall/router, but machines behind it can never exchange large -+ packets: -+ 1) Web browsers connect, then hang with no data received. -+ 2) Small mail works fine, but large emails hang. -+ 3) ssh works fine, but scp hangs after initial handshaking. -+ -+ Workaround: activate this option and add a rule to your firewall -+ configuration like: -+ -+ iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN \ -+ -j TCPMSS --clamp-mss-to-pmtu -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_TARGET_TCPOPTSTRIP -+ tristate '"TCPOPTSTRIP" target support (EXPERIMENTAL)' -+ depends on EXPERIMENTAL -+ depends on IP_NF_MANGLE || IP6_NF_MANGLE -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a "TCPOPTSTRIP" target, which allows you to strip -+ TCP options from TCP packets. -+ -+config NETFILTER_XT_MATCH_CLUSTER -+ tristate '"cluster" match support' -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option allows you to build work-load-sharing clusters of -+ network servers/stateful firewalls without having a dedicated -+ load-balancing router/server/switch. Basically, this match returns -+ true when the packet must be handled by this cluster node. Thus, -+ all nodes see all packets and this match decides which node handles -+ what packets. The work-load sharing algorithm is based on source -+ address hashing. -+ -+ If you say Y or M here, try `iptables -m cluster --help` for -+ more information. -+ -+config NETFILTER_XT_MATCH_COMMENT -+ tristate '"comment" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `comment' dummy-match, which allows you to put -+ comments in your iptables ruleset. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_CONNBYTES -+ tristate '"connbytes" per-connection counter match support' -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ select NF_CT_ACCT -+ help -+ This option adds a `connbytes' match, which allows you to match the -+ number of bytes and/or packets for each direction within a connection. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_CONNLIMIT -+ tristate '"connlimit" match support"' -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This match allows you to match against the number of parallel -+ connections to a server per client IP address (or address block). -+ -+config NETFILTER_XT_MATCH_CONNMARK -+ tristate '"connmark" connection mark match support' -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ select NF_CONNTRACK_MARK -+ help -+ This option adds a `connmark' match, which allows you to match the -+ connection mark value previously set for the session by `CONNMARK'. -+ -+ If you want to compile it as a module, say M here and read -+ . The module will be called -+ ipt_connmark. If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_CONNTRACK -+ tristate '"conntrack" connection tracking match support' -+ depends on NF_CONNTRACK -+ default m if NETFILTER_ADVANCED=n -+ help -+ This is a general conntrack match module, a superset of the state match. -+ -+ It allows matching on additional conntrack information, which is -+ useful in complex configurations, such as NAT gateways with multiple -+ internet links or tunnels. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_DCCP -+ tristate '"dccp" protocol match support' -+ depends on NETFILTER_ADVANCED -+ default IP_DCCP -+ help -+ With this option enabled, you will be able to use the iptables -+ `dccp' match in order to match on DCCP source/destination ports -+ and DCCP flags. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_DSCP -+ tristate '"dscp" and "tos" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `DSCP' match, which allows you to match against -+ the IPv4/IPv6 header DSCP field (differentiated services codepoint). -+ -+ The DSCP field can have any value between 0x0 and 0x3f inclusive. -+ -+ It will also add a "tos" match, which allows you to match packets -+ based on the Type Of Service fields of the IPv4 packet (which share -+ the same bits as DSCP). -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_ESP -+ tristate '"esp" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This match extension allows you to match a range of SPIs -+ inside ESP header of IPSec packets. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_HASHLIMIT -+ tristate '"hashlimit" match support' -+ depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `hashlimit' match. -+ -+ As opposed to `limit', this match dynamically creates a hash table -+ of limit buckets, based on your selection of source/destination -+ addresses and/or ports. -+ -+ It enables you to express policies like `10kpps for any given -+ destination address' or `500pps from any given source address' -+ with a single rule. -+ -+config NETFILTER_XT_MATCH_HELPER -+ tristate '"helper" match support' -+ depends on NF_CONNTRACK -+ depends on NETFILTER_ADVANCED -+ help -+ Helper matching allows you to match packets in dynamic connections -+ tracked by a conntrack-helper, ie. ip_conntrack_ftp -+ -+ To compile it as a module, choose M here. If unsure, say Y. -+ -+config NETFILTER_XT_MATCH_HL -+ tristate '"hl" hoplimit/TTL match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ HL matching allows you to match packets based on the hoplimit -+ in the IPv6 header, or the time-to-live field in the IPv4 -+ header of the packet. -+ -+config NETFILTER_XT_MATCH_IPRANGE -+ tristate '"iprange" address range match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option adds a "iprange" match, which allows you to match based on -+ an IP address range. (Normal iptables only matches on single addresses -+ with an optional mask.) -+ -+ If unsure, say M. -+ -+config NETFILTER_XT_MATCH_LENGTH -+ tristate '"length" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option allows you to match the length of a packet against a -+ specific value or range of values. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_LIMIT -+ tristate '"limit" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ limit matching allows you to control the rate at which a rule can be -+ matched: mainly useful in combination with the LOG target ("LOG -+ target support", below) and to avoid some Denial of Service attacks. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_MAC -+ tristate '"mac" address match support' -+ depends on NETFILTER_ADVANCED -+ help -+ MAC matching allows you to match packets based on the source -+ Ethernet address of the packet. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_MARK -+ tristate '"mark" match support' -+ default m if NETFILTER_ADVANCED=n -+ help -+ Netfilter mark matching allows you to match packets based on the -+ `nfmark' value in the packet. This can be set by the MARK target -+ (see below). -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_MULTIPORT -+ tristate '"multiport" Multiple port match support' -+ depends on NETFILTER_ADVANCED -+ help -+ Multiport matching allows you to match TCP or UDP packets based on -+ a series of source or destination ports: normally a rule can only -+ match a single range of ports. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_OWNER -+ tristate '"owner" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ Socket owner matching allows you to match locally-generated packets -+ based on who created the socket: the user or group. It is also -+ possible to check whether a socket actually exists. -+ -+config NETFILTER_XT_MATCH_POLICY -+ tristate 'IPsec "policy" match support' -+ depends on XFRM -+ default m if NETFILTER_ADVANCED=n -+ help -+ Policy matching allows you to match packets based on the -+ IPsec policy that was used during decapsulation/will -+ be used during encapsulation. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_PHYSDEV -+ tristate '"physdev" match support' -+ depends on BRIDGE && BRIDGE_NETFILTER -+ depends on NETFILTER_ADVANCED -+ help -+ Physdev packet matching matches against the physical bridge ports -+ the IP packet arrived on or will leave by. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_PKTTYPE -+ tristate '"pkttype" packet type match support' -+ depends on NETFILTER_ADVANCED -+ help -+ Packet type matching allows you to match a packet by -+ its "class", eg. BROADCAST, MULTICAST, ... -+ -+ Typical usage: -+ iptables -A INPUT -m pkttype --pkt-type broadcast -j LOG -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_QUOTA -+ tristate '"quota" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `quota' match, which allows to match on a -+ byte counter. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_RATEEST -+ tristate '"rateest" match support' -+ depends on NETFILTER_ADVANCED -+ select NETFILTER_XT_TARGET_RATEEST -+ help -+ This option adds a `rateest' match, which allows to match on the -+ rate estimated by the RATEEST target. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_REALM -+ tristate '"realm" match support' -+ depends on NETFILTER_ADVANCED -+ select NET_CLS_ROUTE -+ help -+ This option adds a `realm' match, which allows you to use the realm -+ key from the routing subsystem inside iptables. -+ -+ This match pretty much resembles the CONFIG_NET_CLS_ROUTE4 option -+ in tc world. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_RECENT -+ tristate '"recent" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This match is used for creating one or many lists of recently -+ used addresses and then matching against that/those list(s). -+ -+ Short options are available by using 'iptables -m recent -h' -+ Official Website: -+ -+config NETFILTER_XT_MATCH_RECENT_PROC_COMPAT -+ bool 'Enable obsolete /proc/net/ipt_recent' -+ depends on NETFILTER_XT_MATCH_RECENT && PROC_FS -+ ---help--- -+ This option enables the old /proc/net/ipt_recent interface, -+ which has been obsoleted by /proc/net/xt_recent. -+ -+config NETFILTER_XT_MATCH_SCTP -+ tristate '"sctp" protocol match support (EXPERIMENTAL)' -+ depends on EXPERIMENTAL -+ depends on NETFILTER_ADVANCED -+ default IP_SCTP -+ help -+ With this option enabled, you will be able to use the -+ `sctp' match in order to match on SCTP source/destination ports -+ and SCTP chunk types. -+ -+ If you want to compile it as a module, say M here and read -+ . If unsure, say `N'. -+ -+config NETFILTER_XT_MATCH_SOCKET -+ tristate '"socket" match support (EXPERIMENTAL)' -+ depends on EXPERIMENTAL -+ depends on NETFILTER_TPROXY -+ depends on NETFILTER_XTABLES -+ depends on NETFILTER_ADVANCED -+ depends on !NF_CONNTRACK || NF_CONNTRACK -+ select NF_DEFRAG_IPV4 -+ help -+ This option adds a `socket' match, which can be used to match -+ packets for which a TCP or UDP socket lookup finds a valid socket. -+ It can be used in combination with the MARK target and policy -+ routing to implement full featured non-locally bound sockets. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_STATE -+ tristate '"state" match support' -+ depends on NF_CONNTRACK -+ default m if NETFILTER_ADVANCED=n -+ help -+ Connection state matching allows you to match packets based on their -+ relationship to a tracked connection (ie. previous packets). This -+ is a powerful tool for packet classification. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_STATISTIC -+ tristate '"statistic" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `statistic' match, which allows you to match -+ on packets periodically or randomly with a given percentage. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_STRING -+ tristate '"string" match support' -+ depends on NETFILTER_ADVANCED -+ select TEXTSEARCH -+ select TEXTSEARCH_KMP -+ select TEXTSEARCH_BM -+ select TEXTSEARCH_FSM -+ help -+ This option adds a `string' match, which allows you to look for -+ pattern matchings in packets. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_TCPMSS -+ tristate '"tcpmss" match support' -+ depends on NETFILTER_ADVANCED -+ help -+ This option adds a `tcpmss' match, which allows you to examine the -+ MSS value of TCP SYN packets, which control the maximum packet size -+ for that connection. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_TIME -+ tristate '"time" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ This option adds a "time" match, which allows you to match based on -+ the packet arrival time (at the machine which netfilter is running) -+ on) or departure time/date (for locally generated packets). -+ -+ If you say Y here, try `iptables -m time --help` for -+ more information. -+ -+ If you want to compile it as a module, say M here. -+ If unsure, say N. -+ -+config NETFILTER_XT_MATCH_U32 -+ tristate '"u32" match support' -+ depends on NETFILTER_ADVANCED -+ ---help--- -+ u32 allows you to extract quantities of up to 4 bytes from a packet, -+ AND them with specified masks, shift them by specified amounts and -+ test whether the results are in any of a set of specified ranges. -+ The specification of what to extract is general enough to skip over -+ headers with lengths stored in the packet, as in IP or TCP header -+ lengths. -+ -+ Details and examples are in the kernel module source. -+ -+config NETFILTER_XT_MATCH_OSF -+ tristate '"osf" Passive OS fingerprint match' -+ depends on NETFILTER_ADVANCED && NETFILTER_NETLINK -+ help -+ This option selects the Passive OS Fingerprinting match module -+ that allows to passively match the remote operating system by -+ analyzing incoming TCP SYN packets. -+ -+ Rules and loading software can be downloaded from -+ http://www.ioremap.net/projects/osf -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+endif # NETFILTER_XTABLES -+ -+endmenu -+ -+source "net/netfilter/ipvs/Kconfig" -diff -Nur linux-2.6.33.orig/net/netfilter/Makefile linux-2.6.33/net/netfilter/Makefile ---- linux-2.6.33.orig/net/netfilter/Makefile 2010-02-24 19:52:17.000000000 +0100 -+++ linux-2.6.33/net/netfilter/Makefile 2010-04-25 01:09:20.000000000 +0200 -@@ -33,6 +33,7 @@ - obj-$(CONFIG_NF_CONNTRACK_SANE) += nf_conntrack_sane.o - obj-$(CONFIG_NF_CONNTRACK_SIP) += nf_conntrack_sip.o - obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_conntrack_tftp.o -+obj-$(CONFIG_NF_CONNTRACK_RTSP) += nf_conntrack_rtsp.o - - # transparent proxy support - obj-$(CONFIG_NETFILTER_TPROXY) += nf_tproxy_core.o -diff -Nur linux-2.6.33.orig/net/netfilter/nf_conntrack_rtsp.c linux-2.6.33/net/netfilter/nf_conntrack_rtsp.c ---- linux-2.6.33.orig/net/netfilter/nf_conntrack_rtsp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.33/net/netfilter/nf_conntrack_rtsp.c 2010-04-25 01:09:20.000000000 +0200 -@@ -0,0 +1,517 @@ -+/* -+ * RTSP extension for IP connection tracking -+ * (C) 2003 by Tom Marshall -+ * based on ip_conntrack_irc.c -+ * -+ * 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. -+ * -+ * Module load syntax: -+ * insmod nf_conntrack_rtsp.o ports=port1,port2,...port -+ * max_outstanding=n setup_timeout=secs -+ * -+ * If no ports are specified, the default will be port 554. -+ * -+ * With max_outstanding you can define the maximum number of not yet -+ * answered SETUP requests per RTSP session (default 8). -+ * With setup_timeout you can specify how long the system waits for -+ * an expected data channel (default 300 seconds). -+ * -+ * 2005-02-13: Harald Welte -+ * - port to 2.6 -+ * - update to recent post-2.6.11 api changes -+ * 2006-09-14: Steven Van Acker -+ * - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack -+ * 2007-04-18: Michael Guntsche -+ * - Port to new NF API -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#define NF_NEED_STRNCASECMP -+#define NF_NEED_STRTOU16 -+#define NF_NEED_STRTOU32 -+#define NF_NEED_NEXTLINE -+#include -+#define NF_NEED_MIME_NEXTLINE -+#include -+ -+#include -+#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */ -+#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#if 0 -+#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#else -+#define DEBUGP(fmt, args...) -+#endif -+ -+#define MAX_PORTS 8 -+static int ports[MAX_PORTS]; -+static int num_ports = 0; -+static int max_outstanding = 8; -+static unsigned int setup_timeout = 300; -+ -+MODULE_AUTHOR("Tom Marshall "); -+MODULE_DESCRIPTION("RTSP connection tracking module"); -+MODULE_LICENSE("GPL"); -+module_param_array(ports, int, &num_ports, 0400); -+MODULE_PARM_DESC(ports, "port numbers of RTSP servers"); -+module_param(max_outstanding, int, 0400); -+MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session"); -+module_param(setup_timeout, int, 0400); -+MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels"); -+ -+static char *rtsp_buffer; -+static DEFINE_SPINLOCK(rtsp_buffer_lock); -+ -+unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, -+ enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp, -+ struct nf_conntrack_expect *exp); -+void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); -+ -+EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook); -+ -+/* -+ * Max mappings we will allow for one RTSP connection (for RTP, the number -+ * of allocated ports is twice this value). Note that SMIL burns a lot of -+ * ports so keep this reasonably high. If this is too low, you will see a -+ * lot of "no free client map entries" messages. -+ */ -+#define MAX_PORT_MAPS 16 -+ -+/*** default port list was here in the masq code: 554, 3030, 4040 ***/ -+ -+#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } -+ -+/* -+ * Parse an RTSP packet. -+ * -+ * Returns zero if parsing failed. -+ * -+ * Parameters: -+ * IN ptcp tcp data pointer -+ * IN tcplen tcp data len -+ * IN/OUT ptcpoff points to current tcp offset -+ * OUT phdrsoff set to offset of rtsp headers -+ * OUT phdrslen set to length of rtsp headers -+ * OUT pcseqoff set to offset of CSeq header -+ * OUT pcseqlen set to length of CSeq header -+ */ -+static int -+rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff, -+ uint* phdrsoff, uint* phdrslen, -+ uint* pcseqoff, uint* pcseqlen, -+ uint* transoff, uint* translen) -+{ -+ uint entitylen = 0; -+ uint lineoff; -+ uint linelen; -+ -+ if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) -+ return 0; -+ -+ *phdrsoff = *ptcpoff; -+ while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) { -+ if (linelen == 0) { -+ if (entitylen > 0) -+ *ptcpoff += min(entitylen, tcplen - *ptcpoff); -+ break; -+ } -+ if (lineoff+linelen > tcplen) { -+ INFOP("!! overrun !!\n"); -+ break; -+ } -+ -+ if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) { -+ *pcseqoff = lineoff; -+ *pcseqlen = linelen; -+ } -+ -+ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) { -+ *transoff = lineoff; -+ *translen = linelen; -+ } -+ -+ if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) { -+ uint off = lineoff+15; -+ SKIP_WSPACE(ptcp+lineoff, linelen, off); -+ nf_strtou32(ptcp+off, &entitylen); -+ } -+ } -+ *phdrslen = (*ptcpoff) - (*phdrsoff); -+ -+ return 1; -+} -+ -+/* -+ * Find lo/hi client ports (if any) in transport header -+ * In: -+ * ptcp, tcplen = packet -+ * tranoff, tranlen = buffer to search -+ * -+ * Out: -+ * pport_lo, pport_hi = lo/hi ports (host endian) -+ * -+ * Returns nonzero if any client ports found -+ * -+ * Note: it is valid (and expected) for the client to request multiple -+ * transports, so we need to parse the entire line. -+ */ -+static int -+rtsp_parse_transport(char* ptran, uint tranlen, -+ struct ip_ct_rtsp_expect* prtspexp) -+{ -+ int rc = 0; -+ uint off = 0; -+ -+ if (tranlen < 10 || !iseol(ptran[tranlen-1]) || -+ nf_strncasecmp(ptran, "Transport:", 10) != 0) { -+ INFOP("sanity check failed\n"); -+ return 0; -+ } -+ -+ DEBUGP("tran='%.*s'\n", (int)tranlen, ptran); -+ off += 10; -+ SKIP_WSPACE(ptran, tranlen, off); -+ -+ /* Transport: tran;field;field=val,tran;field;field=val,... */ -+ while (off < tranlen) { -+ const char* pparamend; -+ uint nextparamoff; -+ -+ pparamend = memchr(ptran+off, ',', tranlen-off); -+ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; -+ nextparamoff = pparamend-ptran; -+ -+ while (off < nextparamoff) { -+ const char* pfieldend; -+ uint nextfieldoff; -+ -+ pfieldend = memchr(ptran+off, ';', nextparamoff-off); -+ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; -+ -+ if (strncmp(ptran+off, "client_port=", 12) == 0) { -+ u_int16_t port; -+ uint numlen; -+ -+ off += 12; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ if (prtspexp->loport != 0 && prtspexp->loport != port) -+ DEBUGP("multiple ports found, port %hu ignored\n", port); -+ else { -+ DEBUGP("lo port found : %hu\n", port); -+ prtspexp->loport = prtspexp->hiport = port; -+ if (ptran[off] == '-') { -+ off++; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ prtspexp->pbtype = pb_range; -+ prtspexp->hiport = port; -+ -+ // If we have a range, assume rtp: -+ // loport must be even, hiport must be loport+1 -+ if ((prtspexp->loport & 0x0001) != 0 || -+ prtspexp->hiport != prtspexp->loport+1) { -+ DEBUGP("incorrect range: %hu-%hu, correcting\n", -+ prtspexp->loport, prtspexp->hiport); -+ prtspexp->loport &= 0xfffe; -+ prtspexp->hiport = prtspexp->loport+1; -+ } -+ } else if (ptran[off] == '/') { -+ off++; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ prtspexp->pbtype = pb_discon; -+ prtspexp->hiport = port; -+ } -+ rc = 1; -+ } -+ } -+ -+ /* -+ * Note we don't look for the destination parameter here. -+ * If we are using NAT, the NAT module will handle it. If not, -+ * and the client is sending packets elsewhere, the expectation -+ * will quietly time out. -+ */ -+ -+ off = nextfieldoff; -+ } -+ -+ off = nextparamoff; -+ } -+ -+ return rc; -+} -+ -+void expected(struct nf_conn *ct, struct nf_conntrack_expect *exp) -+{ -+ if(nf_nat_rtsp_hook_expectfn) { -+ nf_nat_rtsp_hook_expectfn(ct,exp); -+ } -+} -+ -+/*** conntrack functions ***/ -+ -+/* outbound packet: client->server */ -+ -+static inline int -+help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen, -+ struct nf_conn *ct, enum ip_conntrack_info ctinfo) -+{ -+ struct ip_ct_rtsp_expect expinfo; -+ -+ int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */ -+ //struct tcphdr* tcph = (void*)iph + iph->ihl * 4; -+ //uint tcplen = pktlen - iph->ihl * 4; -+ char* pdata = rb_ptr; -+ //uint datalen = tcplen - tcph->doff * 4; -+ uint dataoff = 0; -+ int ret = NF_ACCEPT; -+ -+ struct nf_conntrack_expect *exp; -+ -+ __be16 be_loport; -+ -+ memset(&expinfo, 0, sizeof(expinfo)); -+ -+ while (dataoff < datalen) { -+ uint cmdoff = dataoff; -+ uint hdrsoff = 0; -+ uint hdrslen = 0; -+ uint cseqoff = 0; -+ uint cseqlen = 0; -+ uint transoff = 0; -+ uint translen = 0; -+ uint off; -+ -+ if (!rtsp_parse_message(pdata, datalen, &dataoff, -+ &hdrsoff, &hdrslen, -+ &cseqoff, &cseqlen, -+ &transoff, &translen)) -+ break; /* not a valid message */ -+ -+ if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0) -+ continue; /* not a SETUP message */ -+ DEBUGP("found a setup message\n"); -+ -+ off = 0; -+ if(translen) { -+ rtsp_parse_transport(pdata+transoff, translen, &expinfo); -+ } -+ -+ if (expinfo.loport == 0) { -+ DEBUGP("no udp transports found\n"); -+ continue; /* no udp transports found */ -+ } -+ -+ DEBUGP("udp transport found, ports=(%d,%hu,%hu)\n", -+ (int)expinfo.pbtype, expinfo.loport, expinfo.hiport); -+ -+ exp = nf_ct_expect_alloc(ct); -+ if (!exp) { -+ ret = NF_DROP; -+ goto out; -+ } -+ -+ be_loport = htons(expinfo.loport); -+ -+ nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, -+ ct->tuplehash[!dir].tuple.src.l3num, -+ &ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3, -+ IPPROTO_UDP, NULL, &be_loport); -+ -+ exp->master = ct; -+ -+ exp->expectfn = expected; -+ exp->flags = 0; -+ -+ if (expinfo.pbtype == pb_range) { -+ DEBUGP("Changing expectation mask to handle multiple ports\n"); -+ exp->mask.src.u.udp.port = 0xfffe; -+ } -+ -+ DEBUGP("expect_related %u.%u.%u.%u:%u-%u.%u.%u.%u:%u\n", -+ NIPQUAD(exp->tuple.src.u3.ip), -+ ntohs(exp->tuple.src.u.udp.port), -+ NIPQUAD(exp->tuple.dst.u3.ip), -+ ntohs(exp->tuple.dst.u.udp.port)); -+ -+ if (nf_nat_rtsp_hook) -+ /* pass the request off to the nat helper */ -+ ret = nf_nat_rtsp_hook(skb, ctinfo, hdrsoff, hdrslen, &expinfo, exp); -+ else if (nf_ct_expect_related(exp) != 0) { -+ INFOP("nf_ct_expect_related failed\n"); -+ ret = NF_DROP; -+ } -+ nf_ct_expect_put(exp); -+ goto out; -+ } -+out: -+ -+ return ret; -+} -+ -+ -+static inline int -+help_in(struct sk_buff *skb, size_t pktlen, -+ struct nf_conn* ct, enum ip_conntrack_info ctinfo) -+{ -+ return NF_ACCEPT; -+} -+ -+static int help(struct sk_buff *skb, unsigned int protoff, -+ struct nf_conn *ct, enum ip_conntrack_info ctinfo) -+{ -+ struct tcphdr _tcph, *th; -+ unsigned int dataoff, datalen; -+ char *rb_ptr; -+ int ret = NF_DROP; -+ -+ /* Until there's been traffic both ways, don't look in packets. */ -+ if (ctinfo != IP_CT_ESTABLISHED && -+ ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { -+ DEBUGP("conntrackinfo = %u\n", ctinfo); -+ return NF_ACCEPT; -+ } -+ -+ /* Not whole TCP header? */ -+ th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph); -+ -+ if (!th) -+ return NF_ACCEPT; -+ -+ /* No data ? */ -+ dataoff = protoff + th->doff*4; -+ datalen = skb->len - dataoff; -+ if (dataoff >= skb->len) -+ return NF_ACCEPT; -+ -+ spin_lock_bh(&rtsp_buffer_lock); -+ rb_ptr = skb_header_pointer(skb, dataoff, -+ skb->len - dataoff, rtsp_buffer); -+ BUG_ON(rb_ptr == NULL); -+ -+#if 0 -+ /* Checksum invalid? Ignore. */ -+ /* FIXME: Source route IP option packets --RR */ -+ if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, -+ csum_partial((char*)tcph, tcplen, 0))) -+ { -+ DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", -+ tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); -+ return NF_ACCEPT; -+ } -+#endif -+ -+ switch (CTINFO2DIR(ctinfo)) { -+ case IP_CT_DIR_ORIGINAL: -+ ret = help_out(skb, rb_ptr, datalen, ct, ctinfo); -+ break; -+ case IP_CT_DIR_REPLY: -+ DEBUGP("IP_CT_DIR_REPLY\n"); -+ /* inbound packet: server->client */ -+ ret = NF_ACCEPT; -+ break; -+ } -+ -+ spin_unlock_bh(&rtsp_buffer_lock); -+ -+ return ret; -+} -+ -+static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS]; -+static char rtsp_names[MAX_PORTS][10]; -+static struct nf_conntrack_expect_policy rtsp_expect_policy; -+ -+/* This function is intentionally _NOT_ defined as __exit */ -+static void -+fini(void) -+{ -+ int i; -+ for (i = 0; i < num_ports; i++) { -+ DEBUGP("unregistering port %d\n", ports[i]); -+ nf_conntrack_helper_unregister(&rtsp_helpers[i]); -+ } -+ kfree(rtsp_buffer); -+} -+ -+static int __init -+init(void) -+{ -+ int i, ret; -+ struct nf_conntrack_helper *hlpr; -+ char *tmpname; -+ -+ printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n"); -+ -+ if (max_outstanding < 1) { -+ printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n"); -+ return -EBUSY; -+ } -+ if (setup_timeout < 0) { -+ printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n"); -+ return -EBUSY; -+ } -+ -+ rtsp_expect_policy.max_expected = max_outstanding; -+ rtsp_expect_policy.timeout = setup_timeout; -+ -+ rtsp_buffer = kmalloc(65536, GFP_KERNEL); -+ if (!rtsp_buffer) -+ return -ENOMEM; -+ -+ /* If no port given, default to standard rtsp port */ -+ if (ports[0] == 0) { -+ ports[0] = RTSP_PORT; -+ } -+ -+ for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { -+ hlpr = &rtsp_helpers[i]; -+ memset(hlpr, 0, sizeof(struct nf_conntrack_helper)); -+ hlpr->tuple.src.u.tcp.port = htons(ports[i]); -+ hlpr->tuple.dst.protonum = IPPROTO_TCP; -+ hlpr->expect_policy = &rtsp_expect_policy; -+ hlpr->me = THIS_MODULE; -+ hlpr->help = help; -+ -+ tmpname = &rtsp_names[i][0]; -+ if (ports[i] == RTSP_PORT) { -+ sprintf(tmpname, "rtsp"); -+ } else { -+ sprintf(tmpname, "rtsp-%d", i); -+ } -+ hlpr->name = tmpname; -+ -+ DEBUGP("port #%d: %d\n", i, ports[i]); -+ -+ ret = nf_conntrack_helper_register(hlpr); -+ -+ if (ret) { -+ printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]); -+ fini(); -+ return -EBUSY; -+ } -+ num_ports++; -+ } -+ return 0; -+} -+ -+module_init(init); -+module_exit(fini); -+ -+EXPORT_SYMBOL(nf_nat_rtsp_hook_expectfn); -+ -- cgit v1.2.3