dhcp: send 'server identifier' on request

The 'server identifier' option on a DHCPREQUEST must be the value of
the option sent by the server on the DHCPOFFER. Before this CL, we
were mistakenly using the siaddr field of the packet as the
identifier.

To cover this case in our unit tests, we fix our server to always
provide an siaddr of 0, and then require the client to send the
correct 'server identifier' option. (Just the server changes from
this CL cause the tests to fail.)

Also allow the DNS option to be any multiple of four, as DHCP
servers can send more than DNS server.

Change-Id: I40ff359f739c1129558e316edcee50de13e56446
4 files changed
tree: 87f9d6676ff2fbf59e4532dd4b9f87495b4e3ef8
  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.