185 Commits

Author SHA1 Message Date
David Anderson
c3fe975c1e Switch .travis.yml to using Travis's VM infrastructure.
My request to whitelist the install of atftp seems to be lost in issue tracker
limbo, as are all other whitelisting requests for the last few months.
2016-08-14 18:33:20 -07:00
David Anderson
2fc6bdac12 Fix the golint command in .travis.yml, to actually lint stuff. 2016-08-14 18:15:37 -07:00
David Anderson
2639514bac Correct .travis.yml to be further glide-ed. 2016-08-14 17:57:57 -07:00
David Anderson
fed7f78f53 Glide-ify .travis.yml to test everything against the glided dependencies. 2016-08-14 17:54:50 -07:00
David Anderson
0407e90330 Add glide.yaml and glide.lock for vendoring.
I'm deliberately *not* checking in the vendor/ directory here, because
doing so would interfere with people trying to use the libraries rather
than the binaries. Sadly, none of the vendoring tools work very well when
I ask them to vendorize just cmd/ (they reimport a copy of the libs in
this repository), so for simplicity right now I'll lock the versions with
glide, but users wanting reproducible builds will still need to
`glide install` themselves.
2016-08-14 17:49:01 -07:00
David Anderson
09a8c3d87d pixiecore/cli: fix CLI's docstring. 2016-08-14 16:59:51 -07:00
David Anderson
2a7824bf67 .gitignore: ignore pixiecore-apache2. 2016-08-14 16:58:04 -07:00
David Anderson
0e92c2bebe pixiecore/cli: add secret debug command to dump builtin ipxe binaries.
The overall debug command is hidden from the CLI, since it should only
be useful when developing.
2016-08-14 16:57:02 -07:00
David Anderson
ff7a0b56c6 pixiecore: Add a retry loop in the iPXE boot.
iPXE has an annoying race condition where it sometimes doesn't notice
the ProxyDHCP response when booting, and fails. So we embed a boot
script in the builtin iPXE binaries that implements the retry loop
recommended in the documentation. Empirically, this has resolved
flaky boots on my test machine, usually no more than a single
retry is needed.
2016-08-14 16:55:27 -07:00
David Anderson
b5e956b9fc pixiecore/cli: implement v1 compatibility for the CLI.
This hack tries to interpret the commandline based on what Pixiecore v1
did, before handing off to the fancier v2 CLI logic.

Doesn't support API mode yet, since that's not yet implemented in
the library.
2016-08-14 16:54:06 -07:00
David Anderson
36351cddec pixiecore/cli: add flags for passing ipxe binaries at runtime.
These flags are both for providing binaries when running the apache2
version of pixiecore (which doesn't have builtin ipxe), and for
overriding the builtin version if desired.
2016-08-12 00:54:59 -07:00
David Anderson
62e2f4bee3 pixiecore/cli: pass Ipxe firmwares as a package global.
The cli package is meant for single-shot execution anyway, so
instead of plumbing everything through reentrantly, let's just
have a global you can seed before calling CLI().
2016-08-11 23:49:18 -07:00
David Anderson
b43c25904b pixiecore: implement the boot command, using static booter.
Doesn't quite work yet: cmdline isn't processed very well, and the
ipxe firmwares aren't plumbed through.
2016-08-11 23:29:46 -07:00
David Anderson
7ffbdcadd2 pixiecore: Implement a static booter for simple boot cases. 2016-08-11 23:09:50 -07:00
David Anderson
3e1664bb17 pixiecore: add missing file.
The build was broken for a while. Doh.
2016-08-10 22:28:20 -07:00
David Anderson
81efc36c64 pixiecore: Refactor the CLI logic into its own subpackage.
The two binaries (Apache2 and GPL) both invoke the cli package to do
the work, the only difference between them is that the GPL binary passes
it embedded ipxe binaries.
2016-08-10 22:27:09 -07:00
David Anderson
4d9f88efd8 cmd: make the GPLv2 pixiecore own the unadorned "pixiecore" binary name.
In practice, most people will want the standalone binary that Just
Works, the variant that doesn't embed ipxe is going to be for niche
applications only.
2016-08-10 21:57:19 -07:00
David Anderson
6a88cefc9b pixiecore: factor the ipxe script generation out of the HTTP handler.
This makes it easier to test the script generation in isolation,
as well as making the whole thing easier to follow.
2016-08-10 21:54:16 -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
2b4d1e8101 pixiecore: replace fmt.Print* with a user-customizable logging function.
Also introduces a "Trace" member to the API, for the future addition of
extremely verbose and complete tracing, to be used for bug reports. But
for now, only Log is used.
2016-08-10 21:36:47 -07:00
David Anderson
0fbd8039c4 Fix URLs in README.md to point to the right packages. 2016-08-10 00:03:02 -07:00
David Anderson
e67e7bea68 Turn README.md into a directory of the repository. 2016-08-09 00:40:24 -07:00
David Anderson
c3052f317f pixiecore: copy READMEs over.
The documentation doesn't match the current code at all, but it's
the target to aim for.
2016-08-09 00:32:45 -07:00
David Anderson
9619a5ab87 pixiecore-gpl: Add README.md explaining the licensing silliness. 2016-08-09 00:28:29 -07:00
David Anderson
b26e36a301 Add .gitignore to ignore the various binaries produced while hacking. 2016-08-09 00:21:49 -07:00
David Anderson
e440f01741 pixiecore: new version of Pixiecore, using netboot libraries.
This version is still *extremely* barebones, and the unstable tag
in the README applies triple for it, but the code in its current
state is capable of booting x86 and UEFI clients correctly, and
that was hard enough to merit a snapshot checkpoint.
2016-08-09 00:19:08 -07:00
David Anderson
bff529103e third_party: update ipxe. 2016-08-09 00:16:25 -07:00
David Anderson
d0f6cb0348 dhcp4: Fix handling of the boot filename. 2016-08-08 20:45:57 -07:00
David Anderson
551e4aee91 Support the tsize extension for TFTP.
It turns out many PXE firmwares request tsize to size the download
buffer, and will refuse to download at all if the server cannot
provide a tsize.

This unfortunately breaks API compatibility to add a size parameter,
but I think it's an unfortunate necessity to make this work.
2016-08-08 20:41:12 -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
684f93040b third_party: import ipxe for embedding into Go. 2016-07-16 17:11:22 -07:00
David Anderson
cbb14a347d Document the canonical import path in the README. 2016-06-18 16:45:45 -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
6ff894645a readme: tiny wording tweak. 2016-05-15 15:11:41 -07:00
David Anderson
9f9875cedc Add a marker to mark the APIs as unstable. 2016-05-15 15:06:24 -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
6a00ec441b Add badges for license and travis build status. 2016-05-15 13:55:41 -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
David Anderson
e3dd7c6861 dhcp: add documentation file. 2016-05-15 13:39:31 -07:00
David Anderson
ae696d0c3d dhcp: tighten up the exported interface by removing some cruft.
Notably, some of the helpers for implementing Conns are internal now.
2016-05-14 23:44:54 -07:00
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