4 Commits

Author SHA1 Message Date
David Anderson
45dd5dfe4d dhcp: implement a portable Conn.
Unlike the linux Conn, this one cannot share a port with another
process, but it should work across platforms.
2016-05-14 23:05:23 -07:00
David Anderson
c5449b945c dhcp: implement a linux specific "port sharing" Conn.
This implementation uses a raw IP socket combined with a BPF packet
filter to receive traffic for one UDP port, without having to bind()
to that port. This enables this Conn to coexist on a machine alongside
a DHCP server.
2016-05-14 22:17:10 -07:00
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
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