Skip to contentSkip to conversation

Some ip6tables bugfixes

PATCH In review Jonas Berlin 2 participants 2 messages Mar 27, 2005 – Apr 1, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Some ip6tables bugfixes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I had some problems with porting ipv4 modules to ipv6 and after doing a

~ diff -uw iptables.c ip6tables.c

I noticed that in ipv6, no checks are done to see if the "init" function of a match or target is defined, whereas in ipv4 it's done.

So this patch changes ip6tables to also check if init != NULL before calling it. Also updated some strings & comments to read "ip6tables" instead of "iptables".

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCRjkwxyF48ZTvn+4RArMiAKDe7uqcW1Gm5p3C4G9sIwmgMK0ifwCeIKsW Ur6LQfHkUtzlsV1TRBkeGBA=
=27ws
-----END PGP SIGNATURE-----

ip6tables.c +12 -8
Index: iptables/ip6tables.c
===================================================================
@@ -1,4 +1,4 @@
-/* Code to take an iptables-style command line and do it. */
+/* Code to take an ip6tables-style command line and do it. */
 
 /*
  * Author: [email protected] and [email protected]
@@ -266,7 +266,7 @@
 		exit_tryhelp(status);
 	if (status == VERSION_PROBLEM)
 		fprintf(stderr,
-			"Perhaps iptables or your kernel needs to be upgraded.\n");
+			"Perhaps ip6tables or your kernel needs to be upgraded.\n");
 	exit(status);
 }
 
@@ -1859,7 +1859,7 @@
 			if (!optarg)
 				optarg = argv[optind];
 
-			/* iptables -p icmp -h */
+			/* ip6tables -p icmp -h */
 			if (!matches && protocol)
 				find_match(protocol, TRY_LOAD, &matches);
 
@@ -1919,7 +1919,8 @@
 				target->t = fw_calloc(1, size);
 				target->t->u.target_size = size;
 				strcpy(target->t->u.user.name, jumpto);
-				target->init(target->t, &fw.nfcache);
+				if (target->init != NULL)
+					target->init(target->t, &fw.nfcache);
 				opts = merge_options(opts, target->extra_opts, &target->option_offset);
 			}
 			break;
@@ -1963,7 +1964,8 @@
 			m->m = fw_calloc(1, size);
 			m->m->u.match_size = size;
 			strcpy(m->m->u.user.name, m->name);
-			m->init(m->m, &fw.nfcache);
+			if (m->init != NULL)
+				m->init(m->m, &fw.nfcache);
 			opts = merge_options(opts, m->extra_opts, &m->option_offset);
 		}
 		break;
@@ -2079,7 +2081,7 @@
 				 * - a protocol has been specified
 				 * - the protocol extension has not been
 				 *   loaded yet, or is loaded and unused
-				 *   [think of iptables-restore!]
+				 *   [think of ip6tables-restore!]
 				 * - the protocol extension can be successively
 				 *   loaded
 				 */
@@ -2104,7 +2106,8 @@
 					m->m = fw_calloc(1, size);
 					m->m->u.match_size = size;
 					strcpy(m->m->u.user.name, m->name);
-					m->init(m->m, &fw.nfcache);
+					if (m->init != NULL)
+						m->init(m->m, &fw.nfcache);
 
 					opts = merge_options(opts,
 					    m->extra_opts, &m->option_offset);
@@ -2232,7 +2235,8 @@
 			target->t = fw_calloc(1, size);
 			target->t->u.target_size = size;
 			strcpy(target->t->u.user.name, jumpto);
-			target->init(target->t, &fw.nfcache);
+			if (target->init != NULL)
+				target->init(target->t, &fw.nfcache);
 		}
 
 		if (!target) {
#1 lore raw
Quoted 6 lines · Jonas Berlin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I had some problems with porting ipv4 modules to ipv6 and after doing a

~ diff -uw iptables.c ip6tables.c

'vimdiff' does wonders :)

Sending ip6tables.c
Transmitting file data .
Committed revision 3818.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie