All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kiran Kumar Immidi <immidi@spymac.com>
To: Harald Welte <laforge@netfilter.org>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: Re: sctp conntrack
Date: Mon, 2 Aug 2004 15:55:38 +0530	[thread overview]
Message-ID: <200408021555.38315.immidi@spymac.com> (raw)
In-Reply-To: <20040801165005.GA14539@sunbeam2>

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

On Sunday 01 August 2004 10:20 pm, Harald Welte wrote:

> > - The type of these timeouts in case of TCP is unsigned long, though the
> > code in ip_conntrack_standalone.c treats them as unsigned int. I am not
> > sure of the working, but I suspect something wrong here. I have followed
> > the same pattern however.
>
> yes, indeed. on 64bit archs this is going to cause trouble :(

  Do you want me to make a patch for this?

  Attached is a patch which adds SCTP support for the LOG target. This applies 
against 2.6.7 sources. (I had sent this patch earlier, but that one seems to 
have problems.. this is fine).

[-- Attachment #2: ipt_LOG.c_sctp.diff --]
[-- Type: text/x-diff, Size: 2593 bytes --]

--- linux-2.6.7/net/ipv4/netfilter/ipt_LOG.c.orig	2004-08-02 15:44:29.009342792 +0530
+++ linux-2.6.7/net/ipv4/netfilter/ipt_LOG.c	2004-08-02 15:45:08.014413120 +0530
@@ -17,6 +17,7 @@
 #include <net/icmp.h>
 #include <net/udp.h>
 #include <net/tcp.h>
+#include <linux/sctp.h>
 #include <net/route.h>
 
 #include <linux/netfilter.h>
@@ -310,6 +311,90 @@
 		printk("SPI=0x%x ", ntohl(esph.spi));
 		break;
 	}
+	case IPPROTO_SCTP: {
+			u_int32_t offset, count;
+			sctp_sctphdr_t sh;
+			sctp_chunkhdr_t sch;
+
+			const char *sctp_chunk_names[255] = {
+			 [0]    = "DATA",
+			 [1]    = "INIT",
+			 [2]    = "INIT_ACK",
+			 [3]    = "SACK",
+			 [4]    = "HEARTBEAT",
+			 [5]    = "HEARTBEAT_ACK",
+			 [6]    = "ABORT",
+			 [7]    = "SHUTDOWN",
+			 [8]    = "SHUTDOWN_ACK",
+			 [9]    = "ERROR",
+			 [10]   = "COOKIE_ECHO",
+			 [11]   = "COOKIE_ACK",
+			 [12]   = "ECN_ECNE",
+			 [13]   = "ECN_CWR",
+			 [14]   = "SHUTDOWN_COMPLETE",
+			 [0xc1] = "ASCONF",
+			 [0x80] = "ASCONF_ACK",
+			};
+
+		/* Max length: 11 "PROTO=SCTP " */
+		printk("PROTO=SCTP ");
+
+		if (ntohs(iph.frag_off) & IP_OFFSET)
+			break;
+
+		/* Max length: 25 "INCOMPLETE [65535 bytes] " */
+		if (skb_copy_bits(skb, iphoff+iph.ihl*4, &sh, sizeof(sh))
+		    < 0) {
+			printk("INCOMPLETE [%u bytes] ",
+			       skb->len - iphoff - iph.ihl*4);
+			break;
+		}
+
+		/* Max length: 20 "SPT=65535 DPT=65535 " */
+		printk("SPT=%u DPT=%u ",
+		       ntohs(sh.source), ntohs(sh.dest));
+
+		printk("Chunks: ");
+		count = 0;
+		for (offset = iph.ihl * 4 + sizeof (sctp_sctphdr_t) + iphoff;
+			offset < skb->len;
+			offset += (htons(sch.length) + 3) & ~3, count++) {
+			if (skb_copy_bits(skb, offset, &sch, 
+				sizeof(sch)) < 0) {
+				printk("INCOMPLETE CHUNK HDR[%u bytes] ",
+					skb->len - iphoff - iph.ihl*4);
+				break;
+			}
+			printk("%s",sctp_chunk_names[sch.type]? 
+				sctp_chunk_names[sch.type]: "UNKNOWN");
+
+			/* Print the chunk flags */
+			if (sch.type == SCTP_CID_DATA) {
+				char u,b,e;
+
+				u = b = e = 0;
+				if (sch.flags & 1) e = 1;
+				if (sch.flags & 2) b = 1;
+				if (sch.flags & 4) u = 1;
+
+				if (u || b || e) {
+					printk("[");
+					u && printk("U");
+					b && printk("B");
+					e && printk("E");
+					printk("]");
+				}
+			} else if (sch.type == SCTP_CID_ABORT 
+				|| sch.type == SCTP_CID_SHUTDOWN_COMPLETE) {
+				if (sch.flags & 1) {
+					printk("[T]");
+				}
+			}
+			printk(" ");
+		}
+		printk(": %d chunk%s ", count, (count == 1)? "": "s");
+		break;
+	}
 	/* Max length: 10 "PROTO 255 " */
 	default:
 		printk("PROTO=%u ", iph.protocol);

  reply	other threads:[~2004-08-02 10:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-22 19:16 sctp conntrack Harald Welte
2004-07-27  8:18 ` Kiran Kumar Immidi
2004-08-01 16:50   ` Harald Welte
2004-08-02 10:25     ` Kiran Kumar Immidi [this message]
2004-08-02 11:05       ` Harald Welte
2004-08-02 11:34         ` Pablo Neira
2004-08-02 11:37           ` Pablo Neira
2004-08-02 11:54             ` Jozsef Kadlecsik
2004-08-02 12:32               ` Pablo Neira

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=200408021555.38315.immidi@spymac.com \
    --to=immidi@spymac.com \
    --cc=laforge@netfilter.org \
    --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 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.