forked from Deuxfleurs/diplonat
match numeric protocol values
This commit is contained in:
parent
d27173a2b7
commit
f5fc635b75
1 changed files with 6 additions and 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 proto = String::from(raw_proto.as_str());
|
||||||
let number = String::from(raw_port.as_str()).parse::<u16>()?;
|
let number = String::from(raw_port.as_str()).parse::<u16>()?;
|
||||||
|
|
||||||
if proto == "tcp" {
|
if proto == "tcp" || proto == "6" {
|
||||||
ports.tcp_ports.insert(number);
|
ports.tcp_ports.insert(number);
|
||||||
} else {
|
} else if proto == "udp" || proto == "17" {
|
||||||
ports.udp_ports.insert(number);
|
ports.udp_ports.insert(number);
|
||||||
|
} else {
|
||||||
|
error!("Unexpected protocol in iptables rule: {}", proto);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error!("Unexpected rule found in DIPLONAT chain")
|
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)
|
Ok(ports)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue