Skip to contentSkip to conversation

Some patches

CRAP Paul P Komkoff Jr 3 participants 4 messages Jun 16, 2002 – Jul 8, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This is the result of make allyesconfig

Actually, make allyesconfig won't link vmlinux due to netfilter p-o-m additions. While conntrack_egg part isn't very clean (I'll resend cleaner version later), and conntrack_rpc bombing out the kernel to panic, and needs a big rewrite just because _tcp and _udp files ARE just a copy&paste results (Harald, so please move it to b0rken suite for now).

But ipv6 stuff seems awful :( it just duplicating one function already present in ipv6 code :( and doing it without static keyword ...

net/ipv4/netfilter/ip_conntrack_egg.c +10 -7
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ip_conntrack_egg.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ip_conntrack_egg.c
@@ -175,7 +175,14 @@
 static struct ip_conntrack_helper egg_helpers[MAX_PORTS];
 static char egg_names[MAX_PORTS][14]; /* eggdrop-65535 */
 
-static void __exit fini(void);
+static void deregister_helpers(void) {
+	int i;
+
+	for (i = 0; i < ports_c; i++) {
+		DEBUGP("unregistering helper for port %d\n", ports[i]);
+		ip_conntrack_helper_unregister(&egg_helpers[i]);
+	}
+}
 
 static int __init init(void)
 {
@@ -213,7 +220,7 @@
 		if (ret) {
 			printk("ip_conntrack_egg: ERROR registering helper "
 				"for port %d\n", ports[i]);
-			fini();
+			deregister_helpers();
 			return 1;
 		}
 		ports_c++;
@@ -223,11 +230,7 @@
 
 static void __exit fini(void)
 {
-	int i;
-	for (i = 0; i < ports_c; i++) {
-		DEBUGP("unregistering helper for port %d\n", ports[i]);
-		ip_conntrack_helper_unregister(&egg_helpers[i]);
-	}
+	deregister_helpers();
 }
 
 module_init(init);
net/ipv4/netfilter/ip_conntrack_rpc_tcp.c +5 -2
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ip_conntrack_rpc_tcp.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ip_conntrack_rpc_tcp.c
@@ -325,13 +325,13 @@
 					 { 0, { 0 }, 0xFFFF } },
 				       help };
 
-int init_module(void)
+static int __init init_m(void)
 {
 	printk("ip_conntrack_rpc_tcp.o\n");
 	return ip_conntrack_helper_register(&rpc_tcp);
 }
 
-void cleanup_module(void)
+static void __exit cleanup_m(void)
 {
 	clean_expect(&expect_rpc_list_tcp);
 	clean_request(&request_p_list_tcp);
@@ -342,3 +342,6 @@
 EXPORT_SYMBOL(expect_rpc_list_tcp);
 EXPORT_SYMBOL(ip_conntrack_rpc_tcp);
 EXPORT_SYMBOL(ipct_rpc_tcp_lock);
+
+module_init(init_m);
+module_exit(cleanup_m);
net/ipv4/netfilter/ip_conntrack_rpc_udp.c +5 -2
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ip_conntrack_rpc_udp.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ip_conntrack_rpc_udp.c
@@ -318,13 +318,13 @@
 					 { 0, { 0 }, 0xFFFF } },
 				       help };
 
-int init_module(void)
+static int __init init_m(void)
 {
 	printk("ip_conntrack_rpc_udp.o\n");
 	return ip_conntrack_helper_register(&rpc_udp);
 }
 
-void cleanup_module(void)
+static void __init cleanup_m(void)
 {
 	clean_expect(&expect_rpc_list_udp);
 	clean_request(&request_p_list_udp);
@@ -335,3 +335,6 @@
 EXPORT_SYMBOL(expect_rpc_list_udp);
 EXPORT_SYMBOL(ip_conntrack_rpc_udp);
 EXPORT_SYMBOL(ipct_rpc_udp_lock);
+
+module_init(init_m);
+module_exit(cleanup_m);
net/ipv4/netfilter/ipt_ah.c +2 -2
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ipt_ah.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ipt_ah.c
@@ -91,12 +91,12 @@
 static struct ipt_match ah_match
 = { { NULL, NULL }, "ah", &match, &checkentry, NULL, THIS_MODULE };
 
-int __init init(void)
+static int __init init(void)
 {
 	return ipt_register_match(&ah_match);
 }
 
-void __exit cleanup(void)
+static void __exit cleanup(void)
 {
 	ipt_unregister_match(&ah_match);
 }
net/ipv4/netfilter/ipt_record_rpc.c +2 -2
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ipt_record_rpc.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ipt_record_rpc.c
@@ -149,7 +149,7 @@
 static struct ipt_match record_rpc_match
 = { { NULL, NULL }, "record_rpc", &match, NULL, NULL, THIS_MODULE };
 
-int __init init(void)
+static int __init init(void)
 {
 	__MOD_INC_USE_COUNT(ip_conntrack_module);
 	__MOD_INC_USE_COUNT(ip_conntrack_rpc_udp);
@@ -157,7 +157,7 @@
 	return ipt_register_match(&record_rpc_match);
 }
 
-void __exit cleanup(void)
+static void __exit cleanup(void)
 {
 	ipt_unregister_match(&record_rpc_match);
 	__MOD_DEC_USE_COUNT(ip_conntrack_module);

diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/Makefile.in linux-2.4.19-pre10-ac2-s3/net/ipv6/Makefile.in

net/ipv6/exthdrs.c +4 -0
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/exthdrs.c linux-2.4.19-pre10-ac2-s3/net/ipv6/exthdrs.c
@@ -20,6 +20,8 @@
  *				  tlv options.
  */
 
+#include <linux/config.h>
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
@@ -729,6 +731,8 @@
 		 (nexthdr == NEXTHDR_NONE)	||
 		 (nexthdr == NEXTHDR_DEST) );
 }
+
+EXPORT_SYMBOL(ipv6_ext_hdr);
 
 /*
  * Skip any extension headers. This is used by the ICMP module.
net/ipv6/netfilter/ip6t_ah.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_ah.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_ah.c
@@ -27,16 +27,7 @@
        __u32   spi;
 };
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 /* Returns 1 if the spi is matched by the range, 0 otherwise */
 static inline int
net/ipv6/netfilter/ip6t_dst.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_dst.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_dst.c
@@ -30,16 +30,7 @@
 #define DEBUGP(format, args...)
 #endif
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 /*
  * (Type & 0xC0) >> 6
net/ipv6/netfilter/ip6t_esp.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_esp.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_esp.c
@@ -24,16 +24,7 @@
 	__u32   spi;
 };
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 /* Returns 1 if the spi is matched by the range, 0 otherwise */
 static inline int
net/ipv6/netfilter/ip6t_frag.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_frag.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_frag.c
@@ -45,16 +45,7 @@
        __u32   id;
 };
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 /* Returns 1 if the id is matched by the range, 0 otherwise */
 static inline int
net/ipv6/netfilter/ip6t_hbh.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_hbh.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_hbh.c
@@ -30,16 +30,7 @@
 #define DEBUGP(format, args...)
 #endif
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 /*
  * (Type & 0xC0) >> 6
net/ipv6/netfilter/ip6t_ipv6header.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_ipv6header.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_ipv6header.c
@@ -25,16 +25,7 @@
 #define DEBUGP(format, args...)
 #endif
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 static int
 ipv6header_match(const struct sk_buff *skb,
net/ipv6/netfilter/ip6t_rt.c +1 -10
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/netfilter/ip6t_rt.c linux-2.4.19-pre10-ac2-s3/net/ipv6/netfilter/ip6t_rt.c
@@ -22,16 +22,7 @@
 #define DEBUGP(format, args...)
 #endif
 
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}
+extern int ipv6_ext_hdr(u8 nexthdr);
 
 /* Returns 1 if the id is matched by the range, 0 otherwise */
 static inline int
Signature · 2 lines
Paul P 'Stingray' Komkoff 'Greatest' Jr /// (icq)23200764 /// (http)stingr.net
  When you're invisible, the only one really watching you is you (my keychain)
#1 lore raw

Paul P Komkoff Jr ................................... (2002. június 17.)

Hi!

Quoted 2 lines

But ipv6 stuff seems awful :( it just duplicating one function already present in ipv6 code :( and doing it without static keyword ...

Please, read the code again!
In firewall I had to use the ESP and AH headers, too, but the core kernel does not support it!
But the other side: yes, it's awful, I now. All the code contain the some search and parser (not exactly the same, but can be changed). While the patches are in the p-o-m and they are independent ones, I can not create exact debedencies. (The core ipv6 code will be changed soon, after it the search function will be placed into it - I can remove it from the extensions.)

Quoted 14 lines

diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/Makefile.in linux-2.4.19-pre10-ac2-s3/net/ipv6/Makefile.in diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv6/exthdrs.c linux-2.4.19-pre10-ac2-s3/net/ipv6/exthdrs.c

net/ipv6/exthdrs.c +2 -0
@@ -20,6 +20,8 @@
  *				  tlv options.
  */
 
+#include <linux/config.h>
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>

net/ipv6/exthdrs.c line 738

Quoted 8 lines
net/ipv6/exthdrs.c +2 -0
@@ -729,6 +731,8 @@
 		 (nexthdr == NEXTHDR_NONE)	||
 		 (nexthdr == NEXTHDR_DEST) );
 }
+
+EXPORT_SYMBOL(ipv6_ext_hdr);
 
 /*
  * Skip any extension headers. This is used by the ICMP module.

It would be nice, but it is not the Netfilter code. (And these patches are in p-o-m.)
The exported function:
int ipv6_ext_hdr(u8 nexthdr)

{
        return ( (nexthdr == NEXTHDR_HOP)       ||
                 (nexthdr == NEXTHDR_ROUTING)   ||
                 (nexthdr == NEXTHDR_FRAGMENT)  ||
                 (nexthdr == NEXTHDR_AUTH)      ||
                 (nexthdr == NEXTHDR_NONE)      ||
                 (nexthdr == NEXTHDR_DEST) );
}

net/ipv6/exthdrs.c

Quoted 10 lines
net/ipv6/exthdrs.c +0 -10
-int ipv6_ext_hdr(u8 nexthdr)
-{
-        return ( (nexthdr == NEXTHDR_HOP)       ||
-                 (nexthdr == NEXTHDR_ROUTING)   ||
-                 (nexthdr == NEXTHDR_FRAGMENT)  ||
-                 (nexthdr == NEXTHDR_AUTH)      ||
-                 (nexthdr == NEXTHDR_ESP)       ||
-                 (nexthdr == NEXTHDR_NONE)      ||
-                 (nexthdr == NEXTHDR_DEST) );
-}

(Yes, I know that is a real problem, I'll solve it gracefullly, I promise! :) )

Regards,

kisza

Signature · 3 lines
    Andras Kis-Szabo       Security Development, Design and Audit
-------------------------/        Zorp, NetFilter and IPv6
 [email protected] /-----Member of the BUTE-MIS-SEARCHlab---------->
#2 lore raw
In reply to Paul P Komkoff Jr
Quoted 7 lines · Paul P Komkoff Jr

This is the result of make allyesconfig

Actually, make allyesconfig won't link vmlinux due to netfilter p-o-m additions. While conntrack_egg part isn't very clean (I'll resend cleaner version later), and conntrack_rpc bombing out the kernel to panic, and needs a big rewrite just because _tcp and _udp files ARE just a copy&paste results (Harald, so please move it to b0rken suite for now).

ok, I'll move conntrack_rpc.

Quoted 2 lines

But ipv6 stuff seems awful :( it just duplicating one function already present in ipv6 code :( and doing it without static keyword ...

I think kisza has dealt with this..

Quoted 1 line

diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ip_conntrack_egg.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ip_conntrack_egg.c

ok, applied this one...

Quoted 8 lines

diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet a/net/ipv4/netfilter/ipt_ah.c linux-2.4.19-pre10-ac2-s3/net/ipv4/netfilter/ipt_ah.c

net/ipv4/netfilter/ipt_ah.c +0 -1
@@ -91,12 +91,12 @@
 static struct ipt_match ah_match
 = { { NULL, NULL }, "ah", &match, &checkentry, NULL, THIS_MODULE };
 
-int __init init(void)

net/ipv4/netfilter/ipt_ah.c line 102

Quoted 10 lines
net/ipv4/netfilter/ipt_ah.c +2 -1
+static int __init init(void)
 {
 	return ipt_register_match(&ah_match);
 }
 
-void __exit cleanup(void)
+static void __exit cleanup(void)
 {
 	ipt_unregister_match(&ah_match);
 }

this one is now pending for kernel inclusion... (though it will be post-2.4.19)

Quoted 1 line

Paul P 'Stingray' Komkoff 'Greatest' Jr /// (icq)23200764 /// (http)stingr.net

Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M- 
V-- PS+ PE-- Y+ PGP++ t++ 5-- !X !R tv-- b+++ DI? !D G+ e* h+ r% y+(*)
#3 lore raw

Harald Welte ........................................ (2002. július 05.)

Hi!

Quoted 3 lines
Quoted 2 lines

But ipv6 stuff seems awful :( it just duplicating one function already present in ipv6 code :( and doing it without static keyword ...

I think kisza has dealt with this..

There are 5(6?) independent patches.
I started a thread at the netdev about this problem. The result was: the firewall should be independent drom the network code... (We can not trust in the network code.)
(The two function wasn't the same...)

BTW: the function will be included in 2.4.19, with the export. After this the p-o-m will be changed (and wil depend on the 2.4.19-patch).

regards,

kisza

Signature · 3 lines
    Andras Kis-Szabo       Security Development, Design and Audit
-------------------------/        Zorp, NetFilter and IPv6
 [email protected] /-----Member of the BUTE-MIS-SEARCHlab---------->