Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindgen cli/v6 #248

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dhcp: use ALPROTO_DHCP from bindgen
jasonish committed Jan 22, 2025
commit ac3eb77c19da7f0c344fec1802c9adb510eee236
8 changes: 4 additions & 4 deletions rust/src/dhcp/dhcp.rs
Original file line number Diff line number Diff line change
@@ -19,10 +19,11 @@ use crate::applayer::{self, *};
use crate::core::{ALPROTO_UNKNOWN, AppProto, IPPROTO_UDP};
use crate::dhcp::parser::*;
use crate::flow::Flow;
use crate::sys::AppProtoEnum;
use std;
use std::ffi::CString;

pub(super) static mut ALPROTO_DHCP: AppProto = ALPROTO_UNKNOWN;
pub(super) static ALPROTO_DHCP: AppProto = AppProtoEnum::ALPROTO_DHCP as AppProto;

static DHCP_MIN_FRAME_LEN: u32 = 232;

@@ -305,10 +306,9 @@ pub unsafe extern "C" fn rs_dhcp_register_parser() {
let ip_proto_str = CString::new("udp").unwrap();

if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
let alproto = AppLayerRegisterProtocolDetection(&parser, 1);
ALPROTO_DHCP = alproto;
AppLayerRegisterProtocolDetection(&parser, 1);
if AppLayerParserConfParserEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
let _ = AppLayerRegisterParser(&parser, alproto);
let _ = AppLayerRegisterParser(&parser, ALPROTO_DHCP);
}
} else {
SCLogDebug!("Protocol detector and parser disabled for DHCP.");