]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dhcp: Log Vendor Client Identifier (dhcp option 60)
authorYatin Kanetkar <yatin.kanetkar@gmail.com>
Sat, 19 Aug 2023 17:10:33 +0000 (13:10 -0400)
committerVictor Julien <victor@inliniac.net>
Tue, 5 Sep 2023 12:21:32 +0000 (14:21 +0200)
* Log vendor client identifier (dhcp option 60) if extended dhcp
logging is turned on. This required the `vendor_client_identifier` to
be added to the json schema. Validation done using an SV Test
* Added `requested_ip` to the json schema as well, since it was
missed. My SV test failed without it.

Feature #4587

etc/schema.json
rust/src/dhcp/dhcp.rs
rust/src/dhcp/logger.rs

index 1b49cf5af1fc9c71bf18a87ce9ec5981adcbcdd2..efd17092f68c7bf669fbfd1d14c80717f176b358 100644 (file)
                 "renewal_time": {
                     "type": "integer"
                 },
+                "requested_ip":{
+                    "type": "string"
+                },
                 "subnet_mask": {
                     "type": "string"
                 },
                 "type": {
                     "type": "string"
                 },
+                "vendor_class_identifier":{
+                    "type": "string"
+                },
                 "dns_servers": {
                     "type": "array",
                     "minItems": 1,
index 5afa1efb376dac15c926c815235c3e8d926f1aed..b69b675b8ce9dbb6a2c26f3077c2c796a788e4ff 100644 (file)
@@ -42,6 +42,7 @@ pub const DHCP_OPT_TYPE: u8 = 53;
 pub const DHCP_OPT_PARAMETER_LIST: u8 = 55;
 pub const DHCP_OPT_RENEWAL_TIME: u8 = 58;
 pub const DHCP_OPT_REBINDING_TIME: u8 = 59;
+pub const DHCP_OPT_VENDOR_CLASS_ID: u8 = 60;
 pub const DHCP_OPT_CLIENT_ID: u8 = 61;
 pub const DHCP_OPT_END: u8 = 255;
 
index 8423064946cbb92c55e1441e9175a1e117e26988..b29e2158ef950c4e73f469dfebb3e71e7163f751 100644 (file)
@@ -168,6 +168,12 @@ impl DHCPLogger {
                                 self.log_opt_routers(js, option)?;
                             }
                         }
+                        DHCP_OPT_VENDOR_CLASS_ID => {
+                            if self.extended && !option.data.is_empty(){
+                                js.set_string_from_bytes("vendor_class_identifier",
+                                                         &option.data)?;
+                            }
+                        }
                         _ => {}
                     }
                 }