|
|
|
@ -142,8 +142,8 @@ impl<'a> SNMPState<'a> {
|
|
|
|
tx.info = Some(pdu_info);
|
|
|
|
tx.info = Some(pdu_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn handle_snmp_v12(&mut self, msg: SnmpMessage<'a>, _direction: u8) -> i32 {
|
|
|
|
fn handle_snmp_v12(&mut self, msg: SnmpMessage<'a>, direction: u8) -> i32 {
|
|
|
|
let mut tx = self.new_tx();
|
|
|
|
let mut tx = self.new_tx(direction);
|
|
|
|
// in the message, version is encoded as 0 (version 1) or 1 (version 2)
|
|
|
|
// in the message, version is encoded as 0 (version 1) or 1 (version 2)
|
|
|
|
if self.version != msg.version + 1 {
|
|
|
|
if self.version != msg.version + 1 {
|
|
|
|
SCLogDebug!("SNMP version mismatch: expected {}, received {}", self.version, msg.version+1);
|
|
|
|
SCLogDebug!("SNMP version mismatch: expected {}, received {}", self.version, msg.version+1);
|
|
|
|
@ -155,8 +155,8 @@ impl<'a> SNMPState<'a> {
|
|
|
|
0
|
|
|
|
0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn handle_snmp_v3(&mut self, msg: SnmpV3Message<'a>, _direction: u8) -> i32 {
|
|
|
|
fn handle_snmp_v3(&mut self, msg: SnmpV3Message<'a>, direction: u8) -> i32 {
|
|
|
|
let mut tx = self.new_tx();
|
|
|
|
let mut tx = self.new_tx(direction);
|
|
|
|
if self.version != msg.version {
|
|
|
|
if self.version != msg.version {
|
|
|
|
SCLogDebug!("SNMP version mismatch: expected {}, received {}", self.version, msg.version);
|
|
|
|
SCLogDebug!("SNMP version mismatch: expected {}, received {}", self.version, msg.version);
|
|
|
|
self.set_event_tx(&mut tx, SNMPEvent::VersionMismatch);
|
|
|
|
self.set_event_tx(&mut tx, SNMPEvent::VersionMismatch);
|
|
|
|
@ -209,9 +209,11 @@ impl<'a> SNMPState<'a> {
|
|
|
|
self.transactions.clear();
|
|
|
|
self.transactions.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn new_tx(&mut self) -> SNMPTransaction<'a> {
|
|
|
|
fn new_tx(&mut self, direction: u8) -> SNMPTransaction<'a> {
|
|
|
|
self.tx_id += 1;
|
|
|
|
self.tx_id += 1;
|
|
|
|
SNMPTransaction::new(self.version, self.tx_id)
|
|
|
|
let mut tx = SNMPTransaction::new(self.version, self.tx_id);
|
|
|
|
|
|
|
|
tx.tx_data.set_inspect_direction(direction);
|
|
|
|
|
|
|
|
tx
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn get_tx_by_id(&mut self, tx_id: u64) -> Option<&SNMPTransaction> {
|
|
|
|
fn get_tx_by_id(&mut self, tx_id: u64) -> Option<&SNMPTransaction> {
|
|
|
|
|