dns: close endpoint when no longer needed

Keeping the old endpoint open on a UDP connection meant that a future
endpoint would not pick up new configuration from a DHCP change. This
meant an existing getaddrinfo would wait for its timeout if a DHCP IP
address appeared in the middle of its attempts.

Closing the endpoint after each attempt means the next one will try
the new, better path and actually succeed.

In practice, this means if `wget http://www.google.com` is stuck on
getaddrinfo before a DHCP IP has been picked up, it will now wait the
3 second timeout and on the next attempt succeed, instead of blocking
for a long time.

NET-77 # done

Change-Id: Ie945685b12d24862ba6ac562830ca9a72d39d513
1 file changed
tree: cd820dadf75138e2f98f4d8fa709a436db5844b8
  1. dhcp/
  2. dns/
  3. ilist/
  4. tcpip/
  5. tmutex/
  6. waiter/
  7. AUTHORS
  8. CONTRIBUTING.md
  9. CONTRIBUTORS
  10. LICENSE
  11. README.md
README.md

Netstack

Netstack is a network stack written in Go.

Getting started

Try it out on Linux by installing the tun_tcp_echo demo:

go install github.com/google/netstack/tcpip/sample/tun_tcp_echo

Create a TUN device with:

[sudo] ip tuntap add user <username> mode tun <device-name>
[sudo] ip link set <device-name> up
[sudo] ip addr add <ipv4-address>/<mask-length> dev <device-name>

Then run with:

tun_tcp_echo <device-name> <ipv4-address> <port>

Contributions

We would love to accept contributions, but we have not yet worked out how to handle them. Please contact us before sending any pull requests.

Whatever we do decide on will require signing the Google Contributor License. Please see CONTRIBUTING.md for more details.

Disclaimer

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.