Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing relay only on my clients and a port allocator results in never allocating a port #229

Open
doctorpangloss opened this issue Aug 20, 2021 · 0 comments

Comments

@doctorpangloss
Copy link

doctorpangloss commented Aug 20, 2021

Your environment.

  • Version: 72ffd59
  • Browser: Mobile Safari on iOS 12.7, Chrome 92

What did you do?

I added logging to RelayAddressGeneratorPortRange to see if a port is ever allocated.

	for try := 0; try < r.MaxRetries; try++ {
		port := r.MinPort + uint16(r.Rand.Intn(int((r.MaxPort+1)-r.MinPort)))
		conn, err := r.Net.ListenPacket(network, fmt.Sprintf("%s:%d", r.Address, port))
		if err != nil {
		  log.Printf("could not allocate port %d", port)
			continue
		}

		relayAddr := conn.LocalAddr().(*net.UDPAddr)
		relayAddr.IP = r.RelayAddress
		log.Printf("allocated %d")
		return conn, relayAddr, nil
	}

What did you expect?

Ports should be allocated.

What happened?

A port is never allocated randomly within the range. I see multiple of the following errors:

turn ERROR: 2021/08/19 20:17:08 error when handling datagram: failed to handle Allocate-request from 192.168.88.162:61561: relay already allocated for 5-TUPLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant