]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: remove unnecessary nested unsafe
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 17 Jun 2024 13:53:42 +0000 (15:53 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 18 Jun 2024 05:56:33 +0000 (07:56 +0200)
rust/src/dhcp/detect.rs
rust/src/enip/detect.rs
rust/src/snmp/detect.rs
rust/src/websocket/detect.rs

index 73cf92538643f9b1051cb09ee48818dd4b0ff0a9..7c458da4e92689c2969c38ba3e2b154dc6966ace 100644 (file)
@@ -175,15 +175,13 @@ pub unsafe extern "C" fn ScDetectDHCPRegister() {
         Free: Some(dhcp_detect_time_free),
         flags: 0,
     };
-    unsafe {
-        G_DHCP_LEASE_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_DHCP_LEASE_TIME_BUFFER_ID = DetectHelperBufferRegister(
-            b"dhcp.leasetime\0".as_ptr() as *const libc::c_char,
-            ALPROTO_DHCP,
-            true,
-            true,
-        );
-    }
+    G_DHCP_LEASE_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_DHCP_LEASE_TIME_BUFFER_ID = DetectHelperBufferRegister(
+        b"dhcp.leasetime\0".as_ptr() as *const libc::c_char,
+        ALPROTO_DHCP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"dhcp.rebinding_time\0".as_ptr() as *const libc::c_char,
         desc: b"match DHCP rebinding time\0".as_ptr() as *const libc::c_char,
@@ -193,15 +191,13 @@ pub unsafe extern "C" fn ScDetectDHCPRegister() {
         Free: Some(dhcp_detect_time_free),
         flags: 0,
     };
-    unsafe {
-        G_DHCP_REBINDING_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_DHCP_REBINDING_TIME_BUFFER_ID = DetectHelperBufferRegister(
-            b"dhcp.rebinding-time\0".as_ptr() as *const libc::c_char,
-            ALPROTO_DHCP,
-            true,
-            true,
-        );
-    }
+    G_DHCP_REBINDING_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_DHCP_REBINDING_TIME_BUFFER_ID = DetectHelperBufferRegister(
+        b"dhcp.rebinding-time\0".as_ptr() as *const libc::c_char,
+        ALPROTO_DHCP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"dhcp.renewal_time\0".as_ptr() as *const libc::c_char,
         desc: b"match DHCP renewal time\0".as_ptr() as *const libc::c_char,
@@ -211,13 +207,11 @@ pub unsafe extern "C" fn ScDetectDHCPRegister() {
         Free: Some(dhcp_detect_time_free),
         flags: 0,
     };
-    unsafe {
-        G_DHCP_RENEWAL_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_DHCP_RENEWAL_TIME_BUFFER_ID = DetectHelperBufferRegister(
-            b"dhcp.renewal-time\0".as_ptr() as *const libc::c_char,
-            ALPROTO_DHCP,
-            true,
-            true,
-        );
-    }
+    G_DHCP_RENEWAL_TIME_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_DHCP_RENEWAL_TIME_BUFFER_ID = DetectHelperBufferRegister(
+        b"dhcp.renewal-time\0".as_ptr() as *const libc::c_char,
+        ALPROTO_DHCP,
+        true,
+        true,
+    );
 }
index dde0af841f2def65db465a535602115692b2c4c5..46361680a93e9f4dd842234a210a3437937e77d7 100644 (file)
@@ -1343,15 +1343,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(cipservice_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CIPSERVICE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CIPSERVICE_BUFFER_ID = DetectHelperBufferRegister(
-            b"cip\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CIPSERVICE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CIPSERVICE_BUFFER_ID = DetectHelperBufferRegister(
+        b"cip\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.capabilities\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP capabilities\0".as_ptr() as *const libc::c_char,
@@ -1361,15 +1359,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(capabilities_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CAPABILITIES_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CAPABILITIES_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.capabilities\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CAPABILITIES_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CAPABILITIES_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.capabilities\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.cip_attribute\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP cip_attribute\0".as_ptr() as *const libc::c_char,
@@ -1379,15 +1375,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(cip_attribute_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CIP_ATTRIBUTE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CIP_ATTRIBUTE_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.cip_attribute\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CIP_ATTRIBUTE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CIP_ATTRIBUTE_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.cip_attribute\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.cip_class\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP cip_class\0".as_ptr() as *const libc::c_char,
@@ -1397,15 +1391,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(cip_class_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CIP_CLASS_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CIP_CLASS_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.cip_class\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CIP_CLASS_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CIP_CLASS_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.cip_class\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.vendor_id\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP vendor_id\0".as_ptr() as *const libc::c_char,
@@ -1415,15 +1407,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(vendor_id_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_VENDOR_ID_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_VENDOR_ID_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.vendor_id\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_VENDOR_ID_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_VENDOR_ID_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.vendor_id\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.status\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP status\0".as_ptr() as *const libc::c_char,
@@ -1433,15 +1423,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(status_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_STATUS_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.status\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_STATUS_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.status\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.state\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP state\0".as_ptr() as *const libc::c_char,
@@ -1451,15 +1439,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(state_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_STATE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_STATE_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.state\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_STATE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_STATE_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.state\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.serial\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP serial\0".as_ptr() as *const libc::c_char,
@@ -1469,15 +1455,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(serial_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_SERIAL_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_SERIAL_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.serial\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_SERIAL_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_SERIAL_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.serial\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.revision\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP revision\0".as_ptr() as *const libc::c_char,
@@ -1487,15 +1471,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(revision_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_REVISION_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_REVISION_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.revision\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_REVISION_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_REVISION_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.revision\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.protocol_version\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP protocol_version\0".as_ptr() as *const libc::c_char,
@@ -1505,15 +1487,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(protocol_version_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_PROTOCOL_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_PROTOCOL_VERSION_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.protocol_version\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_PROTOCOL_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_PROTOCOL_VERSION_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.protocol_version\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.product_code\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP product_code\0".as_ptr() as *const libc::c_char,
@@ -1523,15 +1503,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(product_code_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_PRODUCT_CODE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_PRODUCT_CODE_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.product_code\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_PRODUCT_CODE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_PRODUCT_CODE_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.product_code\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip_command\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP command\0".as_ptr() as *const libc::c_char,
@@ -1541,15 +1519,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(command_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_COMMAND_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_COMMAND_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.command\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_COMMAND_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_COMMAND_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.command\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.identity_status\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP identity_status\0".as_ptr() as *const libc::c_char,
@@ -1559,15 +1535,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(identity_status_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_IDENTITY_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_IDENTITY_STATUS_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.identity_status\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_IDENTITY_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_IDENTITY_STATUS_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.identity_status\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.device_type\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP device_type\0".as_ptr() as *const libc::c_char,
@@ -1577,15 +1551,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(device_type_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_DEVICE_TYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_DEVICE_TYPE_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.device_type\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_DEVICE_TYPE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_DEVICE_TYPE_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.device_type\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip_command\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP command\0".as_ptr() as *const libc::c_char,
@@ -1595,15 +1567,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(command_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_COMMAND_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_COMMAND_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.command\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_COMMAND_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_COMMAND_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.command\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.cip_status\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP cip_status\0".as_ptr() as *const libc::c_char,
@@ -1613,15 +1583,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(cip_status_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CIP_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CIP_STATUS_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.cip_status\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CIP_STATUS_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CIP_STATUS_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.cip_status\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.cip_instance\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP cip_instance\0".as_ptr() as *const libc::c_char,
@@ -1631,15 +1599,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(cip_instance_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CIP_INSTANCE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CIP_INSTANCE_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.cip_instance\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CIP_INSTANCE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CIP_INSTANCE_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.cip_instance\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.cip_extendedstatus\0".as_ptr() as *const libc::c_char,
         desc: b"rules for detecting EtherNet/IP cip_extendedstatus\0".as_ptr()
@@ -1650,15 +1616,13 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         Free: Some(cip_extendedstatus_free),
         flags: 0,
     };
-    unsafe {
-        G_ENIP_CIP_EXTENDEDSTATUS_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_ENIP_CIP_EXTENDEDSTATUS_BUFFER_ID = DetectHelperBufferRegister(
-            b"enip.cip_extendedstatus\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-        );
-    }
+    G_ENIP_CIP_EXTENDEDSTATUS_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_ENIP_CIP_EXTENDEDSTATUS_BUFFER_ID = DetectHelperBufferRegister(
+        b"enip.cip_extendedstatus\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.product_name\0".as_ptr() as *const libc::c_char,
         desc: b"sticky buffer to match EtherNet/IP product name\0".as_ptr() as *const libc::c_char,
@@ -1668,17 +1632,15 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         AppLayerTxMatch: None,
         Free: None,
     };
-    unsafe {
-        let _g_enip_product_name_kw_id = DetectHelperKeywordRegister(&kw);
-        G_ENIP_PRODUCT_NAME_BUFFER_ID = DetectHelperBufferMpmRegister(
-            b"enip.product_name\0".as_ptr() as *const libc::c_char,
-            b"ENIP product name\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-            product_name_get_data,
-        );
-    }
+    let _g_enip_product_name_kw_id = DetectHelperKeywordRegister(&kw);
+    G_ENIP_PRODUCT_NAME_BUFFER_ID = DetectHelperBufferMpmRegister(
+        b"enip.product_name\0".as_ptr() as *const libc::c_char,
+        b"ENIP product name\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+        product_name_get_data,
+    );
     let kw = SCSigTableElmt {
         name: b"enip.service_name\0".as_ptr() as *const libc::c_char,
         desc: b"sticky buffer to match EtherNet/IP service name\0".as_ptr() as *const libc::c_char,
@@ -1688,17 +1650,15 @@ pub unsafe extern "C" fn ScDetectEnipRegister() {
         AppLayerTxMatch: None,
         Free: None,
     };
-    unsafe {
-        let _g_enip_service_name_kw_id = DetectHelperKeywordRegister(&kw);
-        G_ENIP_SERVICE_NAME_BUFFER_ID = DetectHelperBufferMpmRegister(
-            b"enip.service_name\0".as_ptr() as *const libc::c_char,
-            b"ENIP service name\0".as_ptr() as *const libc::c_char,
-            ALPROTO_ENIP,
-            true,
-            true,
-            service_name_get_data,
-        );
-    }
+    let _g_enip_service_name_kw_id = DetectHelperKeywordRegister(&kw);
+    G_ENIP_SERVICE_NAME_BUFFER_ID = DetectHelperBufferMpmRegister(
+        b"enip.service_name\0".as_ptr() as *const libc::c_char,
+        b"ENIP service name\0".as_ptr() as *const libc::c_char,
+        ALPROTO_ENIP,
+        true,
+        true,
+        service_name_get_data,
+    );
 }
 
 #[cfg(test)]
index 7dee00a707b16640fdc3acdd21a4ad4d30b1cb92..2f9851bbdff7ac63398c782c4b286592343b6824 100644 (file)
@@ -193,15 +193,13 @@ pub unsafe extern "C" fn ScDetectSNMPRegister() {
         Free: Some(snmp_detect_version_free),
         flags: 0,
     };
-    unsafe {
-        G_SNMP_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_SNMP_VERSION_BUFFER_ID = DetectHelperBufferRegister(
-            b"snmp.version\0".as_ptr() as *const libc::c_char,
-            ALPROTO_SNMP,
-            true,
-            true,
-        );
-    }
+    G_SNMP_VERSION_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_SNMP_VERSION_BUFFER_ID = DetectHelperBufferRegister(
+        b"snmp.version\0".as_ptr() as *const libc::c_char,
+        ALPROTO_SNMP,
+        true,
+        true,
+    );
 
     let kw = SCSigTableElmt {
         name: b"snmp.pdu_type\0".as_ptr() as *const libc::c_char,
@@ -212,15 +210,13 @@ pub unsafe extern "C" fn ScDetectSNMPRegister() {
         Free: Some(snmp_detect_pdutype_free),
         flags: 0,
     };
-    unsafe {
-        G_SNMP_PDUTYPE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_SNMP_PDUTYPE_BUFFER_ID = DetectHelperBufferRegister(
-            b"snmp.pdu_type\0".as_ptr() as *const libc::c_char,
-            ALPROTO_SNMP,
-            true,
-            true,
-        );
-    }
+    G_SNMP_PDUTYPE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_SNMP_PDUTYPE_BUFFER_ID = DetectHelperBufferRegister(
+        b"snmp.pdu_type\0".as_ptr() as *const libc::c_char,
+        ALPROTO_SNMP,
+        true,
+        true,
+    );
 
     let kw = SCSigTableElmt {
         name: b"snmp.usm\0".as_ptr() as *const libc::c_char,
@@ -231,17 +227,15 @@ pub unsafe extern "C" fn ScDetectSNMPRegister() {
         AppLayerTxMatch: None,
         Free: None,
     };
-    unsafe {
-        let _g_snmp_usm_kw_id = DetectHelperKeywordRegister(&kw);
-        G_SNMP_USM_BUFFER_ID = DetectHelperBufferMpmRegister(
-            b"snmp.usm\0".as_ptr() as *const libc::c_char,
-            b"SNMP USM\0".as_ptr() as *const libc::c_char,
-            ALPROTO_SNMP,
-            true,
-            true,
-            snmp_detect_usm_get_data,
-        );
-    }
+    let _g_snmp_usm_kw_id = DetectHelperKeywordRegister(&kw);
+    G_SNMP_USM_BUFFER_ID = DetectHelperBufferMpmRegister(
+        b"snmp.usm\0".as_ptr() as *const libc::c_char,
+        b"SNMP USM\0".as_ptr() as *const libc::c_char,
+        ALPROTO_SNMP,
+        true,
+        true,
+        snmp_detect_usm_get_data,
+    );
 
     let kw = SCSigTableElmt {
         name: b"snmp.community\0".as_ptr() as *const libc::c_char,
@@ -253,15 +247,13 @@ pub unsafe extern "C" fn ScDetectSNMPRegister() {
         AppLayerTxMatch: None,
         Free: None,
     };
-    unsafe {
-        let _g_snmp_community_kw_id = DetectHelperKeywordRegister(&kw);
-        G_SNMP_COMMUNITY_BUFFER_ID = DetectHelperBufferMpmRegister(
-            b"snmp.community\0".as_ptr() as *const libc::c_char,
-            b"SNMP Community identifier\0".as_ptr() as *const libc::c_char,
-            ALPROTO_SNMP,
-            true,
-            true,
-            snmp_detect_community_get_data,
-        );
-    }
+    let _g_snmp_community_kw_id = DetectHelperKeywordRegister(&kw);
+    G_SNMP_COMMUNITY_BUFFER_ID = DetectHelperBufferMpmRegister(
+        b"snmp.community\0".as_ptr() as *const libc::c_char,
+        b"SNMP Community identifier\0".as_ptr() as *const libc::c_char,
+        ALPROTO_SNMP,
+        true,
+        true,
+        snmp_detect_community_get_data,
+    );
 }
index b4457125a633b7247c717fc58b30f170784b1dc2..f7f3cc9d46de5391c3efb8f5327d5b6c22db8f65 100644 (file)
@@ -287,15 +287,13 @@ pub unsafe extern "C" fn ScDetectWebsocketRegister() {
         Free: Some(websocket_detect_opcode_free),
         flags: 0,
     };
-    unsafe {
-        G_WEBSOCKET_OPCODE_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_WEBSOCKET_OPCODE_BUFFER_ID = DetectHelperBufferRegister(
-            b"websocket.opcode\0".as_ptr() as *const libc::c_char,
-            ALPROTO_WEBSOCKET,
-            true,
-            true,
-        );
-    }
+    G_WEBSOCKET_OPCODE_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_WEBSOCKET_OPCODE_BUFFER_ID = DetectHelperBufferRegister(
+        b"websocket.opcode\0".as_ptr() as *const libc::c_char,
+        ALPROTO_WEBSOCKET,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"websocket.mask\0".as_ptr() as *const libc::c_char,
         desc: b"match WebSocket mask\0".as_ptr() as *const libc::c_char,
@@ -305,15 +303,13 @@ pub unsafe extern "C" fn ScDetectWebsocketRegister() {
         Free: Some(websocket_detect_mask_free),
         flags: 0,
     };
-    unsafe {
-        G_WEBSOCKET_MASK_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_WEBSOCKET_MASK_BUFFER_ID = DetectHelperBufferRegister(
-            b"websocket.mask\0".as_ptr() as *const libc::c_char,
-            ALPROTO_WEBSOCKET,
-            true,
-            true,
-        );
-    }
+    G_WEBSOCKET_MASK_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_WEBSOCKET_MASK_BUFFER_ID = DetectHelperBufferRegister(
+        b"websocket.mask\0".as_ptr() as *const libc::c_char,
+        ALPROTO_WEBSOCKET,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"websocket.flags\0".as_ptr() as *const libc::c_char,
         desc: b"match WebSocket flags\0".as_ptr() as *const libc::c_char,
@@ -323,15 +319,13 @@ pub unsafe extern "C" fn ScDetectWebsocketRegister() {
         Free: Some(websocket_detect_flags_free),
         flags: 0,
     };
-    unsafe {
-        G_WEBSOCKET_FLAGS_KW_ID = DetectHelperKeywordRegister(&kw);
-        G_WEBSOCKET_FLAGS_BUFFER_ID = DetectHelperBufferRegister(
-            b"websocket.flags\0".as_ptr() as *const libc::c_char,
-            ALPROTO_WEBSOCKET,
-            true,
-            true,
-        );
-    }
+    G_WEBSOCKET_FLAGS_KW_ID = DetectHelperKeywordRegister(&kw);
+    G_WEBSOCKET_FLAGS_BUFFER_ID = DetectHelperBufferRegister(
+        b"websocket.flags\0".as_ptr() as *const libc::c_char,
+        ALPROTO_WEBSOCKET,
+        true,
+        true,
+    );
     let kw = SCSigTableElmt {
         name: b"websocket.payload\0".as_ptr() as *const libc::c_char,
         desc: b"match WebSocket payload\0".as_ptr() as *const libc::c_char,
@@ -341,15 +335,13 @@ pub unsafe extern "C" fn ScDetectWebsocketRegister() {
         AppLayerTxMatch: None,
         Free: None,
     };
-    unsafe {
-        let _g_ws_payload_kw_id = DetectHelperKeywordRegister(&kw);
-        G_WEBSOCKET_PAYLOAD_BUFFER_ID = DetectHelperBufferMpmRegister(
-            b"websocket.payload\0".as_ptr() as *const libc::c_char,
-            b"WebSocket payload\0".as_ptr() as *const libc::c_char,
-            ALPROTO_WEBSOCKET,
-            true,
-            true,
-            websocket_detect_payload_get_data,
-        );
-    }
+    let _g_ws_payload_kw_id = DetectHelperKeywordRegister(&kw);
+    G_WEBSOCKET_PAYLOAD_BUFFER_ID = DetectHelperBufferMpmRegister(
+        b"websocket.payload\0".as_ptr() as *const libc::c_char,
+        b"WebSocket payload\0".as_ptr() as *const libc::c_char,
+        ALPROTO_WEBSOCKET,
+        true,
+        true,
+        websocket_detect_payload_get_data,
+    );
 }