19 Commits

Author SHA1 Message Date
David Anderson
78dd971886 Checkpoint some further hacking on AF_PACKET, before bailing.
AF_PACKET is poorly suited to be the main receiving socket of this
implementation, for a variety of reasons: it bypasses netfilter, you
receive duplicate packets when bridges and aggregated links are involved,
and more generally it's a lot of pain just to get a MAC address out of
the link layer.

Next up, I'm going to try using an AF_INET/SOCK_RAW socket as the main
listening socket, which loses a bit of precision in acquiring packets, but
puts more of the kernel and its desirable semantics between us and the wire.
We'll still have to use an AF_PACKET socket to transmit to unconfigured
clients (although the spec gives us an option to sidestep that as well
if we want).
2016-03-24 23:58:38 -07:00
David Anderson
bd7be1a19a Enable custom import paths. 2016-03-24 13:12:10 -07:00
David Anderson
60581f4259 Document dhcp.Options.Uint16. 2016-03-23 23:46:32 -07:00
David Anderson
21d22e747d Make dhcp.Conn also be an io.Closer. 2016-03-23 23:43:52 -07:00
David Anderson
05cf66722e Implement a Conn using linux AF_PACKET/SOCK_RAW sockets and BPF packet filtering.
This is a fairly advanced, linux-specific implementation that lets you run a DHCP
listener on a machine that's already running some other DHCP service.
2016-03-23 23:41:25 -07:00
David Anderson
aa6bf25654 Add a Conn type for sending and receiving DHCP packets. 2016-03-23 23:30:42 -07:00
David Anderson
668c1a3b32 Add a DHCPREQUEST from a DHCP relay to the test dataset. 2016-03-23 23:18:58 -07:00
David Anderson
6f642bb5ed Rename dhcp.go to packet.go in preparation for introduction of server. 2016-03-15 20:25:24 -07:00
David Anderson
576e70e92c Add copyright/license headers to source. 2016-03-05 15:14:52 -08:00
David Anderson
8175ab5f5c Add a Copy method to options, and tests for options. 2016-02-29 19:34:07 -08:00
David Anderson
e8fa791c89 Make the debug string function public, so that the pxe package can use it. 2016-02-28 01:08:42 -08:00
David Anderson
d6ac0332dd Strip option 53 out of the options map, as the value is parsed into Type. 2016-02-28 01:08:12 -08:00
David Anderson
621a0c28e5 Implicitly add DHCP option 53 when marshalling. 2016-02-28 01:06:37 -08:00
David Anderson
af2fc8892a Add a Uint16 reader for dhcp.Options. 2016-02-28 01:05:54 -08:00
David Anderson
33e5e06817 Change the separation between packets to help PXE testing. 2016-02-27 23:15:07 -08:00
David Anderson
3cbc2e2788 Add a test for DHCP marshalling.
And fix a bug in DHCP marshalling that the test found :).
2016-02-27 22:51:45 -08:00
David Anderson
e799b6e1ab Correct the parsing of the server IP address.
It's the address of the responding server, not the boot server. Which
makes sense, since there's another field for the boot server name.
2016-02-27 22:36:49 -08:00
David Anderson
fa657ad649 Add a basic regression test for DHCP parsing. 2016-02-27 22:34:18 -08:00
David Anderson
133baa88bd Initial implementation of DHCP parsing. 2016-02-27 16:35:40 -08:00