Skip to content

Commit e298163

Browse files
committed
fix: eBPF datadump parser
1 parent 33070c7 commit e298163

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

agent/src/utils/test_utils.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ impl EbpfDataDump {
129129

130130
unsafe fn meta_packet(lines: &str) -> IResult<&str, MetaPacket<'static>> {
131131
use nom::{
132+
branch::alt,
132133
bytes::complete::{is_not, tag, take_until},
133134
character::complete::{char, digit1, hex_digit1, space0, space1},
134135
multi::{count, many0},
135-
sequence::{delimited, pair, preceded, separated_pair, tuple},
136+
sequence::{delimited, pair, preceded, separated_pair, terminated, tuple},
136137
};
137138

138139
let mut data = MaybeUninit::<ebpf::SK_BPF_DATA>::zeroed().assume_init();
@@ -274,8 +275,14 @@ impl EbpfDataDump {
274275
.unwrap();
275276
data.cap_timestamp = parsed.timestamp_nanos_opt().unwrap() as u64;
276277

277-
let raw_data: Vec<&str> =
278-
many0(delimited(space0, hex_digit1, take_until(" ")))(raw_data)?.1;
278+
let raw_data: Vec<&str> = many0(preceded(
279+
space0,
280+
alt((
281+
terminated(hex_digit1, delimited(char('('), is_not(")"), char(')'))),
282+
hex_digit1,
283+
)),
284+
))(raw_data)?
285+
.1;
279286
let raw_data = raw_data
280287
.into_iter()
281288
.map(|b| u8::from_str_radix(b, 16).unwrap())
@@ -370,12 +377,6 @@ pub struct FlowMapTester {
370377
pub packet_sequence_output: Option<Receiver<Box<packet_sequence_block::PacketSequenceBlock>>>,
371378
}
372379

373-
impl Drop for FlowMapTester {
374-
fn drop(&mut self) {
375-
println!("dropping FlowMapTester");
376-
}
377-
}
378-
379380
pub struct FlowMapTesterBuilder {
380381
pub config: FlowConfig,
381382
}

0 commit comments

Comments
 (0)