From 6bb35dd6a6454258f50582baf678770bc8d26044 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 24 Aug 2023 17:17:48 -0400 Subject: [PATCH] skip publishing relay for fullconenat --- .../network_manager/types/dial_info_class.rs | 4 ++-- .../src/routing_table/routing_domains.rs | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/veilid-core/src/network_manager/types/dial_info_class.rs b/veilid-core/src/network_manager/types/dial_info_class.rs index 3348fd1b..f0656733 100644 --- a/veilid-core/src/network_manager/types/dial_info_class.rs +++ b/veilid-core/src/network_manager/types/dial_info_class.rs @@ -5,8 +5,8 @@ use super::*; pub enum DialInfoClass { Direct = 0, // D = Directly reachable with public IP and no firewall, with statically configured port Mapped = 1, // M = Directly reachable with via portmap behind any NAT or firewalled with dynamically negotiated port - FullConeNAT = 2, // F = Directly reachable device without portmap behind full-cone NAT - Blocked = 3, // B = Inbound blocked at firewall but may hole punch with public address + FullConeNAT = 2, // F = Directly reachable device without portmap behind full-cone NAT (or manually mapped firewall port with no configuration change) + Blocked = 3, // B = Inbound blocked at firewall but may hole punch with public address AddressRestrictedNAT = 4, // A = Device without portmap behind address-only restricted NAT PortRestrictedNAT = 5, // P = Device without portmap behind address-and-port restricted NAT } diff --git a/veilid-core/src/routing_table/routing_domains.rs b/veilid-core/src/routing_table/routing_domains.rs index d92dddc9..8cd35df1 100644 --- a/veilid-core/src/routing_table/routing_domains.rs +++ b/veilid-core/src/routing_table/routing_domains.rs @@ -128,7 +128,18 @@ impl RoutingDomainDetailCommon { self.dial_info_details.clone() ); - let relay_info = self + // Check if any of our dialinfo require a relay for signaling + // FullConeNAT requires a relay but it does not have to be published because it does not require signaling + let mut publish_relay = false; + for did in self.dial_info_details() { + if did.class.requires_signal() { + publish_relay = true; + break; + } + } + + let relay_info = if publish_relay { + self .relay_node .as_ref() .and_then(|rn| { @@ -145,7 +156,10 @@ impl RoutingDomainDetailCommon { } else { None } - }); + }) + } else { + None + }; let signed_node_info = match relay_info { Some((relay_ids, relay_sdni)) => SignedNodeInfo::Relayed(