Invert logic for IP version mismatch

This commit is contained in:
Jackson Coxson 2022-06-23 23:10:11 -06:00
parent c647bc9a96
commit 96e18edd19

View file

@ -238,8 +238,8 @@ impl Config {
let endpoint_bind_addr = if let Some(addr) = matches.value_of("endpoint-bind-addr") {
let addr = parse_addr(Some(addr)).with_context(|| "Invalid host address")?;
// Make sure the host address and endpoint address are the same IP version
if addr.ip().is_ipv6() && endpoint_addr.ip().is_ipv6()
|| (addr.ip().is_ipv4() && endpoint_addr.ip().is_ipv4())
if addr.ip().is_ipv6() != endpoint_addr.ip().is_ipv6()
|| (addr.ip().is_ipv4() != endpoint_addr.ip().is_ipv4())
{
return Err(anyhow::anyhow!(
"Host address and endpoint address must be the same IP version"