diff options
author | Alex Auvolat <alex@adnab.me> | 2023-04-20 14:53:20 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-04-20 14:53:20 +0200 |
commit | f5fc635b75dfa17b83a8db4893a7be206b4f9892 (patch) | |
tree | f206a05b684a6132f9a46afdfc2f8b9df2aae63b | |
parent | d27173a2b7ada8d0df9506ce4beb1ba9dae94950 (diff) | |
download | diplonat-f5fc635b75dfa17b83a8db4893a7be206b4f9892.tar.gz diplonat-f5fc635b75dfa17b83a8db4893a7be206b4f9892.zip |
match numeric protocol valuesstun
-rw-r--r-- | src/fw.rs | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -62,10 +62,12 @@ pub fn get_opened_ports(ipt: &iptables::IPTables) -> Result<messages::PublicExpo let proto = String::from(raw_proto.as_str()); let number = String::from(raw_port.as_str()).parse::<u16>()?; - 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<messages::PublicExpo } } + debug!("{} ports already openned: {:?}", ipt.cmd, ports); + Ok(ports) } |