From f5fc635b75dfa17b83a8db4893a7be206b4f9892 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 20 Apr 2023 14:53:20 +0200 Subject: match numeric protocol values --- src/fw.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fw.rs b/src/fw.rs index abb6e20..a3e6dec 100644 --- a/src/fw.rs +++ b/src/fw.rs @@ -62,10 +62,12 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result()?; - if proto == "tcp" { + if proto == "tcp" || proto == "6" { ports.tcp_ports.insert(number); - } else { + } else if proto == "udp" || proto == "17" { ports.udp_ports.insert(number); + } else { + error!("Unexpected protocol in iptables rule: {}", proto); } } else { error!("Unexpected rule found in DIPLONAT chain") @@ -77,6 +79,8 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result