All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH IP6TABLES]: don't allow to specify protocol of IPv6 extension header
@ 2006-03-29  6:59 Yasuyuki KOZAKAI
  2006-03-29  8:11 ` Yasuyuki KOZAKAI
  0 siblings, 1 reply; 7+ messages in thread
From: Yasuyuki KOZAKAI @ 2006-03-29  6:59 UTC (permalink / raw)
  To: netfilter-devel; +Cc: laforge, kaber

[-- Attachment #1: Type: Text/Plain, Size: 256 bytes --]


Hi,

Sometimes I hear that people do 'ip6tables -p ah ...' which never matches
any packet. IPv6 extension headers except of ESP are skipped and invalid
as argument of '-p'. Then I propose that ip6tables exits with error in such
case.

-- Yasuyuki Kozakai

[-- Attachment #2: check-exthdr.patch --]
[-- Type: Text/Plain, Size: 1485 bytes --]

[PATCH] don't allow to specify protocol of IPv6 extension header

---
commit 9bbbc3c90face808eb05da8aae69c9e6f7b508b3
tree 5506d3520a60553607f074ed21969ca0c2fbb8aa
parent 5a2223d5d7d2d81ab036effd7460a9dea45d247e
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Wed, 29 Mar 2006 12:50:32 +0900
committer Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Wed, 29 Mar 2006 12:50:32 +0900

 ip6tables.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/ip6tables.c b/ip6tables.c
index dcf7d36..a6471ee 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -849,6 +849,17 @@ parse_protocol(const char *s)
 	return (u_int16_t)proto;
 }
 
+/* proto means upper-layer protocol or ESP ? */
+static int is_exthdr(u_int16_t proto)
+{
+	return (proto == IPPROTO_HOPOPTS ||
+		proto == IPPROTO_ROUTING ||
+		proto == IPPROTO_FRAGMENT ||
+		proto == IPPROTO_ESP ||
+		proto == IPPROTO_AH ||
+		proto == IPPROTO_DSTOPTS);
+}
+
 void parse_interface(const char *arg, char *vianame, unsigned char *mask)
 {
 	int vialen = strlen(arg);
@@ -1926,6 +1937,13 @@ int do_command6(int argc, char *argv[], 
 			    && (fw.ipv6.invflags & IP6T_INV_PROTO))
 				exit_error(PARAMETER_PROBLEM,
 					   "rule would never match protocol");
+			
+			if (fw.ipv6.proto != IPPROTO_ESP &&
+			    is_exthdr(fw.ipv6.proto))
+				exit_error(PARAMETER_PROBLEM,
+					   "invalid protocol: %s. "
+					   "use exension match instead.",
+					   protocol);
 			break;
 
 		case 's':

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-31  1:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200603290659.k2T6xDJh017360@toshiba.co.jp>
2006-03-29  8:11 ` [PATCH IP6TABLES]: don't allow to specify protocol of IPv6 extension header Patrick McHardy
2006-03-29  8:34   ` Yasuyuki KOZAKAI
     [not found]   ` <200603290834.k2T8Y8q5024524@toshiba.co.jp>
2006-03-29  9:09     ` Patrick McHardy
2006-03-30  7:56       ` Yasuyuki KOZAKAI
     [not found]       ` <200603300756.k2U7u3SN006847@toshiba.co.jp>
2006-03-31  1:08         ` Patrick McHardy
2006-03-29  6:59 Yasuyuki KOZAKAI
2006-03-29  8:11 ` Yasuyuki KOZAKAI

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.