diff --git a/veilid-core/src/network_manager/native/discovery_context.rs b/veilid-core/src/network_manager/native/discovery_context.rs index 5cc70cf4..830dc28d 100644 --- a/veilid-core/src/network_manager/native/discovery_context.rs +++ b/veilid-core/src/network_manager/native/discovery_context.rs @@ -420,7 +420,7 @@ impl DiscoveryContext { }; // If we have two different external addresses, then this is a symmetric NAT - if external_2.address != external_1.address { + if external_2.address.address() != external_1.address.address() { let do_symmetric_nat_fut: SendPinBoxFuture> = Box::pin(async move { Some(DetectedDialInfo::SymmetricNAT) }); unord.push(do_symmetric_nat_fut); diff --git a/veilid-core/src/network_manager/native/network_class_discovery.rs b/veilid-core/src/network_manager/native/network_class_discovery.rs index 62d0ba95..94db7ece 100644 --- a/veilid-core/src/network_manager/native/network_class_discovery.rs +++ b/veilid-core/src/network_manager/native/network_class_discovery.rs @@ -11,19 +11,6 @@ impl Network { .get_network_class(RoutingDomain::PublicInternet) .unwrap_or_default(); - // get existing dial info into table by protocol/address type - let mut existing_dial_info = BTreeMap::<(ProtocolType, AddressType), DialInfoDetail>::new(); - for did in self.routing_table().all_filtered_dial_info_details( - RoutingDomain::PublicInternet.into(), - &DialInfoFilter::all(), - ) { - // Only need to keep one per pt/at pair, since they will all have the same dialinfoclass - existing_dial_info.insert( - (did.dial_info.protocol_type(), did.dial_info.address_type()), - did, - ); - } - match ddi { DetectedDialInfo::SymmetricNAT => { // If we get any symmetric nat dialinfo, this whole network class is outbound only, @@ -39,6 +26,19 @@ impl Network { } } DetectedDialInfo::Detected(did) => { + // get existing dial info into table by protocol/address type + let mut existing_dial_info = + BTreeMap::<(ProtocolType, AddressType), DialInfoDetail>::new(); + for did in self.routing_table().all_filtered_dial_info_details( + RoutingDomain::PublicInternet.into(), + &DialInfoFilter::all(), + ) { + // Only need to keep one per pt/at pair, since they will all have the same dialinfoclass + existing_dial_info.insert( + (did.dial_info.protocol_type(), did.dial_info.address_type()), + did, + ); + } // We got a dial info, upgrade everything unless we are fixed to outbound only due to a symmetric nat if !matches!(existing_network_class, NetworkClass::OutboundOnly) { // Get existing dial info for protocol/address type combination diff --git a/veilid-core/src/veilid_api/debug.rs b/veilid-core/src/veilid_api/debug.rs index 17050629..38ee02f6 100644 --- a/veilid-core/src/veilid_api/debug.rs +++ b/veilid-core/src/veilid_api/debug.rs @@ -648,7 +648,7 @@ impl VeilidAPI { if !args.is_empty() { if args[0] == "buckets" { // Must be detached - if matches!( + if !matches!( self.get_state().await?.attachment.state, AttachmentState::Detached | AttachmentState::Detaching ) {