ip6tables icmpv6 match
libip6t_icmpv6.c registers a match called "icmp6", which means that ip6tables -vL and ip6tables-save cannot output the match correctly.
- Daniel De Graaf
Hi, Daniel and all,
From: "Daniel De Graaf" <[email protected]>
Date: Sun, 26 Mar 2006 22:19:27 -0600
Quoted 2 lines
libip6t_icmpv6.cregisters a match called "icmp6", which means that ip6tables -vL and ip6tables-save cannot output the match correctly.
There are 2 solutions.
1. just rename libip6t_icmpv6.c to libip6t_icmp6.c. This can conform names of internal structure, library and kernel module.
2. apply attached patch to fix find_match() so that ip6tables can load libip6t_icmpv6.so.
I like 1 but I'm not sure we can do it. Anyone knows any historical problem about it ?
-- Yasuyuki Kozakai
[PATCH] fix loading libip6t_icmpv6.so
The current ip6tables fails to load libip6t_icmp6.so wehn user tries '-p icmpv6', '-m icmpv6', or '-m icmp6'.
To fix this and keep compatibility,
- 'name' in 'struct ip6tables_match icmpv6' must be 'icmp6'. This name is used in kernel.
- Then ip6tables should use the name 'icmp6' to search match in list.
- ip6tables should try to load libip6t_icmpv6.so, not libip6t_icmp6.so.
---
commit 985c7966e4dcacbd7511afd5df86878652b946d6
tree 41192f2b1b4d46d0947b81bc888e0bfba3ab8e27
parent c94b52d4b6fff1bfc2da3e192b39e0f45cd12750
author Yasuyuki Kozakai <[email protected]> Wed, 29 Mar 2006 12:06:44 +0900 committer Yasuyuki Kozakai <[email protected]> Wed, 29 Mar 2006 12:06:44 +0900
ip6tables.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
ip6tables.c +9 -5
@@ -713,16 +713,20 @@ find_match(const char *match_name, enum {struct ip6tables_match *ptr;const char *icmp6 ="icmp6" ; -const char *name; +const char *icmpv6 ="icmpv6" ; +const char *name, *libname;/* This is ugly as hell. Nonetheless, there is no way of changing * this without hurting backwards compatibility */ if ( (strcmp (match_name,"icmpv6" ) ==0 ) || (strcmp (match_name,"ipv6-icmp" ) ==0 ) || - (strcmp (match_name,"icmp6" ) ==0 ) ) + (strcmp (match_name,"icmp6" ) ==0 ) ) { name = icmp6; -else + libname = icmpv6; + }else { name = match_name; + libname = match_name; + }for (ptr = ip6tables_matches; ptr; ptr = ptr->next) {if (strcmp (name, ptr->name) ==0 ) {
@@ -747,8 +751,8 @@ find_match(const char *match_name, enum#ifndef NO_SHARED_LIBS if (!ptr && tryload !=DONT_LOAD && tryload !=DURING_LOAD ) {char path[strlen (lib_dir) +sizeof ("/libip6t_.so" ) - +strlen (name)]; -sprintf (path,"%s/libip6t_%s.so" , lib_dir, name); + +strlen (libname)]; +sprintf (path,"%s/libip6t_%s.so" , lib_dir, libname);if (dlopen (path,RTLD_NOW )) {/* Found library. If it didn't register itself, maybe they specified target as match. */
PATCH 1/4 fix loading shared library of ICMPv6 match
From: Yasuyuki KOZAKAI <[email protected]>
Date: Wed, 29 Mar 2006 16:25:27 +0900 (JST)
Quoted 8 lines
From: "Daniel De Graaf" <[email protected]>
Date: Sun, 26 Mar 2006 22:19:27 -0600Quoted 2 lines
libip6t_icmpv6.cregisters a match called "icmp6", which means that ip6tables -vL and ip6tables-save cannot output the match correctly.There are 2 solutions.
Quoted 7 lines
1. just rename
libip6t_icmpv6.ctolibip6t_icmp6.c. This can conform names of internal structure, library and kernel module.
2. apply attached patch to fixfind_match()so that ip6tables can load libip6t_icmpv6.so.I like 1 but I'm not sure we can do it. Anyone knows any historical problem about it ?
No problem ? OK, then I take 1.
[IP6TABLES] fix loading shared library of ICMPv6 match
The current ip6tables tries to load libip6t_icmp6.so when user types 'ip6tables -p icmpv6 ...' or 'ip6tables ... -m icmpv6' ...', and it fails.
This patch renames libip6t_icmpv6.c to libip6t_icmp6.c so that ip6tables can load it. Now kernel module and user library has same name 'icmp6'. It can reduce confusion about name mismatch. That's why I renamed it instead of reverting change in find_match() which brought this bug.
This patch keeps compatibiity and we can use '-p icmpv6', '-p ipv6-icmpv6', '-m icmpv6', '-m ipv6-icmpv6', and '-m icmp6', as ever.
---
commit f7eed26853dda6a51d70221f5c9ef0fac60f73a7
tree b064a28c63406f4ec54762731ad32a7a68234ae7
parent c94b52d4b6fff1bfc2da3e192b39e0f45cd12750
author Yasuyuki Kozakai <[email protected]> Thu, 06 Apr 2006 22:18:27 +0900 committer Yasuyuki Kozakai <[email protected]> Thu, 06 Apr 2006 22:18:27 +0900
extensions/Makefile | 2 extensions/libip6t_icmp6.c | 272 +++++++++++++++++++++++++++++++++++++++++ extensions/libip6t_icmp6.man | 14 ++ extensions/libip6t_icmpv6.c | 272 ----------------------------------------- extensions/libip6t_icmpv6.man | 14 -- 5 files changed, 287 insertions(+), 287 deletions(-)
extensions/Makefile +1 -1
@@ -6,7 +6,7 @@ # package (HW) # PF_EXT_SLIB:=ah addrtype comment connlimit connmark conntrack dscp ecn esp hashlimit helper icmp iprange length limit mac mark multiport owner physdev pkttype policy realm rpc sctp standard state tcp tcpmss tos ttl udp unclean CLASSIFY CONNMARK DNAT DSCP ECN LOG MARK MASQUERADE MIRROR NETMAP NFQUEUE NOTRACK REDIRECT REJECT SAME SNAT TARPIT TCPMSS TOS TRACE TTL ULOG -PF6_EXT_SLIB:=connmark eui64 hl icmpv6 length limit mac mark multiport owner physdev policy standard state tcp udp CONNMARK HL LOG NFQUEUE MARK TRACE +PF6_EXT_SLIB:=connmark eui64 hl icmp6 length limit mac mark multiport owner physdev policy standard state tcp udp CONNMARK HL LOG NFQUEUE MARK TRACE # Optionals PF_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T)))
extensions/libip6t_icmp6.c new file +272 -0
272 lines not on this page · raw message
extensions/libip6t_icmp6.man new file +14 -0
@@ -0,0 +1,14 @@ +This extension is loaded if `--protocol ipv6-icmp' or `--protocol icmpv6' is +specified. It provides the following option: +.TP +.BR "--icmpv6-type " "[!] \fItype\fP[/\fIcode\fP]|\fItypename\fP" +This allows specification of the ICMPv6 type, which can be a numeric +ICMPv6 +.IR type , +.IR type +and +.IR code , +or one of the ICMPv6 type names shown by the command +.nf + ip6tables -p ipv6-icmp -h +.fi
extensions/libip6t_icmpv6.c deleted +0 -272
272 lines not on this page · raw message
extensions/libip6t_icmpv6.man deleted +0 -14
@@ -1,14 +0,0 @@ -This extension is loaded if `--protocol ipv6-icmp' or `--protocol icmpv6' is -specified. It provides the following option: -.TP -.BR "--icmpv6-type " "[!] \fItype\fP[/\fIcode\fP]|\fItypename\fP" -This allows specification of the ICMPv6 type, which can be a numeric -ICMPv6 -.IR type , -.IR type -and -.IR code , -or one of the ICMPv6 type names shown by the command -.nf - ip6tables -p ipv6-icmp -h -.fi