diff --git a/net/coova-chilli/Makefile b/net/coova-chilli/Makefile index 2ff8729ed..ad9d3015e 100644 --- a/net/coova-chilli/Makefile +++ b/net/coova-chilli/Makefile @@ -36,6 +36,7 @@ PKG_CONFIG_DEPENDS := \ COOVACHILLI_OPENSSL include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk define Package/coova-chilli SUBMENU:=Captive Portals @@ -61,6 +62,38 @@ define Package/coova-chilli/config source "$(SOURCE)/Config.in" endef +define KernelPackage/ipt-coova + URL:=http://www.coova.org/CoovaChilli + SUBMENU:=Netfilter Extensions + DEPENDS:=coova-chilli +kmod-ipt-core +libxtables + TITLE:=Coova netfilter module + FILES:=$(PKG_BUILD_DIR)/src/linux/xt_*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoProbe,xt_coova) +endef + +define KernelPackage/ipt-coova/description + Netfilter kernel module for CoovaChilli + Includes: + - coova +endef + +DISABLE_NLS= + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_VARS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" + +MAKE_FLAGS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" + +MAKE_INSTALL_FLAGS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" \ + INSTALL_MOD_PATH="$(PKG_INSTALL_DIR)" + define Build/Prepare $(call Build/Prepare/Default) ( cd $(PKG_BUILD_DIR) ; \ @@ -82,6 +115,7 @@ define Build/Configure $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \ $(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyaxssl \ $(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \ + $(if $(CONFIG_PACKAGE_kmod-ipt-coova),--with-nfcoova) \ ) endef @@ -100,6 +134,9 @@ define Package/coova-chilli/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/usr/lib/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/iptables + $(CP) $(PKG_INSTALL_DIR)/usr/iptables/lib*.so $(1)/usr/lib/iptables endef $(eval $(call BuildPackage,coova-chilli)) +$(eval $(call KernelPackage,ipt-coova)) diff --git a/net/coova-chilli/patches/200-fix_compile_kmod.patch b/net/coova-chilli/patches/200-fix_compile_kmod.patch new file mode 100644 index 000000000..27225786e --- /dev/null +++ b/net/coova-chilli/patches/200-fix_compile_kmod.patch @@ -0,0 +1,17 @@ +--- a/src/linux/Makefile ++++ b/src/linux/Makefile +@@ -21,11 +21,11 @@ lib%.so: lib%.o + $(CC) $(CFLAGS) -shared -o $@ $^; + + lib%.o: lib%.c +- $(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<; ++ $(CC) $(CFLAGS) -D_INIT=lib$*_init -c -o $@ $<; + + install: modules_install libxt_coova.so +- mkdir -p $(DESTDIR)/lib/xtables/ +- cp libxt_coova.so $(DESTDIR)/lib/xtables/ ++ mkdir -p $(DESTDIR)/usr/lib/iptables/ ++ cp libxt_coova.so $(DESTDIR)/usr/lib/iptables/ + + distdir: + diff --git a/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch b/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch new file mode 100644 index 000000000..d608835a4 --- /dev/null +++ b/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch @@ -0,0 +1,49 @@ +--- a/src/linux/xt_coova.c ++++ b/src/linux/xt_coova.c +@@ -292,6 +292,8 @@ static int coova_mt_check(const struct x + struct coova_table *t; + #ifdef CONFIG_PROC_FS + struct proc_dir_entry *pde; ++ kuid_t uid; ++ kgid_t gid; + #endif + unsigned i; + int ret = 0; +@@ -330,8 +332,9 @@ static int coova_mt_check(const struct x + ret = -ENOMEM; + goto out; + } +- pde->uid = ip_list_uid; +- pde->gid = ip_list_gid; ++ uid = make_kuid(&init_user_ns, ip_list_uid); ++ gid = make_kgid(&init_user_ns, ip_list_gid); ++ proc_set_user(pde, uid, gid); + #endif + spin_lock_bh(&coova_lock); + list_add_tail(&t->list, &tables); +@@ -445,14 +448,13 @@ static const struct seq_operations coova + + static int coova_seq_open(struct inode *inode, struct file *file) + { +- struct proc_dir_entry *pde = PDE(inode); + struct coova_iter_state *st; + + st = __seq_open_private(file, &coova_seq_ops, sizeof(*st)); + if (st == NULL) + return -ENOMEM; + +- st->table = pde->data; ++ st->table = PDE_DATA(inode); + return 0; + } + +@@ -460,8 +462,7 @@ static ssize_t + coova_mt_proc_write(struct file *file, const char __user *input, + size_t size, loff_t *loff) + { +- const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); +- struct coova_table *t = pde->data; ++ struct coova_table *t = PDE_DATA(file->f_path.dentry->d_inode); + struct coova_entry *e; + char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; + const char *c = buf;