From b67ff4badf02ee72e40ec193c9da4d99207fef7f Mon Sep 17 00:00:00 2001 From: Yatin Kanetkar Date: Sat, 19 Aug 2023 13:10:33 -0400 Subject: [PATCH] dhcp: Log Vendor Client Identifier (dhcp option 60) * 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 | 6 ++++++ rust/src/dhcp/dhcp.rs | 1 + rust/src/dhcp/logger.rs | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/etc/schema.json b/etc/schema.json index 1b49cf5af1..efd17092f6 100644 --- a/etc/schema.json +++ b/etc/schema.json @@ -560,12 +560,18 @@ "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, diff --git a/rust/src/dhcp/dhcp.rs b/rust/src/dhcp/dhcp.rs index 5afa1efb37..b69b675b8c 100644 --- a/rust/src/dhcp/dhcp.rs +++ b/rust/src/dhcp/dhcp.rs @@ -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; diff --git a/rust/src/dhcp/logger.rs b/rust/src/dhcp/logger.rs index 8423064946..b29e2158ef 100644 --- a/rust/src/dhcp/logger.rs +++ b/rust/src/dhcp/logger.rs @@ -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)?; + } + } _ => {} } } -- 2.47.2