mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sebek64@post.cz (Marcel Sebek)
To: davem@redhat.com, linux-kernel@vger.kernel.org,
	netdev@oss.sgi.com, netfilter-devel@lists.netfilter.org,
	laforge@netfilter.org
Subject: [PATCH 2.6] ip6t_LOG and packets with hop-by-hop options
Date: Tue, 6 Jul 2004 17:09:18 +0200	[thread overview]
Message-ID: <20040706150918.GA5009@penguin.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

Packet with IPPROTO_HOPOPTS extended header isn't logged properly by
ip6t_LOG.c. It only prints PROTO=0 and nothing more, because
IPPROTO_HOPOPTS=0 and in this file 0 is used to indicate last header.
This patch fix it by using IPPROTO_NONE to indicate last header.

Signed-off-by: Marcel Sebek <sebek64@post.cz>


diff -urpN linux-2.6/net/ipv6/netfilter/ip6t_LOG.c linux-2.6-new/net/ipv6/netfilter/ip6t_LOG.c
--- linux-2.6/net/ipv6/netfilter/ip6t_LOG.c	2004-04-21 20:01:54.000000000 +0200
+++ linux-2.6-new/net/ipv6/netfilter/ip6t_LOG.c	2004-07-06 16:48:20.000000000 +0200
@@ -48,10 +48,10 @@ static spinlock_t log_lock = SPIN_LOCK_U
 
 /* 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 @@ static u_int8_t ip6_nexthdr(u_int8_t cur
 			break;
 	}	
 	return nexthdr;
-
 }
 
 /* One level of recursion won't kill us */
@@ -101,7 +100,7 @@ static void dump_packet(const struct ip6
 
 	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,7 @@ static void dump_packet(const struct ip6
 		}
 		break;
 	}
-	/* Max length: 10 "PROTO 255 " */
+	/* 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


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2004-07-06 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-06 15:09 Marcel Sebek [this message]
2004-07-06 16:01 ` Harald Welte
2004-07-06 20:55   ` David S. Miller

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=20040706150918.GA5009@penguin.localdomain \
    --to=sebek64@post.cz \
    --cc=davem@redhat.com \
    --cc=laforge@netfilter.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /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

all inboxes | Powered by JetHome®