commit | f33542f0fe3ee5cbd73664934928304a37aa8b36 | [log] [tgz] |
---|---|---|
author | Sepehr Raissian <sepehrtheraiss@gmail.com> | Fri Sep 28 10:59:21 2018 -0700 |
committer | Shentubot <shentubot@google.com> | Fri Sep 28 11:00:08 2018 -0700 |
tree | 5daadd9770ac3ef6d503c554068bfbe7f4ea1d1c | |
parent | 9029f561240c08608fb556a4e0eb6895f0d93676 [diff] |
Block for link address resolution Previously, if address resolution for UDP or Ping sockets required sending packets using Write in Transport layer, Resolve would return ErrWouldBlock and Write would return ErrNoLinkAddress. Meanwhile startAddressResolution would run in background. Further calls to Write using same address would also return ErrNoLinkAddress until resolution has been completed successfully. Since Write is not allowed to block and System Calls need to be interruptible in System Call layer, the caller to Write is responsible for blocking upon return of ErrWouldBlock. Now, when startAddressResolution is called a notification channel for the completion of the address resolution is returned. The channel will traverse up to the calling function of Write as well as ErrNoLinkAddress. Once address resolution is complete (success or not) the channel is closed. The caller would call Write again to send packets and check if address resolution was compeleted successfully or not. Fixes google/gvisor#5 Change-Id: Idafaf31982bee1915ca084da39ae7bd468cebd93 PiperOrigin-RevId: 214962200
Netstack is a network stack written in Go.
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>
Please see CONTRIBUTING.md for more details.
This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.