david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

5218 Commits

Author SHA1 Message Date
Michael Brown f6e1da5cbf [build] Search for ldlinux.c32 separately from isolinux.bin
Some distributions (observed with Ubuntu 15.04) place ldlinux.c32 in a
separate directory from isolinux.bin.  Search for these files
separately, and allow an alternative location of ldlinux.c32 to be
provided via LDLINUX_C32=... on the make command line.

Reported-by: Adrian Koshka <adriankoshcha@teknik.io>
Tested-by: Adrian Koshka <adriankoshcha@teknik.io>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-01 21:04:44 +01:00
Michael Brown 619a377328 [efi] Populate debug directory entry FileOffset field
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-01 01:35:03 +01:00
Michael Brown ed609c4889 [efi] Fix debug directory size
The debug directory size specified in the data directory should cover
only the EFI_IMAGE_DEBUG_DIRECTORY_ENTRY structure, not the whole of
the .debug section.

Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-01 01:35:03 +01:00
Michael Brown bd96c6fffd [efi] Add definitions of GUIDs observed when booting wdsmgfw.efi
Add definitions of protocols observed to be used by wdsmgfw.efi, and
add a handle name type for ConIn, ConOut, and StdErr.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-01 01:34:58 +01:00
Michael Brown 2ef04f092c [pxe] Construct all fake DHCP packets before starting PXE NBP
Commit edf74df ("[pxe] Always reconstruct packet for
PXENV_GET_CACHED_INFO") fixed the problems caused by returning stale
DHCP packets (e.g. from an earlier boot attempt using a different
network device), but broke interoperability with NBPs such as WDS
which may overwrite our cached (fake) DHCP packets and expect the
modified packets to be returned by a subsequent call to
PXENV_GET_CACHED_INFO.

Fix by constructing the fake DHCP packets immediately before
transferring control to a PXE NBP.  Calls to PXENV_GET_CACHED_INFO
will now never modify the cached packets.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-29 16:58:12 +01:00
Michael Brown c522c11c7b [efi] Improve efi_wrap debugging
Add debug wrappers for more boot services functions, and print
symbolic values rather than raw numbers where possible.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-27 15:54:25 +01:00
Michael Brown e08d7ccc95 [efi] Include installed protocol list in unknown handle names
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-27 15:40:44 +01:00
Michael Brown 9501eaf68d [efi] Remove raw EFI_HANDLE values from debug messages
The raw EFI_HANDLE value is almost never useful to know, and simply
adds noise to the already verbose debug messages.  Improve the
legibility of debug messages by using only the name generated by
efi_handle_name().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-27 15:40:44 +01:00
Michael Brown 0e407377dd [efi] Mark EFI debug transcription functions as __attribute__ (( pure ))
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-27 15:40:44 +01:00
Michael Brown a09dd5c03d [efi] Add definitions of GUIDs observed when booting shim.efi and grub.efi
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-27 15:40:44 +01:00
Michael Brown f0c6c4efd8 [dhcp] Do not skip ProxyDHCPREQUEST if next-server is empty
We attempt to mimic the behaviour of Intel's PXE ROM by skipping the
separate ProxyDHCPREQUEST if the ProxyDHCPOFFER already contains a
boot filename or a PXE boot menu.

Experimentation reveals that Intel's PXE ROM will also check for a
non-empty next-server address alongside the boot filename.  Update our
test to match this behaviour.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Tested-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-26 16:08:58 +01:00
Michael Brown ba3695353a [settings] Re-add "uristring" setting type
Commit 09b057c ("[settings] Remove "uristring" setting type") removed
support for URI-encoded settings via the "uristring" setting type, on
the basis that such encoding was no longer necessary to avoid problems
with the command line parser.

Other valid use cases for the "uristring" setting type do exist: for
example, a password containing a '/' character expanded via

  chain http://username:${password:uristring}@server.name/boot.php

Restore the existence of the "uristring" setting, avoiding the
potentially large stack allocations that were used in the old code
prior to commit 09b057c ("[settings] Remove "uristring" setting
type").

Requested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-25 13:31:46 +01:00
Michael Brown 4e03af8ec2 [autoboot] Display image information as part of the default control flow
When booting without an embedded script, display the imgstat()
information immediately before executing the downloaded image.  This
allows potentially useful diagnostic information (such as the detected
image type) to be observed by the user without needing to enter the
iPXE shell and manually download the image.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-21 16:32:02 +01:00
Michael Brown abfe94a90a [image] Detect image type when image is first registered
The current usage pattern of image_probe() is a legacy from the time
before commit 34b6ecb ("[image] Simplify image management") when
loading an image to its executable location in memory was a separate
action from actually executing the image.

Call image_probe() as soon as an image is registered.  This allows
"imgstat" to display image type information for all images and allows
image-consuming code to assume that image->type is already set
correctly.

Ignore failures if image_probe() does not recognise the image, since
we do expect to handle unrecognised images (initrds, modules, etc).
Unrecognised images will be left with a NULL image->type, which
image-consuming code can easily check.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-21 16:25:11 +01:00
Michael Brown f58ebbdfb5 [test] Allow self-tests to report exit status when running under Linux
Allow the return status from an embedded image to propagate out to the
eventual return status from main().  When running under Linux, this
allows the pass/fail result of unit tests to be observable without
having to visually inspect the console output.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-21 15:46:28 +01:00
Michael Brown fb4ce72e64 [pxe] Warn about PXE NBPs that may be EFI executables
A relatively common user mistake is to attempt to boot an EFI
executable (such as grub.efi) using a BIOS version of iPXE.

Unfortunately there are no signature checks that we can use to
unambiguously identify a PXE NBP, since a PXE NBP is just raw machine
code.  We therefore have to accept anything sufficiently small to fit
into base memory as a valid PXE NBP.

We can detect that a file might be an EFI executable by checking for
the initial "MZ" signature bytes.  This does not necessarily preclude
the file from also being a PXE NBP (since it would be possible to
create a hybrid binary which acts as both an EFI executable and a PXE
NBP, similar to the way in which wimboot and the Linux kernel are
hybrid binaries which act as both an EFI executable and a bzImage).

If the initial "MZ" signature bytes are present, then attempt to warn
the user by setting the image type to "PXE-NBP (may be EFI?)".  We
can't (sensibly) prevent the user from accidentally running an EFI
executable as a PXE NBP, but we can at least make it easier for the
user to identify their mistake.

Inspired-by: Robin Smidsrød <robin@smidsrod.no>
Inspired-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-21 15:13:19 +01:00
Michael Brown 0a34c2aab9 [dhcp] Ignore ProxyDHCPACKs without PXE options
Suggested-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-18 17:18:38 +01:00
Michael Brown 60e2b71471 [dhcp] Allow pseudo-DHCP servers to use pseudo-identifiers
Some ProxyDHCP servers and PXE boot servers do not specify a DHCP
server identifier via option 54.  We currently work around this in a
variety of ad-hoc ways:

 - if a ProxyDHCPACK has no server identifier then we treat it as
   having the correct server identifier,

 - if a boot server ACK has no server identifier then we use the
   packet's source IP address as the server identifier.

Introduce the concept of a DHCP server pseudo-identifier, defined as
being:

 - the server identifier (option 54), or

 - if there is no server identifier, then the next-server address
   (siaddr),

 - if there is no server identifier or next-server address, then the
   DHCP packet's source IP address.

Use the pseudo-identifier in place of the server identifier when
handling ProxyDHCP and PXE boot server responses.

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-18 15:43:06 +01:00
Fabrice Bacchella c0b61bad99 [efi] Work around bugs in Emulex NII driver
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 15:57:05 +01:00
Fabrice Bacchella b71037989d [efi] Improve NII driver logging
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 15:55:48 +01:00
Wissam Shoukair eb8df9a046 [ipoib] Fix a race when chain-loading undionly.kpxe in IPoIB
The Infiniband link status change callback ipoib_link_state_changed()
may be called while the IPoIB device is closed, in which case there
will not be an IPoIB queue pair to be joined to the IPv4 broadcast
group.  This leads to NULL pointer dereferences in ib_mcast_attach()
and ib_mcast_detach().

Fix by not attempting to join (or leave) the broadcast group unless we
actually have an IPoIB queue pair.

Signed-off-by: Wissam Shoukair <wissams@mellanox.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 14:42:36 +01:00
Michael Brown fd18417cf1 [peerdist] Add support for PeerDist (aka BranchCache) HTTP content encoding
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 13:24:40 +01:00
Michael Brown d2b2a0adae [peerdist] Add block download multiplexer
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 13:24:39 +01:00
Michael Brown 4d032d5db8 [peerdist] Add individual block download mechanism
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 13:24:39 +01:00
Michael Brown dc9d24e7d2 [peerdist] Add segment discovery mechanism
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 13:24:39 +01:00
Michael Brown 518a98eb56 [http] Rewrite HTTP core to support content encodings
Rewrite the HTTP core to allow for the addition of arbitrary content
encoding mechanisms, such as PeerDist and gzip.

The core now exposes http_open() which can be used to create requests
with an explicitly selected HTTP method, an optional requested content
range, and an optional request body.  A simple wrapper provides the
preexisting behaviour of creating either a GET request or an
application/x-www-form-urlencoded POST request (if the URI includes
parameters).

The HTTP SAN interface is now implemented using the generic block
device translator.  Individual blocks are requested using http_open()
to create a range request.

Server connections are now managed via a connection pool; this allows
for multiple requests to the same server (e.g. for SAN blocks) to be
completely unaware of each other.  Repeated HTTPS connections to the
same server can reuse a pooled connection, avoiding the per-connection
overhead of establishing a TLS session (which can take several seconds
if using a client certificate).

Support for HTTP SAN booting and for the Basic and Digest
authentication schemes is now optional and can be controlled via the
SANBOOT_PROTO_HTTP, HTTP_AUTH_BASIC, and HTTP_AUTH_DIGEST build
configuration options in config/general.h.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 13:24:33 +01:00
Michael Brown 09236e6030 [block] Add generic block device translator
Add a generic mechanism for providing block devices on top of a data
transfer interface (such as HTTP).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-16 00:48:34 +01:00
Daniel Pieczko abd36b9f96 [prefix] Use correct register for KEEP_IT_REAL physical address conversion
Signed-off-by: Daniel Pieczko <dpieczko@solarflare.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-14 16:18:54 +01:00
Michael Brown 989fe14ccd [efi] Add missing "ULL" suffix on 64-bit constant
Older versions of gcc complain if this suffix is missing.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-03 13:05:21 +01:00
Michael Brown c6b299df20 [efi] Hold off watchdog timer while running
UEFI platforms may provide a watchdog timer, which will reboot the
machine if an operating system takes more than five minutes to load.
This can cause long-lived iPXE downloads (or interactive shell
sessions) to unexpectedly reboot.

Fix by resetting the watchdog timer every ten seconds while the iPXE
main processing loop continues to run.

Reported-by: Bradley B Williams <bradleybwilliams@swbell.net>
Reported-by: John Clark <john.r.clark.3@gmail.com>
Reported-by: wdriever@gmail.com
Reported-by: Charlie Beima <cbeima@indiana.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-03 12:48:02 +01:00
Michael Brown b1caa48e4b [crypto] Support SHA-{224,384,512} in X.509 certificates
Add support for SHA-224, SHA-384, and SHA-512 as digest algorithms in
X.509 certificates, and allow the choice of public-key, cipher, and
digest algorithms to be configured at build time via config/crypto.h.

Originally-implemented-by: Tufan Karadere <tufank@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-02 16:54:24 +01:00
Tufan Karadere 93370488ac [crypto] Add ASN.1 OIDs for sha{224,384,512}WithRsaEncryption
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-02 16:39:09 +01:00
Michael Brown fc7885ed9e [tls] Report supported signature algorithms in ClientHello
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-02 14:17:24 +01:00
Michael Brown 1ac7434111 [tls] Do not access beyond the end of a 24-bit integer
The current implementation handles big-endian 24-bit integers (which
occur in several TLS record types) by treating them as big-endian
32-bit integers which are shifted by 8 bits.  This can result in
"Invalid read" errors when running under valgrind, if the 24-bit field
happens to be exactly at the end of an I/O buffer.

Fix by ensuring that we touch only the three bytes which comprise the
24-bit integer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-01 00:06:58 +01:00
Michael Brown 2849932c48 [serial] Check for UART existence in uart_select()
Check for existence of the UART in uart_select(), not just in
uart_init().  This allows uart_select() to refuse to set a non-working
address in uart->base, which in turns means that the serial console
code will not attempt to use a non-existent UART.

Reported-by: Torgeir Wulfsberg <Torgeir.Wulfsberg@kongsberg.com>
Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-31 11:19:19 +01:00
Michael Brown 9aa55f811a [comboot] Avoid dragging in serial console support unconditionally
When the ability for iPXE to handle multiple serial ports was added,
the choice was made that the singular serial port referred to by
COMBOOT calls should mean the port used for the serial console.  This
unintentionally caused IMAGE_COMBOOT to also enable CONSOLE_SERIAL.

Fix by providing a weak-symbol version of the serial console which
will be used if serial console support was not explicitly enabled.

Reported-by: Torgeir Wulfsberg <Torgeir.Wulfsberg@kongsberg.com>
Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-31 10:58:05 +01:00
Michael Brown ae7f22eb28 [elf] Reject ELFBoot images requiring virtual addressing
We do not set up any kind of virtual addressing before invoking an
ELFBoot image.  Reject if the image's program headers indicate that
virtual addresses are not equal to physical addresses.

This avoids problems when loading some RHEL5 kernels, which seem to
include ELFBoot headers using virtual addressing.  With this change,
these kernels are no longer detected as ELFBoot, and so may be
(correctly) detected as bzImage instead.

Reported-by: Torgeir.Wulfsberg@kongsberg.com
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-29 14:17:09 +01:00
Michael Brown 1e4ff872be [linebuf] Support buffering of multiple lines
Allow line buffer to accumulate multiple lines, with buffered_line()
returning each freshly-completed line as it is encountered.  This
allows buffered lines to be subsequently processed as a group.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 16:59:11 +01:00
Michael Brown 20d35b0145 [pool] Add a generic concept of a pooled connection
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 16:37:00 +01:00
Michael Brown a8d9cd9485 [peerdist] Add support for constructing and decoding retrieval messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 16:09:18 +01:00
Michael Brown 51b99d8bc8 [peerdist] Add support for constructing and decoding discovery messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 16:09:14 +01:00
Michael Brown f0d594557c [peerdist] Include trimmed range within content information block
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 15:22:26 +01:00
Michael Brown b20d4a1522 [netdevice] Allow network devices to disclaim IRQ support at runtime
VLAN and 802.11 devices use a network device operations structure that
wraps an underlying structure.  For example, the vlan_operations
structure wraps the network device operations structure of the
underlying trunk device.  This can cause false positives from the
current implementation of netdev_irq_supported(), which will always
report that VLAN devices support interrupts since it has no visibility
into the support provided by the underlying trunk device.

Fix by allowing network devices to explicitly flag that interrupts are
not supported, despite the presence of an irq() method.

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 15:14:40 +01:00
Michael Brown 76338543f9 [iscsi] Add missing "break" statements
iscsi_tx_done() is missing "break" statements at the end of each case.
(Fortunately, this happens not to cause a bug in practice, since
iscsi_login_request_done() is effectively a no-op when completing a
data-out PDU.)

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 14:15:14 +01:00
Michael Brown 2bcf13f13a [ipv4] Allow IPv4 socket addresses to include a scope ID
Extend the IPv6 concept of "scope ID" (indicating the network device
index) to IPv4 socket addresses, so that IPv4 multicast transmissions
may specify the transmitting network device.

The scope ID is not (currently) exposed via the string representation
of the socket address, since IPv4 does not use the IPv6 concept of
link-local addresses (which could legitimately be specified in a URI).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 13:48:29 +01:00
Michael Brown 6efcabd415 [ipv4] Redefine IP address constants to avoid unnecessary byte swapping
Redefine various IPv4 address constants and testing macros to avoid
unnecessary byte swapping at runtime, and slightly rename the macros
to prevent code from accidentally using the old definitions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 13:48:29 +01:00
Michael Brown 9c185e2eac [netdevice] Avoid using zero as a network device index
Avoid using zero as a network device index, so that a zero
sin6_scope_id can be used to mean "unspecified" (rather than
unintentionally meaning "net0").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 13:48:29 +01:00
Michael Brown 41670ca2fe [ipv6] Treat a missing network device name as "netX"
When an IPv6 socket address string specifies a link-local or multicast
address but does not specify the requisite network device name
(e.g. "fe80::69ff:fe50:5845" rather than "fe80::69ff:fe50:5845%net0"),
assume the use of "netX".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-28 13:48:23 +01:00
Michael Brown fae7a5310a [build] Fix strict-aliasing warning on older gcc versions
Reported-by: James A. Peltier <jpeltier@sfu.ca>
Reported-by: Matthew Helton <mwhelton@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-27 23:28:01 +01:00
Michael Brown 657dd5f76d [crypto] Remove AXTLS headers
Remove AXTLS headers now that no AXTLS code remains, with many thanks
to the AXTLS project for use of their cryptography code over the past
several years.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-27 17:26:15 +01:00