Netdev List
 help / color / mirror / Atom feed
From: sebek64@post.cz (Marcel Sebek)
To: netdev@oss.sgi.com
Subject: ip6t_LOG doesn't log packets with HOPOPTS extheader correctly
Date: Fri, 21 May 2004 19:39:53 +0200	[thread overview]
Message-ID: <20040521173953.GA8425@penguin.localdomain> (raw)

Hi.

I think there is a bug in ip6t_LOG. When packet contains IPPROTO_HOPOPTS
extended header, only 'PROTO=0' is printed out and iteration through the
headers stops. That's because return value from ip6_nexthdr indicating
no next header is the same as IPPROTO_HOPOPTS.

The following patch changes this value to IPPROTO_NONE.


--- ip6t_LOG.c.old	2004-05-21 18:31:12.000000000 +0200
+++ ip6t_LOG.c	2004-05-21 19:14:02.000000000 +0200
@@ -48,10 +48,10 @@
 
 /* takes in current header and pointer to the header */
 /* if another header exists, sets hdrptr to the next header
-   and returns the new header value, else returns 0 */
+   and returns the new header value, else returns IPPROTO_NONE */
 static u_int8_t ip6_nexthdr(u_int8_t currenthdr, u_int8_t **hdrptr)
 {
-	u_int8_t hdrlen, nexthdr = 0;
+	u_int8_t hdrlen, nexthdr = IPPROTO_NONE;
 
 	switch(currenthdr){
 		case IPPROTO_AH:
@@ -77,7 +77,6 @@
 			break;
 	}	
 	return nexthdr;
-
 }
 
 /* One level of recursion won't kill us */
@@ -101,7 +100,7 @@
 
 	fragment = 0;
 	hdrptr = (u_int8_t *)(ipv6h + 1);
-	while (currenthdr) {
+	while (currenthdr != IPPROTO_NONE) {
 		if ((currenthdr == IPPROTO_TCP) ||
 		    (currenthdr == IPPROTO_UDP) ||
 		    (currenthdr == IPPROTO_ICMPV6))
@@ -264,7 +263,11 @@
 		}
 		break;
 	}
-	/* Max length: 10 "PROTO 255 " */
+	/* Max length: 11 "PROTO=NONE " */
+	case IPPROTO_NONE:
+		printk("PROTO=NONE ");
+		break;
+	/* Max length: 10 "PROTO=255 " */
 	default:
 		printk("PROTO=%u ", currenthdr);
 	}


-- 
Marcel Sebek
jabber: sebek@jabber.cz                     ICQ: 279852819
linux user number: 307850                 GPG ID: 5F88735E
GPG FP: 0F01 BAB8 3148 94DB B95D  1FCA 8B63 CA06 5F88 735E

                 reply	other threads:[~2004-05-21 17:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040521173953.GA8425@penguin.localdomain \
    --to=sebek64@post.cz \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox