[Oisf-devel] [PATCH 4/9] SCTP support: add parsing of sctp

Eric Leblond eric at regit.org
Mon Feb 28 16:44:30 UTC 2011


This patch adds support of SCTP in all part of the code in charge
of decoding packets.
---
 src/decode-icmpv4.h           |    1 +
 src/decode-icmpv6.c           |    1 +
 src/decode-icmpv6.h           |    1 +
 src/decode-ipv4.c             |    4 ++++
 src/decode-ipv6.c             |    7 +++++++
 src/decode.h                  |    2 ++
 src/respond-reject-libnet11.c |    1 +
 7 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/decode-icmpv4.h b/src/decode-icmpv4.h
index 79eafd9..ae889ae 100644
--- a/src/decode-icmpv4.h
+++ b/src/decode-icmpv4.h
@@ -26,6 +26,7 @@
 
 #include "decode.h"
 #include "decode-tcp.h"
+#include "decode-sctp.h"
 #include "decode-udp.h"
 
 #define ICMPV4_HEADER_LEN       8
diff --git a/src/decode-icmpv6.c b/src/decode-icmpv6.c
index 04fbe7c..fa1020b 100644
--- a/src/decode-icmpv6.c
+++ b/src/decode-icmpv6.c
@@ -27,6 +27,7 @@
 #include "decode-icmpv6.h"
 #include "decode.h"
 #include "decode-tcp.h"
+#include "decode-sctp.h"
 #include "decode-udp.h"
 #include "decode-events.h"
 #include "util-unittest.h"
diff --git a/src/decode-icmpv6.h b/src/decode-icmpv6.h
index 86d85ca..bcfd6d2 100644
--- a/src/decode-icmpv6.h
+++ b/src/decode-icmpv6.h
@@ -25,6 +25,7 @@
 #define __DECODE_ICMPV6_H__
 
 #include "decode-tcp.h"
+#include "decode-sctp.h"
 #include "decode-udp.h"
 #include "decode-ipv6.h"
 
diff --git a/src/decode-ipv4.c b/src/decode-ipv4.c
index dfc1432..67dfd13 100644
--- a/src/decode-ipv4.c
+++ b/src/decode-ipv4.c
@@ -556,6 +556,10 @@ void DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
             DecodeICMPV4(tv, dtv, p, pkt + IPV4_GET_HLEN(p),
                          IPV4_GET_IPLEN(p) - IPV4_GET_HLEN(p), pq);
             break;
+        case IPPROTO_SCTP:
+            DecodeSCTP(tv, dtv, p, pkt + IPV4_GET_HLEN(p),
+                      IPV4_GET_IPLEN(p) - IPV4_GET_HLEN(p), pq);
+            break;
         case IPPROTO_IPV6:
             {
                 if (pq != NULL) {
diff --git a/src/decode-ipv6.c b/src/decode-ipv6.c
index b3a5776..8579bc9 100644
--- a/src/decode-ipv6.c
+++ b/src/decode-ipv6.c
@@ -73,6 +73,11 @@ DecodeIPV6ExtHdrs(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt
                 DecodeICMPV6(tv, dtv, p, pkt, plen, pq);
                 SCReturn;
 
+            case IPPROTO_SCTP:
+                IPV6_SET_L4PROTO(p,nh);
+                DecodeSCTP(tv, dtv, p, pkt, plen, pq);
+                SCReturn;
+
             case IPPROTO_ROUTING:
                 hdrextlen = sizeof(IPV6RouteHdr);
                 hdrextlen += (*(pkt+1) * 8);  /* 8 octet units */
@@ -441,6 +446,8 @@ void DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt,
             break;
         case IPPROTO_ICMPV6:
             return DecodeICMPV6(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq);
+        case IPPROTO_SCTP:
+            return DecodeSCTP(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq);
         case IPPROTO_FRAGMENT:
         case IPPROTO_HOPOPTS:
         case IPPROTO_ROUTING:
diff --git a/src/decode.h b/src/decode.h
index bde9426..e12482d 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -45,6 +45,7 @@
 #include "decode-icmpv6.h"
 #include "decode-tcp.h"
 #include "decode-udp.h"
+#include "decode-sctp.h"
 #include "decode-raw.h"
 #include "decode-vlan.h"
 
@@ -702,6 +703,7 @@ void DecodeICMPV4(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_
 void DecodeICMPV6(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
 void DecodeTCP(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
 void DecodeUDP(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
+void DecodeSCTP(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
 void DecodeGRE(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
 void DecodeVLAN(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
 
diff --git a/src/respond-reject-libnet11.c b/src/respond-reject-libnet11.c
index 8f222e4..687e064 100644
--- a/src/respond-reject-libnet11.c
+++ b/src/respond-reject-libnet11.c
@@ -37,6 +37,7 @@
 #include "decode.h"
 #include "decode-ipv4.h"
 #include "decode-tcp.h"
+#include "decode-sctp.h"
 #include "decode-udp.h"
 #include "packet-queue.h"
 #include "threads.h"
-- 
1.7.1




More information about the Oisf-devel mailing list