use both is_ip_literal and IPAddress is_valid checks

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-01-24 18:34:41 -05:00 committed by June
parent 9858b33b37
commit 1536f08d81
2 changed files with 6 additions and 2 deletions

View file

@ -132,7 +132,9 @@ where
)); ));
} }
if destination.is_ip_literal() { // rust's built in <Ipv4Addr> parsing does not consider things like octal addresses valid
// so we should check both just to be safe.
if destination.is_ip_literal() || IPAddress::is_valid(destination.host()) {
info!( info!(
"Destination {} is an IP literal, checking against IP range denylist.", "Destination {} is an IP literal, checking against IP range denylist.",
destination destination

View file

@ -717,7 +717,9 @@ impl Service {
where where
T: Debug, T: Debug,
{ {
if destination.is_ip_literal() { // rust's built in <Ipv4Addr> parsing does not consider things like octal addresses valid
// so we should check both just to be safe.
if destination.is_ip_literal() || IPAddress::is_valid(destination.host()) {
info!( info!(
"Destination {} is an IP literal, checking against IP range denylist.", "Destination {} is an IP literal, checking against IP range denylist.",
destination destination