From: Josh Date: Fri, 18 Apr 2014 15:40:15 +0000 (-0400) Subject: Adding MPLS codec. Changing EtherType prefix name. Removing ethOverMpls (using... X-Git-Tag: 3.0.0-233~1559^2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=977a5efccbcf3842f1df75fac582cdafd3b2f644;p=thirdparty%2Fsnort3.git Adding MPLS codec. Changing EtherType prefix name. Removing ethOverMpls (using transbridge instead). --- diff --git a/src/codecs/basic/cd_udp.cc b/src/codecs/basic/cd_udp.cc index 295e2cf29..35651ef64 100644 --- a/src/codecs/basic/cd_udp.cc +++ b/src/codecs/basic/cd_udp.cc @@ -39,6 +39,7 @@ #include "protocols/udp.h" #include "protocols/teredo.h" #include "protocols/gtp.h" +#include "protocols/undefined_protocols.h" #include "framework/codec.h" #include "codecs/codec_events.h" @@ -253,14 +254,14 @@ bool decode(const uint8_t *raw_pkt, const uint32_t len, ScDeepTeredoInspection()) { if ( !p->frag_flag ) - next_prot_id = teredo::teredo_id(); + next_prot_id = PROTOCOL_TEREDO; } if (ScGTPDecoding() && (ScIsGTPPort(p->sp)||ScIsGTPPort(p->dp))) { if ( !p->frag_flag ) - next_prot_id = gtp::gtp_id(); + next_prot_id = PROTOCOL_GTP; } return true; diff --git a/src/codecs/decode.h b/src/codecs/decode.h index cc12d331d..5747b4da1 100644 --- a/src/codecs/decode.h +++ b/src/codecs/decode.h @@ -49,7 +49,7 @@ extern "C" { #include "snort_types.h" #include "protocols/packet.h" #include "profiler.h" -#include "codecs/tmp/prot_mpls.h" +#include "protocols/mpls.h" diff --git a/src/codecs/plugins/CMakeLists.txt b/src/codecs/plugins/CMakeLists.txt index 3e048512c..c759d2046 100644 --- a/src/codecs/plugins/CMakeLists.txt +++ b/src/codecs/plugins/CMakeLists.txt @@ -8,6 +8,8 @@ add_library( codec_plugins STATIC cd_arp.cc cd_ethloopback.cc cd_gre.cc + cd_mpls.cc + cd_transbridge.cc ) diff --git a/src/codecs/plugins/TODO b/src/codecs/plugins/TODO index 896aa58bf..7604fae52 100644 --- a/src/codecs/plugins/TODO +++ b/src/codecs/plugins/TODO @@ -6,6 +6,15 @@ REMOVE: "protocols/encode.h" +MPLS: + "Remove protocols/mpls.h" + Pull in default_mpls to cd_mpls. Remove it from the snort_config. + Create MPLS module which creates the default mpls + +Trans Bridge: + Is no longer solely GRE. Switcht he docer name? + + ***************************************************************************** ******************************** ******************************************* **************************** *************************************** @@ -99,8 +108,6 @@ ________________________________________________________________________________ RUSS - --- Do we change the typedef factor for structs? __________________________________________________________________________________________________________ diff --git a/src/codecs/plugins/cd_gre.cc b/src/codecs/plugins/cd_gre.cc index 23796942e..74ee495bf 100644 --- a/src/codecs/plugins/cd_gre.cc +++ b/src/codecs/plugins/cd_gre.cc @@ -194,7 +194,7 @@ bool GreCodec::decode(const uint8_t *raw_pkt, const uint32_t len, } /* protocol must be 0x880B - PPP */ - if (GRE_PROTO(p->greh) != PPP_ETHERTYPE) + if (GRE_PROTO(p->greh) != ETHERTYPE_PPP) { CodecEvents::decoder_alert_encapsulated(p, DECODE_GRE_V1_INVALID_HEADER, raw_pkt, len); diff --git a/src/codecs/plugins/cd_gtp.cc b/src/codecs/plugins/cd_gtp.cc index d5aa3d854..e159dbb31 100644 --- a/src/codecs/plugins/cd_gtp.cc +++ b/src/codecs/plugins/cd_gtp.cc @@ -37,13 +37,15 @@ #include "protocols/ipv6.h" #include "packet_io/active.h" +#include "protocols/undefined_protocols.h" + namespace { class GtpCodec : public Codec { public: - GtpCodec() : Codec("gtp"){}; + GtpCodec() : Codec("GTP"){}; ~GtpCodec(); @@ -274,7 +276,7 @@ EncStatus GTP_Update (Packet*, Layer* lyr, uint32_t* len) void GtpCodec::get_protocol_ids(std::vector& v) { - v.push_back(gtp::gtp_id()); + v.push_back(PROTOCOL_GTP); } static Codec* ctor() diff --git a/src/codecs/tmp/prot_mpls.cc b/src/codecs/plugins/cd_mpls.cc similarity index 64% rename from src/codecs/tmp/prot_mpls.cc rename to src/codecs/plugins/cd_mpls.cc index ad3a36cc6..43e60685a 100644 --- a/src/codecs/tmp/prot_mpls.cc +++ b/src/codecs/plugins/cd_mpls.cc @@ -15,38 +15,64 @@ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** -** You should have received a copy of the GNU General Public License +** You should have received a copy of the GNU General Public LicenseUpdateMPLSStats ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "framework/codec.h" +#include "codecs/codec_events.h" +#include "codecs/decode_module.h" +#include "network_inspectors/perf_monitor/perf_base.h" +#include "network_inspectors/perf_monitor/perf.h" +#include "snort.h" +#include "protocols/mpls.h" +#include "protocols/undefined_protocols.h" +#include "codecs/codec_events.h" +#include "packet_io/active.h" +#include "protocols/ethertypes.h" +#include "protocols/mpls.h" + +namespace +{ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +class MplsCodec : public Codec +{ +public: + MplsCodec() : Codec("MPLS"){}; + ~MplsCodec(); + + + virtual bool decode(const uint8_t *raw_pkt, const uint32_t len, + Packet *, uint16_t &p_hdr_len, int &next_prot_id); + + virtual void get_protocol_ids(std::vector&); + +}; + + +const uint16_t ETHERNET_TYPE_MPLS_UNICAST = 0x8847; +const uint16_t ETHERNET_TYPE_MPLS_MULTICAST = 0x8848; + +const static uint32_t MPLS_HEADER_LEN = 4; +const static uint32_t NUM_RESERVED_LABELS = 16; -#include "generators.h" -#include "decode.h" -#include "static_include.h" +} // anonymous namespace -#include "network_inspectors/perfmonitor/perf.h" -#include "network_inspectors/perfmonitor/perf_base.h" -#include "prot_mpls.h" -#include "prot_ipv6.h" -#include "prot_ipv4.h" -#include "prot_ethloopback.h" -#include "prot_ethovermpls.h" static int checkMplsHdr(uint32_t, uint8_t, uint8_t, uint8_t, Packet *); -void DecodeMPLS(const uint8_t* pkt, const uint32_t len, Packet* p) + + +bool MplsCodec::decode(const uint8_t *raw_pkt, const uint32_t len, + Packet *p, uint16_t &p_hdr_len, int &next_prot_id) { uint32_t* tmpMplsHdr; uint32_t mpls_h; uint32_t label; - uint32_t mlen = 0; + p_hdr_len= 0; uint8_t exp; uint8_t bos = 0; @@ -56,30 +82,21 @@ void DecodeMPLS(const uint8_t* pkt, const uint32_t len, Packet* p) int iRet = 0; - - if(!ScMplsMulticast()) - { - DecoderEvent(p, DECODE_BAD_MPLS, - DECODE_MULTICAST_MPLS_STR); -// SnortEventqAdd(GENERATOR_SNORT_DECODE, DECODE_BAD_MPLS, 1, DECODE_CLASS, 3, DECODE_MULTICAST_MPLS_STR, 0); - } - - - dc.mpls++; +// dc.mpls++; UpdateMPLSStats(&sfBase, len, Active_PacketWasDropped()); - tmpMplsHdr = (uint32_t *) pkt; + tmpMplsHdr = (uint32_t *) raw_pkt; p->mpls = NULL; while (!bos) { if(stack_len < MPLS_HEADER_LEN) { - DecoderEvent(p, DECODE_BAD_MPLS, DECODE_BAD_MPLS_STR); + DecoderEvent(p, DECODE_BAD_MPLS); - dc.discards++; +// dc.discards++; p->iph = NULL; p->family = NO_IP; - return; + return false; } mpls_h = ntohl(*tmpMplsHdr); @@ -90,7 +107,7 @@ void DecodeMPLS(const uint8_t* pkt, const uint32_t len, Packet* p) label = (mpls_h>>4) & 0x000FFFFF; if((labelmplsHdr.ttl = ttl; /** p->mpls = &(p->mplsHdr); - **/ + **/ p->mpls = tmpMplsHdr; if(!iRet) { @@ -112,38 +129,37 @@ void DecodeMPLS(const uint8_t* pkt, const uint32_t len, Packet* p) if ((ScMplsStackDepth() != -1) && (chainLen++ >= ScMplsStackDepth())) { - DecoderEvent(p, DECODE_MPLS_LABEL_STACK, - DECODE_MPLS_LABEL_STACK_STR); + DecoderEvent(p, DECODE_MPLS_LABEL_STACK); - dc.discards++; +// dc.discards++; p->iph = NULL; p->family = NO_IP; - return; + return false; } } /* while bos not 1, peel off more labels */ - mlen = (uint8_t*)tmpMplsHdr - pkt; - PushLayer(PROTO_MPLS, p, pkt, mlen); - mlen = len - mlen; + p_hdr_len = (uint8_t*)tmpMplsHdr - raw_pkt; switch (iRet) { case MPLS_PAYLOADTYPE_IPV4: - DecodeIP((uint8_t *)tmpMplsHdr, mlen, p); + next_prot_id = ETHERTYPE_IPV4; break; case MPLS_PAYLOADTYPE_IPV6: - DecodeIPV6((uint8_t *)tmpMplsHdr, mlen, p); + next_prot_id = ETHERTYPE_IPV6; break; case MPLS_PAYLOADTYPE_ETHERNET: - DecodeEthOverMPLS((uint8_t *)tmpMplsHdr, mlen, p); + next_prot_id = ETHERTYPE_TRANS_ETHER_BRIDGING; break; default: + next_prot_id = -1; break; } - return; + + return true; } @@ -173,11 +189,9 @@ static int checkMplsHdr( ||((!label)&&(ScMplsPayloadType() != MPLS_PAYLOADTYPE_IPV4))) { if( !label ) - DecoderEvent(p, DECODE_BAD_MPLS_LABEL0, - DECODE_BAD_MPLS_LABEL0_STR); + DecoderEvent(p, DECODE_BAD_MPLS_LABEL0); else - DecoderEvent(p, DECODE_BAD_MPLS_LABEL2, - DECODE_BAD_MPLS_LABEL2_STR); + DecoderEvent(p, DECODE_BAD_MPLS_LABEL2); } break; } @@ -187,11 +201,9 @@ static int checkMplsHdr( * and move on to the next one. */ if( !label ) - DecoderEvent(p, DECODE_BAD_MPLS_LABEL0, - DECODE_BAD_MPLS_LABEL0_STR); + DecoderEvent(p, DECODE_BAD_MPLS_LABEL0); else - DecoderEvent(p, DECODE_BAD_MPLS_LABEL2, - DECODE_BAD_MPLS_LABEL2_STR); + DecoderEvent(p, DECODE_BAD_MPLS_LABEL2); dc.discards++; p->iph = NULL; @@ -202,20 +214,18 @@ static int checkMplsHdr( case 1: if(!bos) break; - DecoderEvent(p, DECODE_BAD_MPLS_LABEL1, - DECODE_BAD_MPLS_LABEL1_STR); + DecoderEvent(p, DECODE_BAD_MPLS_LABEL1); - dc.discards++; +// dc.discards++; p->iph = NULL; p->family = NO_IP; iRet = MPLS_PAYLOADTYPE_ERROR; break; - case 3: - DecoderEvent(p, DECODE_BAD_MPLS_LABEL3, - DECODE_BAD_MPLS_LABEL3_STR); + case 3: + DecoderEvent(p, DECODE_BAD_MPLS_LABEL3); - dc.discards++; +// dc.discards++; p->iph = NULL; p->family = NO_IP; iRet = MPLS_PAYLOADTYPE_ERROR; @@ -232,8 +242,7 @@ static int checkMplsHdr( case 13: case 14: case 15: - DecoderEvent(p, DECODE_MPLS_RESERVED_LABEL, - DECODE_MPLS_RESERVEDLABEL_STR); + DecoderEvent(p, DECODE_MPLS_RESERVED_LABEL); break; default: break; @@ -246,20 +255,51 @@ static int checkMplsHdr( } -static const char* name = "mpls_decode"; +void MplsCodec::get_protocol_ids(std::vector& v) +{ + v.push_back(ETHERNET_TYPE_MPLS_UNICAST); + v.push_back(ETHERNET_TYPE_MPLS_MULTICAST); +} + +static Codec* ctor() +{ + return new MplsCodec(); +} + +static void dtor(Codec *cd) +{ + delete cd; +} -static const CodecApi mpls_api = +static void sum() +{ +// sum_stats((PegCount*)&gdc, (PegCount*)&dc, array_size(dc_pegs)); +// memset(&dc, 0, sizeof(dc)); +} + +static void stats() +{ +// show_percent_stats((PegCount*)&gdc, dc_pegs, array_size(dc_pegs), +// "decoder"); +} + + + +static const char* name = "mpls_codec"; + +static const CodecApi codec_api = { { PT_CODEC, name, CDAPI_PLUGIN_V0, 0 }, - {ETHERNET_TYPE_MPLS_UNICAST, ETHERNET_TYPE_MPLS_MULTICAST}, NULL, // pinit NULL, // pterm NULL, // tinit NULL, // tterm - NULL, // ctor - NULL, // dtor - ErspanType2::DecodeTCP, + ctor, // ctor + dtor, // dtor + sum, // sum + stats // stats }; + diff --git a/src/codecs/plugins/cd_teredo.cc b/src/codecs/plugins/cd_teredo.cc index 9b2ef9907..18bff15e8 100644 --- a/src/codecs/plugins/cd_teredo.cc +++ b/src/codecs/plugins/cd_teredo.cc @@ -39,6 +39,7 @@ #include "packet_io/active.h" #include "protocols/ipv6.h" #include "protocols/teredo.h" +#include "protocols/undefined_protocols.h" namespace { @@ -118,7 +119,7 @@ bool TeredoCodec::decode(const uint8_t *raw_pkt, const uint32_t len, void TeredoCodec::get_protocol_ids(std::vector& v) { - v.push_back(teredo::teredo_id()); + v.push_back(PROTOCOL_TEREDO); } static Codec* ctor() diff --git a/src/codecs/plugins/cd_transbridge.cc b/src/codecs/plugins/cd_transbridge.cc index 225150060..068726f44 100644 --- a/src/codecs/plugins/cd_transbridge.cc +++ b/src/codecs/plugins/cd_transbridge.cc @@ -99,7 +99,7 @@ bool TransbridgeCodec::decode(const uint8_t *raw_pkt, const uint32_t len, void TransbridgeCodec::get_protocol_ids(std::vector& v) { - v.push_back(TRANS_ETHER_BRIDGING_ETHERTYPE); // defined in ethertypes.h" + v.push_back(ETHERTYPE_TRANS_ETHER_BRIDGING); // defined in ethertypes.h" } static Codec* ctor() diff --git a/src/codecs/tmp/prot_ethovermpls.cc b/src/codecs/tmp/prot_ethovermpls.cc deleted file mode 100644 index 9515abb86..000000000 --- a/src/codecs/tmp/prot_ethovermpls.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* $Id: decode.c,v 1.285 2013-06-29 03:03:00 rcombs Exp $ */ - -/* -** Copyright (C) 2002-2013 Sourcefire, Inc. -** Copyright (C) 1998-2002 Martin Roesch -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License Version 2 as -** published by the Free Software Foundation. You may not use, modify or -** distribute this program under any other version of the GNU General -** Public License. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "generators.h" -#include "decode.h" -#include "static_include.h" -#include "prot_ethovermpls.h" - - -#include "decoder_includes.h" -#include "prot_arp.h" -#include "prot_ethloopback.h" -#include "prot_pppoepkt.h" - -//-------------------------------------------------------------------- -// decode.c::MPLS -//-------------------------------------------------------------------- - -void DecodeEthOverMPLS(const uint8_t* pkt, const uint32_t len, Packet* p) -{ - /* do a little validation */ - if(len < ETHERNET_HEADER_LEN) - { - if (ScLogVerbose()) - { - ErrorMessage("Captured data length < Ethernet header length!" - " (%d bytes)\n", len); - } - - p->iph = NULL; - p->family = NO_IP; - // TBD add decoder drop event for eth over MPLS cap len issue - dc.discards++; - dc.ethdisc++; - return; - } - - /* lay the ethernet structure over the packet data */ - p->eh = (eth::EtherHdr *) pkt; // FIXTHIS squashes outer eth! - PushLayer(PROTO_ETH, p, pkt, sizeof(*p->eh)); - - DEBUG_WRAP( - DebugMessage(DEBUG_DECODE, "%X %X\n", - *p->eh->ether_src, *p->eh->ether_dst); - ); - - /* grab out the network type */ - switch(ntohs(p->eh->ether_type)) - { - case ETHERNET_TYPE_IP: - DEBUG_WRAP( - DebugMessage(DEBUG_DECODE, - "IP datagram size calculated to be %lu bytes\n", - (unsigned long)(len - ETHERNET_HEADER_LEN)); - ); - - DecodeIP(p->pkt + ETHERNET_HEADER_LEN, - len - ETHERNET_HEADER_LEN, p); - - return; - - case ETHERNET_TYPE_ARP: - case ETHERNET_TYPE_REVARP: - DecodeARP(p->pkt + ETHERNET_HEADER_LEN, - len - ETHERNET_HEADER_LEN, p); - return; - - case ETHERNET_TYPE_IPV6: - DecodeIPV6(p->pkt + ETHERNET_HEADER_LEN, - (len - ETHERNET_HEADER_LEN), p); - return; - - case ETHERNET_TYPE_PPPoE_DISC: - case ETHERNET_TYPE_PPPoE_SESS: - DecodePPPoEPkt(p->pkt + ETHERNET_HEADER_LEN, - (len - ETHERNET_HEADER_LEN), p); - return; - -#ifndef NO_NON_ETHER_DECODER - case ETHERNET_TYPE_IPX: - DecodeIPX(p->pkt + ETHERNET_HEADER_LEN, - (len - ETHERNET_HEADER_LEN), p); - return; -#endif - - case ETHERNET_TYPE_LOOP: - DecodeEthLoopback(p->pkt + ETHERNET_HEADER_LEN, - (len - ETHERNET_HEADER_LEN), p); - return; - - case ETHERNET_TYPE_8021Q: - DecodeVlan(p->pkt + ETHERNET_HEADER_LEN, - len - ETHERNET_HEADER_LEN, p); - return; - - default: - // TBD add decoder drop event for unknown mpls/eth type - dc.other++; - return; - } - - return; -} - diff --git a/src/protocols/CMakeLists.txt b/src/protocols/CMakeLists.txt index 1bbfe46e2..9e32c6167 100644 --- a/src/protocols/CMakeLists.txt +++ b/src/protocols/CMakeLists.txt @@ -14,7 +14,9 @@ add_library (protocols arp.h wlan.h teredo.h + mpls.h ethertypes.h protocol_numbers.h + undefined_protocols.h ) diff --git a/src/protocols/ethertypes.h b/src/protocols/ethertypes.h index 918915c2b..a4afe4a50 100644 --- a/src/protocols/ethertypes.h +++ b/src/protocols/ethertypes.h @@ -25,7 +25,7 @@ /* * this file contained the ethertypes for all of the various protocols. * - * This is ONLY useful when protocols are chained and specificy the next + * This is ONLY used when protocols are chained and specificy the next * protocol by name rather than by an ID. MOST protocols do NOT need to * entered into this file. * @@ -34,7 +34,9 @@ */ -const uint16_t TRANS_ETHER_BRIDGING_ETHERTYPE = 0x6558; -const uint16_t PPP_ETHERTYPE = 0x880B; +const uint16_t ETHERTYPE_TRANS_ETHER_BRIDGING = 0x6558; +const uint16_t ETHERTYPE_IPV4 = 0x0800; +const uint16_t ETHERTYPE_IPV6 = 0x86dd; +const uint16_t ETHERTYPE_PPP = 0x880B; #endif diff --git a/src/protocols/gtp.h b/src/protocols/gtp.h index a9c45123b..bf023c7b7 100644 --- a/src/protocols/gtp.h +++ b/src/protocols/gtp.h @@ -25,8 +25,6 @@ namespace gtp{ namespace detail{ - -const uint32_t GTP_ID = 0x0101; const uint32_t GTP_MIN_LEN = 8; const uint32_t GTP_V0_HEADER_LEN = 20; const uint32_t GTP_V1_HEADER_LEN = 12; @@ -45,11 +43,6 @@ struct GTPHdr }; -inline uint16_t gtp_id() -{ - return detail::GTP_ID; -} - inline uint32_t min_hdr_len() { return detail::GTP_MIN_LEN; diff --git a/src/codecs/tmp/prot_mpls.h b/src/protocols/mpls.h similarity index 81% rename from src/codecs/tmp/prot_mpls.h rename to src/protocols/mpls.h index 8cf9a2ce8..6d0040e1d 100644 --- a/src/codecs/tmp/prot_mpls.h +++ b/src/protocols/mpls.h @@ -19,20 +19,37 @@ */ -#ifndef PROT_MPLS_H -#define PROT_MPLS_H +#ifndef MPLS_H +#define MPLS_H +namespace mpls{ -#define ETHERNET_TYPE_MPLS_UNICAST 0x8847 -#define ETHERNET_TYPE_MPLS_MULTICAST 0x8848 +namespace detail{ +} // namespace detail + + +struct MplsHdr +{ + uint32_t label; + uint8_t exp; + uint8_t bos; + uint8_t ttl; +} ; + + + + + +} // namespace mpls + +typedef mpls::MplsHdr MplsHdr; #define MPLS_PAYLOADTYPE_ETHERNET 1 #define MPLS_PAYLOADTYPE_IPV4 2 #define MPLS_PAYLOADTYPE_IPV6 3 #define MPLS_PAYLOADTYPE_ERROR -1 -void DecodeMPLS(const uint8_t*, const uint32_t, Packet*); - #endif + diff --git a/src/protocols/packet.h b/src/protocols/packet.h index ccaa6bc6e..874778b40 100644 --- a/src/protocols/packet.h +++ b/src/protocols/packet.h @@ -61,7 +61,7 @@ extern "C" { #include "protocols/icmp6.h" #include "protocols/arp.h" #include "protocols/gre.h" - +#include "protocols/mpls.h" /* D E F I N E S ************************************************************/ @@ -625,16 +625,6 @@ typedef struct _PPPoE_Tag /* payload follows */ } PPPoE_Tag; -#define MPLS_HEADER_LEN 4 -#define NUM_RESERVED_LABELS 16 - -typedef struct _MplsHdr -{ - uint32_t label; - uint8_t exp; - uint8_t bos; - uint8_t ttl; -} MplsHdr; #define PGM_NAK_ERR -1 #define PGM_NAK_OK 0 diff --git a/src/protocols/teredo.h b/src/protocols/teredo.h index a5fb3badc..894e67938 100644 --- a/src/protocols/teredo.h +++ b/src/protocols/teredo.h @@ -32,7 +32,6 @@ namespace teredo namespace detail { -const uint16_t TEREDO_ID = 0x0100; const uint32_t TEREDO_PORT = 3544; const uint32_t TEREDO_INDICATOR_ORIGIN = 0x00; const uint32_t TEREDO_INDICATOR_ORIGIN_LEN = 8; @@ -44,10 +43,6 @@ const uint32_t TEREDO_MIN_LEN = 2; } // namespace detail -inline uint16_t teredo_id() -{ - return detail::TEREDO_ID; -} inline bool is_teredo_port(uint16_t port) { diff --git a/src/codecs/tmp/prot_ethovermpls.h b/src/protocols/undefined_protocols.h similarity index 71% rename from src/codecs/tmp/prot_ethovermpls.h rename to src/protocols/undefined_protocols.h index a48178598..1f856e7c9 100644 --- a/src/codecs/tmp/prot_ethovermpls.h +++ b/src/protocols/undefined_protocols.h @@ -19,11 +19,16 @@ */ -#ifndef PROT_ETHOVERMPLS_H -#define PROT_ETHOVERMPLS_H - -void DecodeEthOverMPLS(const uint8_t*, const uint32_t, Packet*); +#ifndef UNDEFINED_PROTOCOLS_H +#define UNDEFINED_PROTOCOLS_H +/* + * PROTOCOL ID'S By Range + * 0 (0x0000) - 255 (0x00FF) --> Ip protocols + * 256 (0x0100) - 1535 (0x05FF) --> random protocols (teredo, gtp) + * 1536 (0x6000) - 65536 (0xFFFF) --> Ethertypes + */ +const uint16_t PROTOCOL_TEREDO = 0x0100; +const uint16_t PROTOCOL_GTP = 0x0101; #endif -