Skip to content

Commit

Permalink
fix: Invalid type in config cause parse failure
Browse files Browse the repository at this point in the history
  • Loading branch information
rvql committed Nov 1, 2024
1 parent dbe93b7 commit 52ba9b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions agent/src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2177,8 +2177,8 @@ impl Default for Socket {
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct FlowLogFilters {
pub l4_capture_network_types: Vec<u16>,
pub l7_capture_network_types: Vec<u16>,
pub l4_capture_network_types: Vec<i16>,
pub l7_capture_network_types: Vec<i16>,
pub l4_ignored_observation_points: Vec<u16>,
pub l7_ignored_observation_points: Vec<u16>,
}
Expand Down Expand Up @@ -2886,12 +2886,12 @@ impl From<&RuntimeConfig> for UserConfig {
l4_capture_network_types: rc
.l4_log_store_tap_types
.iter()
.map(|t| *t as u16)
.map(|t| *t as i16)
.collect(),
l7_capture_network_types: rc
.l7_log_store_tap_types
.iter()
.map(|t| *t as u16)
.map(|t| *t as i16)
.collect(),
l4_ignored_observation_points: rc
.l4_log_ignore_tap_sides
Expand Down
2 changes: 1 addition & 1 deletion agent/src/config/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ impl TryFrom<(Config, UserConfig, DynamicConfig)> for ModuleConfig {
.l7_capture_network_types
.iter()
{
if t >= u16::from(CaptureNetworkType::Max) {
if t >= u16::from(CaptureNetworkType::Max) as i16 {
warn!("invalid tap type: {}", t);
} else {
tap_types[t as usize] = true;
Expand Down

0 comments on commit 52ba9b8

Please sign in to comment.