kill manually comparing protocol name with "ipv6-icmp"
PATCH 2/4 kill manually comparing protocol name with "ipv6-icmp"
[IP6TABLES] kill manually comparing protocol name with "ipv6-icmp"
This adds "ipv6-icmp" to chain_protos[] and kill manually comparing the argument of '-p' with it.
chain_protos[] has the "icmpv6" with the same protocol number, but it's OK because proto_to_name() returns the firstly matched entry "icmpv6" as ever.
---
commit 62607c174a8c1cc7a4f18e7537be75a1d5a87944
tree f1c65a0db8d249e19a4c35b46d95e7d8f1eaf628
parent f7eed26853dda6a51d70221f5c9ef0fac60f73a7
author Yasuyuki Kozakai <[email protected]> Thu, 06 Apr 2006 22:34:56 +0900 committer Yasuyuki Kozakai <[email protected]> Thu, 06 Apr 2006 22:34:56 +0900
ip6tables.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
ip6tables.c +1 -3
@@ -222,6 +222,7 @@ static const struct pprot chain_protos[] { "tcp", IPPROTO_TCP }, { "udp", IPPROTO_UDP }, { "icmpv6", IPPROTO_ICMPV6 }, + { "ipv6-icmp", IPPROTO_ICMPV6 }, { "esp", IPPROTO_ESP }, { "ah", IPPROTO_AH }, };
@@ -1748,7 +1749,6 @@ int do_command6(int argc, char *argv[],char *protocol =NULL ;const char *modprobe =NULL ;int proto_used =0 ; -char icmp6p[] ="icmpv6" ;memset (&fw,0 ,sizeof (fw));
@@ -1917,8 +1917,6 @@ int do_command6(int argc, char *argv[], *protocol =tolower (*protocol); protocol = argv[optind-1 ]; -if (strcmp (protocol,"ipv6-icmp" ) ==0 ) - protocol = icmp6p; fw.ipv6.proto =parse_protocol (protocol); fw.ipv6.flags |=IP6T_F_PROTO ;
Quoted 8 lines · Yasuyuki KOZAKAI
[IP6TABLES] kill manually comparing protocol name with "ipv6-icmp"
This adds "ipv6-icmp" to chain_protos[] and kill manually comparing the argument of '-p' with it.
chain_protos[] has the "icmpv6" with the same protocol number, but it's OK because
proto_to_name()returns the firstly matched entry "icmpv6" as ever.
I'm uncomfortable with having proto names in source code anyway, to me it clashes horribly with getprotobyname and friends which for historical and bizarre reasons might be looked up centrally (using nss) via ldap !!
However I guess history also shows that protocol names have been stable over the years :-) so what can I say?
Sam
Quoted 8 lines · Amin Azez
Quoted 6 lines · Yasuyuki KOZAKAI
[IP6TABLES] kill manually comparing protocol name with "ipv6-icmp" This adds "ipv6-icmp" to chain_protos[] and kill manually comparing the argument of '-p' with it.
chain_protos[] has the "icmpv6" with the same protocol number, but it's OK becauseproto_to_name()returns the firstly matched entry "icmpv6" as ever.
Quoted 4 lines
I'm uncomfortable with having proto names in source code anyway, to me it clashes horribly with getprotobyname and friends which for historical and bizarre reasons might be looked up centrally (using nss) via ldap !!
We're talking about a firewall here. Decent security practise suggests that you block all kind of traffic until you've loaded your ruleset. Retrieving service/protocol information from NIS/LDAP or other network based services is a conflicht with this practise and prone to fail sooner or later, since it creates awkward dependencies (can't restart/reload firewall because other machine not alive, etc.).
Also, any kind of lookup table can probably be compromised, and any small change in /etc/{protocols,services} has implicit changes in your packet filter ruleset, so it provides for an interesting 'hidden' path for attackers.
So I'm very comfortable in having some values hardcoded, and I very much support any admin who hardcodes port and protocol numbers in their rulesets.
For similar (and even worse) reasons, I'm strictly against host name lookup support...
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
From: Amin Azez <[email protected]>
Date: Mon, 10 Apr 2006 13:02:02 +0100
Quoted 10 lines
Quoted 8 lines · Yasuyuki KOZAKAI
[IP6TABLES] kill manually comparing protocol name with "ipv6-icmp"
This adds "ipv6-icmp" to chain_protos[] and kill manually comparing the argument of '-p' with it.
chain_protos[] has the "icmpv6" with the same protocol number, but it's OK because
proto_to_name()returns the firstly matched entry "icmpv6" as ever.
Quoted 6 lines
I'm uncomfortable with having proto names in source code anyway, to me it clashes horribly with getprotobyname and friends which for historical and bizarre reasons might be looked up centrally (using nss) via ldap !!
However I guess history also shows that protocol names have been stable over the years :-) so what can I say?
For ease to use and to avoid confusing, I'm comfortable with having protocol names until stable name of them are spread widely.
For example, /etc/protocols in Fedora Core 5 is based on RFC1340, which was obsoleted (Currently protocol name list is published by IANA:
http://www.iana.org). It includes "ipv6-crypt" and "ipv6-auth", they ware replaced with "esp" and "ah" in IANA list.
On the other hand, I heard Debian has later names (correct ?).
It's better to push distributors to update /etc/protocols if people want to use later names without hard coding in the future.
About other protocol names (tcp, udp, ...), I don't know detail reason to keep them in iptables. I imagine it's such as guarantee of usability.
-- Yasuyuki Kozakai