]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
proto/detect: remove probing parser offset argument
authorVictor Julien <victor@inliniac.net>
Tue, 31 Jul 2018 07:34:29 +0000 (09:34 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 2 Aug 2018 09:21:32 +0000 (11:21 +0200)
Remove offset argument as it was unused.

21 files changed:
rust/src/dhcp/dhcp.rs
rust/src/ikev2/ikev2.rs
rust/src/krb/krb5.rs
rust/src/ntp/ntp.rs
rust/src/parser.rs
src/app-layer-detect-proto.c
src/app-layer-detect-proto.h
src/app-layer-dnp3.c
src/app-layer-dns-tcp-rust.c
src/app-layer-dns-tcp.c
src/app-layer-dns-udp-rust.c
src/app-layer-dns-udp.c
src/app-layer-enip.c
src/app-layer-modbus.c
src/app-layer-nfs-tcp.c
src/app-layer-nfs-udp.c
src/app-layer-smb-tcp-rust.c
src/app-layer-smb.c
src/app-layer-ssl.c
src/app-layer-template.c
src/app-layer-tftp.c

index 8bfb3bd36714cf04e4c474a5db379990d2a4b024..835af50f7f2cc018cfeed0c3b6ec7cb7a8d19766 100644 (file)
@@ -201,8 +201,7 @@ impl DHCPState {
 #[no_mangle]
 pub extern "C" fn rs_dhcp_probing_parser(_flow: *const Flow,
                                          input: *const libc::uint8_t,
-                                         input_len: u32,
-                                         _offset: *const u32) -> AppProto {
+                                         input_len: u32) -> AppProto {
     if input_len < DHCP_MIN_FRAME_LEN {
         return ALPROTO_UNKNOWN;
     }
index 908ab57e765171965574bfceb756af15775f6724..e41eeb51debdbfa0bfd470c420a4190317874e18 100644 (file)
@@ -610,7 +610,7 @@ pub extern "C" fn rs_ikev2_state_get_event_info(event_name: *const libc::c_char,
 static mut ALPROTO_IKEV2 : AppProto = ALPROTO_UNKNOWN;
 
 #[no_mangle]
-pub extern "C" fn rs_ikev2_probing_parser(_flow: *const Flow, input:*const libc::uint8_t, input_len: u32, _offset: *const u32) -> AppProto {
+pub extern "C" fn rs_ikev2_probing_parser(_flow: *const Flow, input:*const libc::uint8_t, input_len: u32) -> AppProto {
     let slice = build_slice!(input,input_len as usize);
     let alproto = unsafe{ ALPROTO_IKEV2 };
     match parse_ikev2_header(slice) {
index 846a5505c06d10b34c88128f7c698633ed61edac..4116478137b54c8e3d337e5633418ab2f826c42b 100644 (file)
@@ -404,7 +404,7 @@ pub extern "C" fn rs_krb5_state_get_event_info(event_name: *const libc::c_char,
 static mut ALPROTO_KRB5 : AppProto = ALPROTO_UNKNOWN;
 
 #[no_mangle]
-pub extern "C" fn rs_krb5_probing_parser(_flow: *const Flow, input:*const libc::uint8_t, input_len: u32, _offset: *const u32) -> AppProto {
+pub extern "C" fn rs_krb5_probing_parser(_flow: *const Flow, input:*const libc::uint8_t, input_len: u32) -> AppProto {
     let slice = build_slice!(input,input_len as usize);
     let alproto = unsafe{ ALPROTO_KRB5 };
     if slice.len() <= 10 { return unsafe{ALPROTO_FAILED}; }
@@ -438,13 +438,13 @@ pub extern "C" fn rs_krb5_probing_parser(_flow: *const Flow, input:*const libc::
 }
 
 #[no_mangle]
-pub extern "C" fn rs_krb5_probing_parser_tcp(_flow: *const Flow, input:*const libc::uint8_t, input_len: u32, _offset: *const u32) -> AppProto {
+pub extern "C" fn rs_krb5_probing_parser_tcp(_flow: *const Flow, input:*const libc::uint8_t, input_len: u32) -> AppProto {
     let slice = build_slice!(input,input_len as usize);
     if slice.len() <= 14 { return unsafe{ALPROTO_FAILED}; }
     match be_u32(slice) {
         IResult::Done(rem, record_mark) => {
             if record_mark != rem.len() as u32 { return unsafe{ALPROTO_FAILED}; }
-            return rs_krb5_probing_parser(_flow, rem.as_ptr(), rem.len() as u32, _offset);
+            return rs_krb5_probing_parser(_flow, rem.as_ptr(), rem.len() as u32);
         },
         IResult::Incomplete(_) => {
             return ALPROTO_UNKNOWN;
index ee6b4a02fb76d3bb64b5384a7881cb1492129266..c3d1b2247cbd27771577f3601411d392362d9ab7 100644 (file)
@@ -343,7 +343,7 @@ pub extern "C" fn rs_ntp_state_get_event_info(event_name: *const libc::c_char,
 static mut ALPROTO_NTP : AppProto = ALPROTO_UNKNOWN;
 
 #[no_mangle]
-pub extern "C" fn ntp_probing_parser(_flow: *const Flow, input:*const u8, input_len: u32, _offset: *const u32) -> AppProto {
+pub extern "C" fn ntp_probing_parser(_flow: *const Flow, input:*const u8, input_len: u32) -> AppProto {
     let slice: &[u8] = unsafe { std::slice::from_raw_parts(input as *mut u8, input_len as usize) };
     let alproto = unsafe{ ALPROTO_NTP };
     match parse_ntp(slice) {
index dce39f827cb06248353d6d3996f1f8fd82b6d226..d7ae41946ce2240f80c692a718d5a3c86d22d8ca 100644 (file)
@@ -125,7 +125,7 @@ pub type ParseFn      = extern "C" fn (flow: *const Flow,
                                        input_len: u32,
                                        data: *const c_void,
                                        flags: u8) -> i8;
-pub type ProbeFn      = extern "C" fn (flow: *const Flow,input:*const u8, input_len: u32, offset: *const u32) -> AppProto;
+pub type ProbeFn      = extern "C" fn (flow: *const Flow,input:*const u8, input_len: u32) -> AppProto;
 pub type StateAllocFn = extern "C" fn () -> *mut c_void;
 pub type StateFreeFn  = extern "C" fn (*mut c_void);
 pub type StateTxFreeFn  = extern "C" fn (*mut c_void, u64);
index 04144981d06ae3018f1f388453986bd29097e000..3a976c63fcb3304acabd96d6588c03c7c7049fc4 100644 (file)
@@ -420,9 +420,9 @@ static AppProto AppLayerProtoDetectPPGetProto(Flow *f,
         }
 
         if (direction & STREAM_TOSERVER && pe->ProbingParserTs != NULL) {
-            alproto = pe->ProbingParserTs(f, buf, buflen, NULL);
+            alproto = pe->ProbingParserTs(f, buf, buflen);
         } else if (pe->ProbingParserTc != NULL) {
-            alproto = pe->ProbingParserTc(f, buf, buflen, NULL);
+            alproto = pe->ProbingParserTc(f, buf, buflen);
         }
         if (alproto != ALPROTO_UNKNOWN && alproto != ALPROTO_FAILED)
             goto end;
@@ -441,9 +441,9 @@ static AppProto AppLayerProtoDetectPPGetProto(Flow *f,
         }
 
         if (direction & STREAM_TOSERVER && pe->ProbingParserTs != NULL) {
-            alproto = pe->ProbingParserTs(f, buf, buflen, NULL);
+            alproto = pe->ProbingParserTs(f, buf, buflen);
         } else if (pe->ProbingParserTc != NULL) {
-            alproto = pe->ProbingParserTc(f, buf, buflen, NULL);
+            alproto = pe->ProbingParserTc(f, buf, buflen);
         }
         if (alproto != ALPROTO_UNKNOWN && alproto != ALPROTO_FAILED)
             goto end;
@@ -3105,8 +3105,7 @@ static int AppLayerProtoDetectPPTestData(AppLayerProtoDetectProbingParser *pp,
 
 static uint16_t ProbingParserDummyForTesting(Flow *f,
                                              uint8_t *input,
-                                             uint32_t input_len,
-                                             uint32_t *offset)
+                                             uint32_t input_len)
 {
     return 0;
 }
index 89e430f8ce037badeec7b00baa8573d3070e995b..0f0e3a97d539f375d605a498c5180c059f070fae 100644 (file)
@@ -28,8 +28,7 @@
 typedef struct AppLayerProtoDetectThreadCtx_ AppLayerProtoDetectThreadCtx;
 
 typedef AppProto (*ProbingParserFPtr)(Flow *f,
-                                      uint8_t *input, uint32_t input_len,
-                                      uint32_t *offset);
+                                      uint8_t *input, uint32_t input_len);
 
 /***** Protocol Retrieval *****/
 
index fe12d77964fcdd0b57f05b5e874f846e4d001b23..61945a4046267edc16033d2a688c4e5ec941c01b 100644 (file)
@@ -264,8 +264,7 @@ static int DNP3ContainsBanner(const uint8_t *input, uint32_t len)
 /**
  * \brief DNP3 probing parser.
  */
-static uint16_t DNP3ProbingParser(Flow *f, uint8_t *input, uint32_t len,
-    uint32_t *offset)
+static uint16_t DNP3ProbingParser(Flow *f, uint8_t *input, uint32_t len)
 {
     DNP3LinkHeader *hdr = (DNP3LinkHeader *)input;
 
@@ -2044,25 +2043,25 @@ static int DNP3ProbingParserTest(void)
     };
 
     /* Valid frame. */
-    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(pkt), NULL) != ALPROTO_DNP3);
+    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(pkt)) != ALPROTO_DNP3);
 
     /* Send too little bytes. */
-    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(DNP3LinkHeader) - 1, NULL) != ALPROTO_UNKNOWN);
+    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(DNP3LinkHeader) - 1) != ALPROTO_UNKNOWN);
 
     /* Bad start bytes. */
     pkt[0] = 0x06;
-    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(pkt), NULL) != ALPROTO_FAILED);
+    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(pkt)) != ALPROTO_FAILED);
 
     /* Restore start byte. */
     pkt[0] = 0x05;
 
     /* Set the length to a value less than the minimum length of 5. */
     pkt[2] = 0x03;
-    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(pkt), NULL) != ALPROTO_FAILED);
+    FAIL_IF(DNP3ProbingParser(NULL, pkt, sizeof(pkt)) != ALPROTO_FAILED);
 
     /* Send a banner. */
     char mybanner[] = "Welcome to DNP3 SCADA.";
-    FAIL_IF(DNP3ProbingParser(NULL, (uint8_t *)mybanner, sizeof(mybanner), NULL) != ALPROTO_DNP3);
+    FAIL_IF(DNP3ProbingParser(NULL, (uint8_t *)mybanner, sizeof(mybanner)) != ALPROTO_DNP3);
 
     PASS;
 }
index 7739cde506334297bebd20fae73e318c6b924fbd..1ecb34a04b32f8dc8103ef1ad8d9b6de16ed0f6b 100644 (file)
@@ -52,8 +52,7 @@ static int RustDNSTCPParseResponse(Flow *f, void *state,
             local_data);
 }
 
-static uint16_t RustDNSTCPProbe(Flow *f, uint8_t *input, uint32_t len,
-                                uint32_t *offset)
+static uint16_t RustDNSTCPProbe(Flow *f, uint8_t *input, uint32_t len)
 {
     SCLogDebug("RustDNSTCPProbe");
     if (len == 0 || len < sizeof(DNSHeader)) {
index 4945123e685a9c192ffae6b15df41b0f6d344fbf..8a27985d396d68ec6266fc384b09933b1dba993a 100644 (file)
@@ -62,8 +62,7 @@ struct DNSTcpHeader_ {
 } __attribute__((__packed__));
 typedef struct DNSTcpHeader_ DNSTcpHeader;
 
-static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
-        uint32_t *offset);
+static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen);
 
 /** \internal
  *  \param input_len at least enough for the DNSTcpHeader
@@ -317,7 +316,7 @@ static int DNSTCPRequestParse(Flow *f, void *dstate,
 
     /* Clear gap state. */
     if (dns_state->gap_ts) {
-        if (DNSTcpProbingParser(f, input, input_len, NULL) == ALPROTO_DNS) {
+        if (DNSTcpProbingParser(f, input, input_len) == ALPROTO_DNS) {
             SCLogDebug("New data probed as DNS, clearing gap state.");
             BufferReset(dns_state);
             dns_state->gap_ts = 0;
@@ -557,7 +556,7 @@ static int DNSTCPResponseParse(Flow *f, void *dstate,
 
     /* Clear gap state. */
     if (dns_state->gap_tc) {
-        if (DNSTcpProbingParser(f, input, input_len, NULL) == ALPROTO_DNS) {
+        if (DNSTcpProbingParser(f, input, input_len) == ALPROTO_DNS) {
             SCLogDebug("New data probed as DNS, clearing gap state.");
             BufferReset(dns_state);
             dns_state->gap_tc = 0;
@@ -639,8 +638,7 @@ bad_data:
     SCReturnInt(-1);
 }
 
-static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
-                                    uint32_t *offset)
+static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen)
 {
     if (ilen == 0 || ilen < sizeof(DNSTcpHeader)) {
         SCLogDebug("ilen too small, hoped for at least %"PRIuMAX, (uintmax_t)sizeof(DNSTcpHeader));
@@ -680,8 +678,7 @@ static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
  * This is a minimal parser that just checks that the input contains enough
  * data for a TCP DNS response.
  */
-static uint16_t DNSTcpProbeResponse(Flow *f, uint8_t *input, uint32_t len,
-    uint32_t *offset)
+static uint16_t DNSTcpProbeResponse(Flow *f, uint8_t *input, uint32_t len)
 {
     if (len == 0 || len < sizeof(DNSTcpHeader)) {
         return ALPROTO_UNKNOWN;
index 8c3388e1cd361288d7d39f4eaaa311b1eda3dea9..0411b9febbcd8a7091b294df91dfd54a237d295a 100644 (file)
@@ -50,8 +50,7 @@ static int RustDNSUDPParseResponse(Flow *f, void *state,
             local_data);
 }
 
-static uint16_t DNSUDPProbe(Flow *f, uint8_t *input, uint32_t len,
-                            uint32_t *offset)
+static uint16_t DNSUDPProbe(Flow *f, uint8_t *input, uint32_t len)
 {
     if (len == 0 || len < sizeof(DNSHeader)) {
         return ALPROTO_UNKNOWN;
index 44a2fceb85de8dcd473844d6fb32144b9443c80a..24d68875eb718783c0ac3839df6209ce73206d79 100644 (file)
@@ -330,8 +330,7 @@ insufficient_data:
     SCReturnInt(-1);
 }
 
-static uint16_t DNSUdpProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
-                                    uint32_t *offset)
+static uint16_t DNSUdpProbingParser(Flow *f, uint8_t *input, uint32_t ilen)
 {
     if (ilen == 0 || ilen < sizeof(DNSHeader)) {
         SCLogDebug("ilen too small, hoped for at least %"PRIuMAX, (uintmax_t)sizeof(DNSHeader));
index c35dbf764cc0ee86fec4c2521136a187526d01a9..743a84b26289a07c5bdd7d7b3af1423ca9c560de 100644 (file)
@@ -359,8 +359,7 @@ static int ENIPParse(Flow *f, void *state, AppLayerParserState *pstate,
 
 
 
-static uint16_t ENIPProbingParser(Flow *f, uint8_t *input, uint32_t input_len,
-        uint32_t *offset)
+static uint16_t ENIPProbingParser(Flow *f, uint8_t *input, uint32_t input_len)
 {
     // SCLogDebug("ENIPProbingParser %d", input_len);
     if (input_len < sizeof(ENIPEncapHdr))
index e96a9c60c15a8372c50911dc134521dde352ee62..c945b4c579d9a5d200a0b03112ba046723665483 100644 (file)
@@ -1428,8 +1428,7 @@ static void ModbusStateFree(void *state)
 
 static uint16_t ModbusProbingParser(Flow *f,
                                     uint8_t     *input,
-                                    uint32_t    input_len,
-                                    uint32_t    *offset)
+                                    uint32_t    input_len)
 {
     ModbusHeader *header = (ModbusHeader *) input;
 
index 5e22fdd53440030fb13e9daff2fd78160371d0a4..abd816b3eae9af0b368288af78a30ea4b148f137 100644 (file)
@@ -112,8 +112,7 @@ static AppLayerDecoderEvents *NFSTCPGetEvents(void *state, uint64_t id)
  * \retval ALPROTO_NFS if it looks like echo, otherwise
  *     ALPROTO_UNKNOWN.
  */
-static AppProto NFSTCPProbingParserTS(Flow *f, uint8_t *input, uint32_t input_len,
-    uint32_t *offset)
+static AppProto NFSTCPProbingParserTS(Flow *f, uint8_t *input, uint32_t input_len)
 {
     if (input_len < NFSTCP_MIN_FRAME_LEN) {
         return ALPROTO_UNKNOWN;
@@ -130,8 +129,7 @@ static AppProto NFSTCPProbingParserTS(Flow *f, uint8_t *input, uint32_t input_le
     return ALPROTO_UNKNOWN;
 }
 
-static AppProto NFSTCPProbingParserTC(Flow *f, uint8_t *input, uint32_t input_len,
-    uint32_t *offset)
+static AppProto NFSTCPProbingParserTC(Flow *f, uint8_t *input, uint32_t input_len)
 {
     if (input_len < NFSTCP_MIN_FRAME_LEN) {
         return ALPROTO_UNKNOWN;
index 42378b05a8a4939f7c29db81bb68d3c7bd010d90..50cce89790483c3f0581541fb3ae9bd095aceb3d 100644 (file)
@@ -109,8 +109,7 @@ static AppLayerDecoderEvents *NFSGetEvents(void *state, uint64_t id)
  * \retval ALPROTO_NFS if it looks like echo, otherwise
  *     ALPROTO_UNKNOWN.
  */
-static AppProto NFSProbingParserTS(Flow *f, uint8_t *input, uint32_t input_len,
-    uint32_t *offset)
+static AppProto NFSProbingParserTS(Flow *f, uint8_t *input, uint32_t input_len)
 {
     SCLogDebug("probing");
     if (input_len < NFS_MIN_FRAME_LEN) {
@@ -131,8 +130,7 @@ static AppProto NFSProbingParserTS(Flow *f, uint8_t *input, uint32_t input_len,
     return ALPROTO_UNKNOWN;
 }
 
-static AppProto NFSProbingParserTC(Flow *f, uint8_t *input, uint32_t input_len,
-    uint32_t *offset)
+static AppProto NFSProbingParserTC(Flow *f, uint8_t *input, uint32_t input_len)
 {
     SCLogDebug("probing");
     if (input_len < NFS_MIN_FRAME_LEN) {
index 634e90dc2abe4fb41181bb00467c25d0e1b4310c..a12307c1bf9829fb87be4075f0e8201df47d5d53 100644 (file)
@@ -78,7 +78,7 @@ static int RustSMBTCPParseResponse(Flow *f, void *state,
 }
 
 static uint16_t RustSMBTCPProbe(Flow *f,
-        uint8_t *input, uint32_t len, uint32_t *offset)
+        uint8_t *input, uint32_t len)
 {
     SCLogDebug("RustSMBTCPProbe");
 
index d036481eb20e35c398f8ff6c22dbcba8a8aab778..1cb07b4e83e23d7d314b4afc2cc0925c8540d0e0 100644 (file)
@@ -1510,8 +1510,7 @@ static int SMBGetAlstateProgress(void *tx, uint8_t direction)
 
 #define SMB_PROBING_PARSER_MIN_DEPTH 8
 
-static uint16_t SMBProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
-                                 uint32_t *offset)
+static uint16_t SMBProbingParser(Flow *f, uint8_t *input, uint32_t ilen)
 {
     int32_t len;
     int32_t input_len = ilen;
index 5e4333e19f09de76905793c85cd09eb63e454208..6eadc42a434b69088e8fd415259c6861f5cc18b2 100644 (file)
@@ -2332,8 +2332,7 @@ static void SSLStateTransactionFree(void *state, uint64_t tx_id)
     /* do nothing */
 }
 
-static uint16_t SSLProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
-                                 uint32_t *offset)
+static uint16_t SSLProbingParser(Flow *f, uint8_t *input, uint32_t ilen)
 {
     /* probably a rst/fin sending an eof */
     if (ilen == 0)
index 26885163c7e30a6411840e38d8bf4190dd593ebb..d66fab71890cd66e1c3a394e5743b03be37bea47 100644 (file)
@@ -195,8 +195,7 @@ static AppLayerDecoderEvents *TemplateGetEvents(void *state, uint64_t tx_id)
  * \retval ALPROTO_TEMPLATE if it looks like echo, otherwise
  *     ALPROTO_UNKNOWN.
  */
-static AppProto TemplateProbingParser(Flow *f, uint8_t *input, uint32_t input_len,
-    uint32_t *offset)
+static AppProto TemplateProbingParser(Flow *f, uint8_t *input, uint32_t input_len)
 {
     /* Very simple test - if there is input, this is echo. */
     if (input_len >= TEMPLATE_MIN_FRAME_LEN) {
index b2a3a1717263c0669a96b6ce1dd9bb65648c361b..733baadbed978bf975b6a2edac910294c3cdf7ba 100644 (file)
@@ -112,8 +112,7 @@ static AppLayerDecoderEvents *TFTPGetEvents(void *state, uint64_t tx_id)
  * \retval ALPROTO_TFTP if it looks like echo, otherwise
  *     ALPROTO_UNKNOWN.
  */
-static AppProto TFTPProbingParser(Flow *f, uint8_t *input, uint32_t input_len,
-    uint32_t *offset)
+static AppProto TFTPProbingParser(Flow *f, uint8_t *input, uint32_t input_len)
 {
     /* Very simple test - if there is input, this is tftp.
      * Also check if it's starting by a zero */