浏览代码

coova-chilli: add netfilter kernel module package with patches

Signed-off-by: Jaehoon You <teslamint@gmail.com>
Jaehoon You 10 年前
父节点
当前提交
ca9d3f24cf

+ 37
- 0
net/coova-chilli/Makefile 查看文件

@@ -36,6 +36,7 @@ PKG_CONFIG_DEPENDS := \
36 36
   COOVACHILLI_OPENSSL
37 37
 
38 38
 include $(INCLUDE_DIR)/package.mk
39
+include $(INCLUDE_DIR)/kernel.mk
39 40
 
40 41
 define Package/coova-chilli
41 42
   SUBMENU:=Captive Portals
@@ -61,6 +62,38 @@ define Package/coova-chilli/config
61 62
   source "$(SOURCE)/Config.in"
62 63
 endef
63 64
 
65
+define KernelPackage/ipt-coova
66
+  URL:=http://www.coova.org/CoovaChilli
67
+  SUBMENU:=Netfilter Extensions
68
+  DEPENDS:=coova-chilli +kmod-ipt-core +libxtables
69
+  TITLE:=Coova netfilter module
70
+  FILES:=$(PKG_BUILD_DIR)/src/linux/xt_*.$(LINUX_KMOD_SUFFIX)
71
+  AUTOLOAD:=$(call AutoProbe,xt_coova)
72
+endef
73
+
74
+define KernelPackage/ipt-coova/description
75
+	Netfilter kernel module for CoovaChilli
76
+	Includes:
77
+	- coova
78
+endef
79
+
80
+DISABLE_NLS=
81
+
82
+TARGET_CFLAGS += $(FPIC)
83
+
84
+CONFIGURE_VARS += \
85
+       ARCH="$(LINUX_KARCH)" \
86
+       KERNEL_DIR="$(LINUX_DIR)"
87
+
88
+MAKE_FLAGS += \
89
+       ARCH="$(LINUX_KARCH)" \
90
+       KERNEL_DIR="$(LINUX_DIR)"
91
+
92
+MAKE_INSTALL_FLAGS += \
93
+       ARCH="$(LINUX_KARCH)" \
94
+       KERNEL_DIR="$(LINUX_DIR)" \
95
+       INSTALL_MOD_PATH="$(PKG_INSTALL_DIR)"
96
+
64 97
 define Build/Prepare
65 98
 $(call Build/Prepare/Default)
66 99
 	( cd $(PKG_BUILD_DIR) ; \
@@ -82,6 +115,7 @@ define Build/Configure
82 115
 	$(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \
83 116
 	$(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyaxssl \
84 117
 	$(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \
118
+	$(if $(CONFIG_PACKAGE_kmod-ipt-coova),--with-nfcoova) \
85 119
 	)
86 120
 endef
87 121
 
@@ -100,6 +134,9 @@ define Package/coova-chilli/install
100 134
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
101 135
 	$(INSTALL_DIR) $(1)/usr/lib/
102 136
 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
137
+	$(INSTALL_DIR) $(1)/usr/lib/iptables
138
+	$(CP) $(PKG_INSTALL_DIR)/usr/iptables/lib*.so $(1)/usr/lib/iptables
103 139
 endef
104 140
 
105 141
 $(eval $(call BuildPackage,coova-chilli))
142
+$(eval $(call KernelPackage,ipt-coova))

+ 17
- 0
net/coova-chilli/patches/200-fix_compile_kmod.patch 查看文件

@@ -0,0 +1,17 @@
1
+--- a/src/linux/Makefile
2
++++ b/src/linux/Makefile
3
+@@ -21,11 +21,11 @@ lib%.so: lib%.o
4
+ 	$(CC) $(CFLAGS) -shared -o $@ $^;
5
+ 
6
+ lib%.o: lib%.c
7
+-	$(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<;
8
++	$(CC) $(CFLAGS) -D_INIT=lib$*_init -c -o $@ $<;
9
+ 
10
+ install: modules_install libxt_coova.so
11
+-	mkdir -p $(DESTDIR)/lib/xtables/
12
+-	cp libxt_coova.so $(DESTDIR)/lib/xtables/
13
++	mkdir -p $(DESTDIR)/usr/lib/iptables/
14
++	cp libxt_coova.so $(DESTDIR)/usr/lib/iptables/
15
+ 
16
+ distdir:
17
+ 

+ 49
- 0
net/coova-chilli/patches/201-fix_dereferencing_pointers.patch 查看文件

@@ -0,0 +1,49 @@
1
+--- a/src/linux/xt_coova.c
2
++++ b/src/linux/xt_coova.c
3
+@@ -292,6 +292,8 @@ static int coova_mt_check(const struct x
4
+ 	struct coova_table *t;
5
+ #ifdef CONFIG_PROC_FS
6
+ 	struct proc_dir_entry *pde;
7
++	kuid_t uid;
8
++	kgid_t gid;
9
+ #endif
10
+ 	unsigned i;
11
+ 	int ret = 0;
12
+@@ -330,8 +332,9 @@ static int coova_mt_check(const struct x
13
+ 		ret = -ENOMEM;
14
+ 		goto out;
15
+ 	}
16
+-	pde->uid = ip_list_uid;
17
+-	pde->gid = ip_list_gid;
18
++	uid = make_kuid(&init_user_ns, ip_list_uid);
19
++	gid = make_kgid(&init_user_ns, ip_list_gid);
20
++	proc_set_user(pde, uid, gid);
21
+ #endif
22
+ 	spin_lock_bh(&coova_lock);
23
+ 	list_add_tail(&t->list, &tables);
24
+@@ -445,14 +448,13 @@ static const struct seq_operations coova
25
+ 
26
+ static int coova_seq_open(struct inode *inode, struct file *file)
27
+ {
28
+-	struct proc_dir_entry *pde = PDE(inode);
29
+ 	struct coova_iter_state *st;
30
+ 
31
+ 	st = __seq_open_private(file, &coova_seq_ops, sizeof(*st));
32
+ 	if (st == NULL)
33
+ 		return -ENOMEM;
34
+ 
35
+-	st->table = pde->data;
36
++	st->table = PDE_DATA(inode);
37
+ 	return 0;
38
+ }
39
+ 
40
+@@ -460,8 +462,7 @@ static ssize_t
41
+ coova_mt_proc_write(struct file *file, const char __user *input,
42
+ 		    size_t size, loff_t *loff)
43
+ {
44
+-	const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
45
+-	struct coova_table *t = pde->data;
46
++	struct coova_table *t = PDE_DATA(file->f_path.dentry->d_inode);
47
+ 	struct coova_entry *e;
48
+ 	char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")];
49
+ 	const char *c = buf;