Commit Graph

22 Commits

Author SHA1 Message Date
Matt Layher
d536e23ec2 dhcp4: add OptInterfaceMTU 2018-07-27 08:59:23 -07:00
Matt Layher
df529f74dc dhcp4: make all options use type Option 2018-07-27 08:59:23 -07:00
David Anderson
bcaa633b65 Delete dead code. 2018-02-05 21:09:02 -08:00
Matt Layher
c41aa79265 dhcp4: parse transaction ID as a byte slice 2018-02-03 11:23:32 -08:00
David Anderson
e78af6b0e8 dhcp4: only run the linuxConn tests on linux.
Seems obvious when you say it like that! Fixes #41.
2017-06-01 20:11:50 -07:00
David Anderson
e9e2bb6f2d dhcp4: avoid reusing bs between the writing and reading tests.
Although it looks like the sequencing of writing bs to the socket
and reusing the slice for the read test is guaranteed by there being
a receive from the socket in between, the race detector disagrees, and
found a race.
2017-06-01 20:07:28 -07:00
David Anderson
fbcb237a6d dhcp4: bind listeners to 0.0.0.0 and filter based on received interface.
Some DHCP messages are broadcast to 255.255.255.255, and binding to a
specific address filters those packets out. Instead, we have to translate
the "listen on ip:port" intent to "listen on interface:port", and filter
based on the interface that received the packet.

Fixes #27.
2017-01-05 00:29:13 -08:00
David Anderson
f061a783a7 dhcp4: Don't use the non-binding DHCP Conn silently on linux.
pixiecore: Plumb NewSnooperConn into Server as an advanced option.
pixiecore/cli: Plumb DHCPNoBind to the CLI.

Now, by default, Pixiecore will bind() to the DHCP server port in a way
that shows up in `netstat` by default. If you want to enable the "coexist
with my existing DHCP server" mode, you need to explicitly pass
--dhcp-no-bind.
2016-08-28 16:16:47 -07:00
David Anderson
e17cabd818 dhcp4: correct the package documentation to match convention. 2016-08-15 00:46:45 -07:00
David Anderson
6766b5ca59 dhcp4: make it required for Conn.RecvDHCP to return interface information.
As it turns out, it's fairly difficult to do anything useful with DHCP
without this information, and the Conn implementations I can think of
all provide the information, so we might as well make it a requirement.
2016-08-10 21:39:05 -07:00
David Anderson
d0f6cb0348 dhcp4: Fix handling of the boot filename. 2016-08-08 20:45:57 -07:00
David Anderson
879aab828e dhcp4: correct the default address for linuxConn.
net.ListenPacket wants an actual IP address, whereas ":67" gives you a nil.
2016-07-17 01:59:10 -07:00
David Anderson
c9ec51e475 dhcp4: fix portable Conn initialization and packet transmission.
Conn is supposed to accept "" to mean "listen for DHCP on all interfaces",
but portableConn didn't correctly handle that.

And I got the comparison wrong on ifidx in the portable send function, so
packets got sent out entirely the wrong interface :(.
2016-07-16 22:22:42 -07:00
David Anderson
f4ee0d5314 dhcp4: fix missing switch case. 2016-06-18 16:44:59 -07:00
David Anderson
8dfa75434e dhcp4: allow duplication of option 56 (Debug message).
Turns out real DHCP servers can duplicate this message.
2016-06-18 16:44:06 -07:00
David Anderson
7a39e0e685 Actually name the package correctly, so that it can be imported. 2016-05-17 21:52:27 -07:00
David Anderson
3fb28ed0f7 dhcp4: Add tests for the option accessors... and fix a bug.
Turns out tests are useful.
2016-05-15 17:45:54 -07:00
David Anderson
c412f00cb8 dhcp4: add consts for common options, and option getters. 2016-05-15 17:26:35 -07:00
David Anderson
458d5eb0e8 Document the new non-interface Conn type. 2016-05-15 15:04:59 -07:00
David Anderson
53e4bfd991 dhcp4: refactor the low-level packet sending.
This lets the implementations share the transmission strategy and
decoding/sanity logic.
2016-05-15 14:56:09 -07:00
David Anderson
e46cf1fec1 dhcp4: correct import constraint so that we can actually import. 2016-05-15 13:41:39 -07:00
David Anderson
50f74885e9 dhcp: rename to dhcp4. 2016-05-15 13:39:49 -07:00