]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
updating token ring example
authorJosh <jrosenba@cisco.com>
Wed, 25 Jun 2014 20:38:32 +0000 (16:38 -0400)
committerJosh <jrosenba@cisco.com>
Wed, 25 Jun 2014 20:38:32 +0000 (16:38 -0400)
extra/src/codecs/token_ring.cc
src/codecs/root/CMakeLists.txt
src/codecs/root/cd_linux_sll.cc
src/protocols/linux_sll.h

index 19efed20ed9111ba6a4303c776c019d26250c309..fd3280786228e1d24d47f2bbdf400e4e06e7fa92 100644 (file)
@@ -89,18 +89,8 @@ bool TrCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
     uint32_t cap_len = raw_len;
     uint32_t dataoff;      /* data offset is variable here */
 
-
-    DEBUG_WRAP(DebugMessage(DEBUG_DECODE, "Packet!\n");
-            DebugMessage(DEBUG_DECODE, "caplen: %lu    pktlen: %lu\n",
-                (unsigned long)cap_len,(unsigned long) raw_len);
-            );
-
     if(cap_len < sizeof(token_ring::Trh_hdr))
     {
-        DEBUG_WRAP(DebugMessage(DEBUG_DECODE,
-            "Captured data length < Token Ring header length! "
-            "(%d < %d bytes)\n", cap_len, TR_HLEN););
-
         codec_events::decoder_event(p, DECODE_BAD_TRH);
         return false;
     }
@@ -127,11 +117,6 @@ bool TrCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
      */
     if(cap_len < (sizeof(token_ring::Trh_hdr) + sizeof(token_ring::Trh_llc)))
     {
-        DEBUG_WRAP(DebugMessage(DEBUG_DECODE,
-            "Captured data length < Token Ring header length! "
-            "(%d < %d bytes)\n", cap_len,
-            (sizeof(token_ring::Trh_hdr) + sizeof(token_ring::Trh_llc))););
-
         codec_events::decoder_event(p, DECODE_BAD_TR_ETHLLC);
         return false;
     }
@@ -149,11 +134,6 @@ bool TrCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
 
         if(cap_len < (sizeof(token_ring::Trh_hdr) + sizeof(token_ring::Trh_llc) + sizeof(token_ring::Trh_mr)))
         {
-            DEBUG_WRAP(DebugMessage(DEBUG_DECODE,
-                "Captured data length < Token Ring header length! "
-                "(%d < %d bytes)\n", cap_len,
-                (sizeof(token_ring::Trh_hdr) + sizeof(token_ring::Trh_llc) + sizeof(token_ring::Trh_mr))););
-
             codec_events::decoder_event(p, DECODE_BAD_TRHMR);
             return false;
         }
@@ -165,11 +145,6 @@ bool TrCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
         if(cap_len < (sizeof(token_ring::Trh_hdr) + sizeof(token_ring::Trh_llc) +
                       sizeof(token_ring::Trh_mr) + TRH_MR_LEN(trhmr)))
         {
-            DEBUG_WRAP(DebugMessage(DEBUG_DECODE,
-                "Captured data length < Token Ring header length! "
-                "(%d < %d bytes)\n", cap_len,
-                (sizeof(token_ring::Trh_hdr) + sizeof(token_ring::Trh_llc) + sizeof(token_ring::Trh_mr))););
-
             codec_events::decoder_event(p, DECODE_BAD_TR_MR_LEN);
             return false;
         }
@@ -194,9 +169,6 @@ bool TrCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
      */
     if(trhllc->dsap != IPARP_SAP && trhllc->ssap != IPARP_SAP)
     {
-        DEBUG_WRAP(
-                   DebugMessage(DEBUG_DECODE, "DSAP and SSAP arent set to SNAP\n");
-                );
         return false;
     }
 
index b6d4c7edb2d28d064810a7e2dcfe3f8e11ed3300..c036327003cb6f1df8af8f97f3fb5d009363de5e 100644 (file)
@@ -26,8 +26,11 @@ if (STATIC_CODECS)
     endif (ENABLE_NON_ETHER_DECODERS)
 
 else()
-    add_shared_library(cd_wlan codecs cd_wlan.cc cd_wlan_module.h cd_wlan_module.cc)
-    add_shared_library(cd_linux_sll codecs cd_linux_sll.cc)
+
+    if (ENABLE_NON_ETHER_DECODERS)
+        add_shared_library(cd_wlan codecs cd_wlan.cc cd_wlan_module.h cd_wlan_module.cc)
+        add_shared_library(cd_linux_sll codecs cd_linux_sll.cc)
+    endif()
 endif()
 
 
index 951704b56cd07aca572a744392c21bd6c064afca..ac852702eac77890dcd91a5c566011ad3d478567 100644 (file)
@@ -70,7 +70,7 @@ bool LinuxSllCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
         Packet* /*p*/, uint16_t &lyr_len, uint16_t &next_prot_id)
 {
     /* do a little validation */
-    if(raw_len < SLL_HDR_LEN)
+    if(raw_len < linux_sll::SLL_HDR_LEN)
     {
         if (ScLogVerbose())
         {
@@ -84,7 +84,7 @@ bool LinuxSllCodec::decode(const uint8_t *raw_pkt, const uint32_t raw_len,
 
     /* grab out the network type */
     next_prot_id = ntohs(sllh->sll_protocol);
-    lyr_len = SLL_HDR_LEN;
+    lyr_len = linux_sll::SLL_HDR_LEN;
     return true;
 }
 
index 092237fce4c344276d85a0a40d11febc6f0b6154..d66ad5d074f8c0eb4a4431df23280be279492228 100644 (file)
@@ -32,8 +32,9 @@ namespace linux_sll
  * (taken from tcpdump source).
  */
 
-#define SLL_HDR_LEN     16              /* total header length */
-#define SLL_ADDRLEN     8               /* length of address field */
+const uint8_t SLL_HDR_LEN = 16;
+const uint8_t SLL_ADDRLEN = 8;
+
 typedef struct _SLLHdr {
         uint16_t       sll_pkttype;    /* packet type */
         uint16_t       sll_hatype;     /* link-layer address type */