@@ -790,29 +790,29 @@ func (de *endpoint) updateFromNode(n *tailcfg.Node, heartbeatDisabled bool) {
790790 }
791791
792792 var newIpps []netip.AddrPort
793- if ! de .blockEndpoints {
794- for i , epStr := range n .Endpoints {
795- if i > math .MaxInt16 {
796- // Seems unlikely.
797- continue
798- }
799- ipp , err := netip .ParseAddrPort (epStr )
800- if err != nil {
801- de .c .logf ("magicsock: bogus netmap endpoint %q" , epStr )
802- continue
803- }
804- if st , ok := de .endpointState [ipp ]; ok {
805- st .index = int16 (i )
806- } else {
807- de .endpointState [ipp ] = & endpointState {index : int16 (i )}
808- newIpps = append (newIpps , ipp )
809- }
793+ for i , epStr := range n .Endpoints {
794+ if i > math .MaxInt16 {
795+ // Seems unlikely.
796+ continue
797+ }
798+ ipp , err := netip .ParseAddrPort (epStr )
799+ if err != nil {
800+ de .c .logf ("magicsock: bogus netmap endpoint %q" , epStr )
801+ continue
802+ }
803+ if de .blockEndpoints && ipp .Addr () != tailcfg .DerpMagicIPAddr {
804+ de .c .dlogf ("[v1] magicsock: disco: updateFromNode: %v received non-DERP endpoint %v, but endpoints blocked" ,
805+ de .publicKey .ShortString (),
806+ ipp ,
807+ )
808+ continue
809+ }
810+ if st , ok := de .endpointState [ipp ]; ok {
811+ st .index = int16 (i )
812+ } else {
813+ de .endpointState [ipp ] = & endpointState {index : int16 (i )}
814+ newIpps = append (newIpps , ipp )
810815 }
811- } else {
812- de .c .dlogf ("[v1] magicsock: disco: updateFromNode: %v received %d endpoints, but endpoints blocked" ,
813- de .publicKey .ShortString (),
814- len (n .Endpoints ),
815- )
816816 }
817817 if len (newIpps ) > 0 {
818818 de .debugUpdates .Add (EndpointChange {
@@ -842,9 +842,8 @@ func (de *endpoint) addCandidateEndpoint(ep netip.AddrPort, forRxPingTxID stun.T
842842 de .mu .Lock ()
843843 defer de .mu .Unlock ()
844844
845- isDERP := ep .Addr () == tailcfg .DerpMagicIPAddr
846- if isDERP && de .blockEndpoints {
847- de .c .logf ("[unexpected] attempted to add candidate endpoint %v to %v (%v) but endpoints blocked" , ep , de .discoShort (), de .publicKey .ShortString ())
845+ if de .blockEndpoints && ep .Addr () != tailcfg .DerpMagicIPAddr {
846+ de .c .logf ("[unexpected] attempted to add non-DERP candidate endpoint %v to %v (%v) but endpoints blocked" , ep , de .discoShort (), de .publicKey .ShortString ())
848847 return false
849848 }
850849
0 commit comments