ipxe.git
6 years ago[efi] Add USB headers and GUID definitions
Michael Brown [Thu, 3 Sep 2015 15:00:28 +0000 (16:00 +0100)] 
[efi] Add USB headers and GUID definitions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[usb] Add function to device's function list before attempting probe
Michael Brown [Sat, 5 Sep 2015 17:29:53 +0000 (18:29 +0100)] 
[usb] Add function to device's function list before attempting probe

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[usb] Expose usb_find_driver()
Michael Brown [Sat, 5 Sep 2015 14:53:56 +0000 (15:53 +0100)] 
[usb] Expose usb_find_driver()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Implement the EFI_PXE_BASE_CODE_PROTOCOL
Michael Brown [Tue, 1 Sep 2015 20:23:34 +0000 (21:23 +0100)] 
[efi] Implement the EFI_PXE_BASE_CODE_PROTOCOL

Many UEFI NBPs expect to find an EFI_PXE_BASE_CODE_PROTOCOL installed
in addition to the EFI_SIMPLE_NETWORK_PROTOCOL.  Most NBPs use the
EFI_PXE_BASE_CODE_PROTOCOL only to retrieve the cached DHCP packets.

This implementation has been tested with grub.efi, shim.efi,
syslinux.efi, and wdsmgfw.efi.  Some methods (such as Discover() and
Arp()) are not used by any known NBP and so have not (yet) been
implemented.

Usage notes for the tested bootstraps are:

  - grub.efi uses EFI_PXE_BASE_CODE_PROTOCOL only to retrieve the
    cached DHCP packet, and uses no other methods.

  - shim.efi uses EFI_PXE_BASE_CODE_PROTOCOL to retrieve the cached
    DHCP packet and to retrieve the next NBP via the Mtftp() method.
    If shim.efi was downloaded via HTTP (or other non-TFTP protocol)
    then shim.efi will blindly call Mtftp() with an HTTP URI as the
    filename: this allows the next NBP (e.g. grubx64.efi) to also be
    transparently retrieved by HTTP.

    shim.efi can also use the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL to
    retrieve files previously loaded by "imgfetch" or similar commands
    in iPXE.  The current implementation of shim.efi will use the
    EFI_SIMPLE_FILE_SYSTEM_PROTOCOL only if it does not find an
    EFI_PXE_BASE_CODE_PROTOCOL; this patch therefore prevents this
    usage of our EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.  This logic could be
    trivially reversed in shim.efi if needed.

  - syslinux.efi uses EFI_PXE_BASE_CODE_PROTOCOL only to retrieve the
    cached DHCP packet.  Versions 6.03 and earlier have a bug which
    may cause syslinux.efi to attach to the wrong NIC if there are
    multiple NICs in the system (or if the UEFI firmware supports
    IPv6).

  - wdsmgfw.efi (ab)uses EFI_PXE_BASE_CODE_PROTOCOL to retrieve the
    cached DHCP packets, and to send and retrieve UDP packets via the
    UdpWrite() and UdpRead() methods.  (This was presumably done in
    order to minimise the amount of benefit obtainable by switching to
    UEFI, by replicating all of the design mistakes present in the
    original PXE specification.)

The EFI_DOWNGRADE_UX configuration option remains available for now,
until this implementation has received more widespread testing.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[uri] Generalise tftp_uri() to pxe_uri()
Michael Brown [Wed, 26 Aug 2015 21:35:42 +0000 (22:35 +0100)] 
[uri] Generalise tftp_uri() to pxe_uri()

Merge the functionality of parse_next_server_and_filename() and
tftp_uri() into a single pxe_uri(), which takes a server address
(IPv4/IPv6/none) and a filename, and produces a URI using the rule:

 - if the filename is a hierarchical absolute URI (i.e. includes a
   scheme such as "http://" or "tftp://") then use that URI and ignore
   the server address,

 - otherwise, if the server address is recognised (according to
   sa_family) then construct a TFTP URI based on the server address,
   port, and filename

 - otherwise fail.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[pxe] Populate ciaddr in fake PXE Boot Server ACK packet
Michael Brown [Tue, 1 Sep 2015 15:52:27 +0000 (16:52 +0100)] 
[pxe] Populate ciaddr in fake PXE Boot Server ACK packet

We currently do not populate the ciaddr field in the constructed PXE
Boot Server ACK packet.  This causes a WDS server to respond with a
broadcast packet, which is then ignored by wdsmgfw.efi since it does
not match the specified IP address filter.

Fix by populating ciaddr within the constructed PXE Boot Server ACK
packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Do not return EFI_NOT_READY from our ReceiveFilters() method
Michael Brown [Tue, 1 Sep 2015 18:20:28 +0000 (19:20 +0100)] 
[efi] Do not return EFI_NOT_READY from our ReceiveFilters() method

Our SNP ReceiveFilters() method is a no-op, since we always (if
possible) use promiscuous mode for all network cards.  The method
currently returns EFI_NOT_READY if the SNP interfaces are claimed for
use by iPXE, as with all other SNP methods.

The WDS bootstrap wdsmgfw.efi attempts to use both the PXE Base Code
protocol and the Simple Network Protocol simultaneously.  This is
fundamentally broken, since use of the PXE Base Code protocol requires
us to disable the use of SNP (by claiming the interfaces for use by
iPXE), otherwise MnpDxe swallows all of the received packets before
our PXE Base Code's UdpRead() method is able to return them.

The root cause of this problem is that, as with BIOS PXE, the network
booting portions of the UEFI specification are less of a specification
and more of an application note sketchily describing how the original
hacked-together Intel implementation works.  No sane design would ever
have included the UdpWrite() and UdpRead() methods.

Work around these fundamental conceptual flaws by unconditionally
returning success from efi_snp_receive_filters().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Fix order of events on SNP removal path
Michael Brown [Tue, 1 Sep 2015 20:22:39 +0000 (21:22 +0100)] 
[efi] Fix order of events on SNP removal path

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Allow calls to efi_snp_claim() and efi_snp_release() to be nested
Michael Brown [Tue, 1 Sep 2015 15:19:08 +0000 (16:19 +0100)] 
[efi] Allow calls to efi_snp_claim() and efi_snp_release() to be nested

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[tcpip] Allow supported address families to be detected at runtime
Michael Brown [Tue, 1 Sep 2015 15:18:32 +0000 (16:18 +0100)] 
[tcpip] Allow supported address families to be detected at runtime

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[build] Search for ldlinux.c32 separately from isolinux.bin
Michael Brown [Tue, 1 Sep 2015 19:58:28 +0000 (20:58 +0100)] 
[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>
6 years ago[efi] Populate debug directory entry FileOffset field
Michael Brown [Tue, 1 Sep 2015 00:30:57 +0000 (01:30 +0100)] 
[efi] Populate debug directory entry FileOffset field

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Fix debug directory size
Michael Brown [Tue, 1 Sep 2015 00:29:23 +0000 (01:29 +0100)] 
[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>
6 years ago[efi] Add definitions of GUIDs observed when booting wdsmgfw.efi
Michael Brown [Sun, 30 Aug 2015 17:42:03 +0000 (18:42 +0100)] 
[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>
6 years ago[pxe] Construct all fake DHCP packets before starting PXE NBP
Michael Brown [Sat, 29 Aug 2015 15:49:54 +0000 (16:49 +0100)] 
[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>
6 years ago[efi] Improve efi_wrap debugging
Michael Brown [Thu, 27 Aug 2015 09:36:52 +0000 (10:36 +0100)] 
[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>
6 years ago[efi] Include installed protocol list in unknown handle names
Michael Brown [Thu, 27 Aug 2015 14:37:46 +0000 (15:37 +0100)] 
[efi] Include installed protocol list in unknown handle names

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Remove raw EFI_HANDLE values from debug messages
Michael Brown [Thu, 27 Aug 2015 09:08:00 +0000 (10:08 +0100)] 
[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>
6 years ago[efi] Mark EFI debug transcription functions as __attribute__ (( pure ))
Michael Brown [Thu, 27 Aug 2015 00:40:40 +0000 (01:40 +0100)] 
[efi] Mark EFI debug transcription functions as __attribute__ (( pure ))

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Add definitions of GUIDs observed when booting shim.efi and grub.efi
Michael Brown [Thu, 27 Aug 2015 00:28:37 +0000 (01:28 +0100)] 
[efi] Add definitions of GUIDs observed when booting shim.efi and grub.efi

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[dhcp] Do not skip ProxyDHCPREQUEST if next-server is empty
Michael Brown [Wed, 26 Aug 2015 15:02:46 +0000 (16:02 +0100)] 
[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>
6 years ago[settings] Re-add "uristring" setting type
Michael Brown [Tue, 25 Aug 2015 11:33:40 +0000 (12:33 +0100)] 
[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>
6 years ago[autoboot] Display image information as part of the default control flow
Michael Brown [Fri, 21 Aug 2015 15:28:33 +0000 (16:28 +0100)] 
[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>
6 years ago[image] Detect image type when image is first registered
Michael Brown [Fri, 21 Aug 2015 15:15:24 +0000 (16:15 +0100)] 
[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>
6 years ago[test] Allow self-tests to report exit status when running under Linux
Michael Brown [Fri, 21 Aug 2015 14:41:35 +0000 (15:41 +0100)] 
[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>
6 years ago[pxe] Warn about PXE NBPs that may be EFI executables
Michael Brown [Fri, 21 Aug 2015 14:04:31 +0000 (15:04 +0100)] 
[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>
6 years ago[dhcp] Ignore ProxyDHCPACKs without PXE options
Michael Brown [Tue, 18 Aug 2015 16:18:38 +0000 (17:18 +0100)] 
[dhcp] Ignore ProxyDHCPACKs without PXE options

Suggested-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[dhcp] Allow pseudo-DHCP servers to use pseudo-identifiers
Michael Brown [Tue, 18 Aug 2015 14:43:06 +0000 (15:43 +0100)] 
[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>
6 years ago[efi] Work around bugs in Emulex NII driver
Fabrice Bacchella [Thu, 13 Aug 2015 10:44:21 +0000 (12:44 +0200)] 
[efi] Work around bugs in Emulex NII driver

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Improve NII driver logging
Fabrice Bacchella [Wed, 12 Aug 2015 10:17:04 +0000 (12:17 +0200)] 
[efi] Improve NII driver logging

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[ipoib] Fix a race when chain-loading undionly.kpxe in IPoIB
Wissam Shoukair [Wed, 12 Aug 2015 09:28:58 +0000 (12:28 +0300)] 
[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>
6 years ago[peerdist] Add support for PeerDist (aka BranchCache) HTTP content encoding
Michael Brown [Mon, 17 Aug 2015 12:16:45 +0000 (13:16 +0100)] 
[peerdist] Add support for PeerDist (aka BranchCache) HTTP content encoding

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[peerdist] Add block download multiplexer
Michael Brown [Mon, 17 Aug 2015 12:16:40 +0000 (13:16 +0100)] 
[peerdist] Add block download multiplexer

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[peerdist] Add individual block download mechanism
Michael Brown [Mon, 17 Aug 2015 12:16:37 +0000 (13:16 +0100)] 
[peerdist] Add individual block download mechanism

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[peerdist] Add segment discovery mechanism
Michael Brown [Mon, 17 Aug 2015 12:16:33 +0000 (13:16 +0100)] 
[peerdist] Add segment discovery mechanism

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[http] Rewrite HTTP core to support content encodings
Michael Brown [Mon, 17 Aug 2015 12:16:26 +0000 (13:16 +0100)] 
[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>
6 years ago[block] Add generic block device translator
Michael Brown [Tue, 4 Aug 2015 14:33:11 +0000 (15:33 +0100)] 
[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>
6 years ago[prefix] Use correct register for KEEP_IT_REAL physical address conversion
Daniel Pieczko [Wed, 12 Aug 2015 10:45:58 +0000 (11:45 +0100)] 
[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>
6 years ago[efi] Add missing "ULL" suffix on 64-bit constant
Michael Brown [Mon, 3 Aug 2015 12:05:21 +0000 (13:05 +0100)] 
[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>
6 years ago[efi] Hold off watchdog timer while running
Michael Brown [Mon, 3 Aug 2015 11:39:05 +0000 (12:39 +0100)] 
[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>
6 years ago[crypto] Support SHA-{224,384,512} in X.509 certificates
Michael Brown [Sun, 2 Aug 2015 15:54:24 +0000 (16:54 +0100)] 
[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>
6 years ago[crypto] Add ASN.1 OIDs for sha{224,384,512}WithRsaEncryption
Tufan Karadere [Sun, 2 Aug 2015 15:38:19 +0000 (16:38 +0100)] 
[crypto] Add ASN.1 OIDs for sha{224,384,512}WithRsaEncryption

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[tls] Report supported signature algorithms in ClientHello
Michael Brown [Sun, 2 Aug 2015 13:08:38 +0000 (14:08 +0100)] 
[tls] Report supported signature algorithms in ClientHello

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[tls] Do not access beyond the end of a 24-bit integer
Michael Brown [Fri, 31 Jul 2015 22:47:50 +0000 (23:47 +0100)] 
[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>
6 years ago[serial] Check for UART existence in uart_select()
Michael Brown [Fri, 31 Jul 2015 10:19:19 +0000 (11:19 +0100)] 
[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>
6 years ago[comboot] Avoid dragging in serial console support unconditionally
Michael Brown [Fri, 31 Jul 2015 09:46:15 +0000 (10:46 +0100)] 
[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>
6 years ago[elf] Reject ELFBoot images requiring virtual addressing
Michael Brown [Wed, 29 Jul 2015 13:09:34 +0000 (14:09 +0100)] 
[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>
6 years ago[linebuf] Support buffering of multiple lines
Michael Brown [Tue, 28 Jul 2015 15:59:11 +0000 (16:59 +0100)] 
[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>
6 years ago[pool] Add a generic concept of a pooled connection
Michael Brown [Tue, 28 Jul 2015 15:23:28 +0000 (16:23 +0100)] 
[pool] Add a generic concept of a pooled connection

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[peerdist] Add support for constructing and decoding retrieval messages
Michael Brown [Tue, 28 Jul 2015 14:59:43 +0000 (15:59 +0100)] 
[peerdist] Add support for constructing and decoding retrieval messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[peerdist] Add support for constructing and decoding discovery messages
Michael Brown [Tue, 28 Jul 2015 14:56:23 +0000 (15:56 +0100)] 
[peerdist] Add support for constructing and decoding discovery messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[peerdist] Include trimmed range within content information block
Michael Brown [Mon, 20 Jul 2015 17:17:53 +0000 (18:17 +0100)] 
[peerdist] Include trimmed range within content information block

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[netdevice] Allow network devices to disclaim IRQ support at runtime
Michael Brown [Tue, 28 Jul 2015 14:05:44 +0000 (15:05 +0100)] 
[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>
6 years ago[iscsi] Add missing "break" statements
Michael Brown [Tue, 28 Jul 2015 13:11:35 +0000 (14:11 +0100)] 
[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>
6 years ago[ipv4] Allow IPv4 socket addresses to include a scope ID
Michael Brown [Tue, 21 Jul 2015 13:54:11 +0000 (14:54 +0100)] 
[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>
6 years ago[ipv4] Redefine IP address constants to avoid unnecessary byte swapping
Michael Brown [Tue, 21 Jul 2015 14:26:52 +0000 (15:26 +0100)] 
[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>
6 years ago[netdevice] Avoid using zero as a network device index
Michael Brown [Tue, 21 Jul 2015 13:51:16 +0000 (14:51 +0100)] 
[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>
6 years ago[ipv6] Treat a missing network device name as "netX"
Michael Brown [Tue, 28 Jul 2015 12:00:15 +0000 (13:00 +0100)] 
[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>
6 years ago[build] Fix strict-aliasing warning on older gcc versions
Michael Brown [Mon, 27 Jul 2015 22:28:01 +0000 (23:28 +0100)] 
[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>
6 years ago[crypto] Remove AXTLS headers
Michael Brown [Mon, 27 Jul 2015 14:06:20 +0000 (15:06 +0100)] 
[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>
6 years ago[test] Add NIST self-tests for AES192 in ECB and CBC modes
Michael Brown [Sat, 25 Jul 2015 13:54:57 +0000 (14:54 +0100)] 
[test] Add NIST self-tests for AES192 in ECB and CBC modes

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[crypto] Replace AES implementation
Michael Brown [Fri, 24 Jul 2015 23:16:32 +0000 (00:16 +0100)] 
[crypto] Replace AES implementation

Replace the AES implementation from AXTLS with a dedicated iPXE
implementation which is slightly smaller and around 1000% faster.
This implementation has been verified using the existing self-tests
based on the NIST AES test vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[test] Add NIST self-tests for AES128 and AES256 in ECB mode
Michael Brown [Mon, 27 Jul 2015 13:53:32 +0000 (14:53 +0100)] 
[test] Add NIST self-tests for AES128 and AES256 in ECB mode

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[test] Define shortcuts for frequently-used NIST AES test vectors
Michael Brown [Mon, 27 Jul 2015 13:24:55 +0000 (14:24 +0100)] 
[test] Define shortcuts for frequently-used NIST AES test vectors

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[test] Generalise cipher tests and use okx()
Michael Brown [Mon, 27 Jul 2015 13:00:57 +0000 (14:00 +0100)] 
[test] Generalise cipher tests and use okx()

Generalise the existing support for performing CBC-mode block cipher
tests, and update the code to use okx() for neater reporting of test
results.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[crypto] Add ECB block cipher mode (for debug and self-tests only)
Michael Brown [Mon, 27 Jul 2015 01:48:49 +0000 (02:48 +0100)] 
[crypto] Add ECB block cipher mode (for debug and self-tests only)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[802.11] Use correct SHA1_DIGEST_SIZE constant name
Michael Brown [Sat, 25 Jul 2015 13:42:06 +0000 (14:42 +0100)] 
[802.11] Use correct SHA1_DIGEST_SIZE constant name

The constant SHA1_SIZE is defined only as part of the imported AXTLS code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[crypto] Add bit-rotation functions for 8-bit and 16-bit values
Michael Brown [Sat, 25 Jul 2015 13:41:30 +0000 (14:41 +0100)] 
[crypto] Add bit-rotation functions for 8-bit and 16-bit values

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[build] Fix compiler warnings on some gcc versions
Michael Brown [Mon, 27 Jul 2015 14:15:12 +0000 (15:15 +0100)] 
[build] Fix compiler warnings on some gcc versions

xfer_buffer() uses intf_get_dest_op() to obtain the destination
interface for xfer_deliver(), in order to check that this is the same
interface which provides xfer_buffer().  The return value from
intf_get_dest_op() (which contains the actual method implementing
xfer_deliver()) is not used.

On some gcc versions, this triggers a "value computed is not used"
warning, since the explicit type cast included within the
intf_get_dest_op() macro is treated as a "value computed".

Fix by explicitly casting the result of intf_get_dest_op() to void.

Reported-by: Matthew Helton <mwhelton@gmail.com>
Reported-by: James A. Peltier <jpeltier@sfu.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[downloader] Provide direct access to the underlying data transfer buffer
Michael Brown [Mon, 20 Jul 2015 11:17:13 +0000 (12:17 +0100)] 
[downloader] Provide direct access to the underlying data transfer buffer

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[downloader] Use generic data-transfer buffer mechanism
Michael Brown [Wed, 15 Jul 2015 12:55:56 +0000 (13:55 +0100)] 
[downloader] Use generic data-transfer buffer mechanism

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[xferbuf] Add xfer_buffer() to provide direct access to underlying buffer
Michael Brown [Mon, 20 Jul 2015 11:15:21 +0000 (12:15 +0100)] 
[xferbuf] Add xfer_buffer() to provide direct access to underlying buffer

Allow data transfer buffer users to provide direct access to their
underlying data transfer buffer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[xferbuf] Generalise to handle umalloc()-based buffers
Michael Brown [Wed, 15 Jul 2015 12:43:58 +0000 (13:43 +0100)] 
[xferbuf] Generalise to handle umalloc()-based buffers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[xfer] Add xfer_check_order() utility function
Michael Brown [Mon, 20 Jul 2015 16:53:30 +0000 (17:53 +0100)] 
[xfer] Add xfer_check_order() utility function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[xfer] Use intf_poke() to implement xfer_window_changed()
Michael Brown [Wed, 8 Jul 2015 15:25:44 +0000 (16:25 +0100)] 
[xfer] Use intf_poke() to implement xfer_window_changed()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[interface] Add intf_poke() helper
Michael Brown [Wed, 8 Jul 2015 15:24:11 +0000 (16:24 +0100)] 
[interface] Add intf_poke() helper

Reduce the cost of implementing object methods which convey no
information beyond the fact that the method has been called.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[profile] Add profile_custom() for profiling with arbitrary time units
Michael Brown [Tue, 21 Jul 2015 21:26:48 +0000 (22:26 +0100)] 
[profile] Add profile_custom() for profiling with arbitrary time units

Provide profile_custom() as a trivial wrapper around profile_update()
to allow for the use of the profiling infrastructure by code using
timers other than the default profile_timestamp() provider.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[fault] Add inject_corruption() to randomly corrupt data
Michael Brown [Wed, 22 Jul 2015 13:29:20 +0000 (14:29 +0100)] 
[fault] Add inject_corruption() to randomly corrupt data

Provide an inject_corruption() function that can be used to randomly
corrupt data bytes with configurable probabilities.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[fault] Generalise NETDEV_DISCARD_RATE fault injection mechanism
Michael Brown [Wed, 22 Jul 2015 01:56:49 +0000 (02:56 +0100)] 
[fault] Generalise NETDEV_DISCARD_RATE fault injection mechanism

Provide a generic inject_fault() function that can be used to inject
random faults with configurable probabilities.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[tcp] Ensure FIN is actually sent if connection is closed while idle
Michael Brown [Sat, 18 Jul 2015 09:57:51 +0000 (10:57 +0100)] 
[tcp] Ensure FIN is actually sent if connection is closed while idle

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[build] Add named configuration for qemu
Michael Brown [Wed, 22 Jul 2015 19:55:44 +0000 (20:55 +0100)] 
[build] Add named configuration for qemu

Add a named configuration for qemu, based on the config.ipxe.general.h
file taken from the current qemu repository and enabling the option to
work around the missing EFI_PXE_BASE_CODE_PROTOCOL.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Allow user experience to be downgraded
Michael Brown [Wed, 22 Jul 2015 19:25:17 +0000 (20:25 +0100)] 
[efi] Allow user experience to be downgraded

iPXE does not currently provide EFI_PXE_BASE_CODE_PROTOCOL: this
causes failures when chainloading bootloaders such as shim.efi which
assume that this protocol will be present.

Provide the ability to work around these problems via the build
configuration option EFI_DOWNGRADE_UX.  If this option is enabled,
then we will not install our usual EFI_LOAD_FILE_PROTOCOL
implementation, thereby allowing the platform firmware to install its
own EFI_PXE_BASE_CODE_PROTOCOL implementation on top of our
EFI_SIMPLE_NETWORK_PROTOCOL handle.

A somewhat major side-effect of this workaround is that almost all
iPXE features will be disabled.

This configuration option will be removed in future when support for
EFI_PXE_BASE_CODE_PROTOCOL is added.

Requested-by: Laszlo Ersek <lersek@redhat.com>
Requested-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[efi] Fix receive and transmit completion reporting
Michael Brown [Wed, 22 Jul 2015 17:31:45 +0000 (18:31 +0100)] 
[efi] Fix receive and transmit completion reporting

Fix the TxBuf value filled in by GetStatus() to report the transmit
buffer address as required by the (now clarified) specification.

Simplify "interrupt" handling in GetStatus() to report only that one
or more packets have been transmitted or received; there is no need to
report one GetStatus() "interrupt" per packet.

Simplify receive handling to dequeue received packets immediately from
the network device into an internal list (thereby avoiding the hacks
previously used to determine when to report new packet arrivals).

Originally-fixed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[bios] Add ANSI blink attribute
Christian Nilsson [Sat, 25 Apr 2015 23:18:37 +0000 (01:18 +0200)] 
[bios] Add ANSI blink attribute

Expose the high bit of the VGA text attribute byte via the ANSI SGR
parameters 5 ("blink on") and 25 ("blink off").

Note that some video cards (and virtual machines) may display a high
intensity background colour instead of blinking text.

Signed-off-by: Christian Nilsson <nikize@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[tg3] Add support for BCM57766
Bernd Wiebelt [Mon, 6 Jul 2015 13:27:48 +0000 (14:27 +0100)] 
[tg3] Add support for BCM57766

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[ipoib] Transmit multicast packets as broadcasts
Michael Brown [Mon, 6 Jul 2015 12:06:55 +0000 (13:06 +0100)] 
[ipoib] Transmit multicast packets as broadcasts

Multicast MAC addresses will never have REMAC cache entries, and the
corresponding multicast IPoIB MAC address cannot be obtained simply by
issuing an ARP request.

For the trivial volume of multicast packets that we expect to send in
any realistic scenario, the simplest solution is to send them as
broadcasts instead.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[tcp] Gracefully close connections during shutdown
Michael Brown [Sat, 4 Jul 2015 11:40:04 +0000 (12:40 +0100)] 
[tcp] Gracefully close connections during shutdown

We currently do not wait for a received FIN before exiting to boot a
loaded OS.  In the common case of booting from an HTTP server, this
means that the TCP connection is left consuming resources on the
server side: the server will retransmit the FIN several times before
giving up.

Fix by initiating a graceful close of all TCP connections and waiting
(for up to one second) for all connections to finish closing
gracefully (i.e. for the outgoing FIN to have been sent and ACKed, and
for the incoming FIN to have been received and ACKed at least once).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[xen] Wait for and clear XenStore event before receiving data
Michael Brown [Tue, 30 Jun 2015 16:06:58 +0000 (17:06 +0100)] 
[xen] Wait for and clear XenStore event before receiving data

Older, out-of-tree Xen kernel modules (such as those provided with
SuSE Linux Enterprise Server 11) do not clear the leftover "event
pending" bit when opening an event channel.  Consequently, no event is
ever delivered to indicate that there is information in the XenStore
ring buffer, and the system hangs shortly after loading the
xen-platform-pci kernel module.

Work around this problem by always waiting for the XenStore event
channel to be signalled, and clearing the event before processing the
received data.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[gdb] Allow gdbstub to be started on an arbitrary serial port
Michael Brown [Mon, 29 Jun 2015 15:43:39 +0000 (16:43 +0100)] 
[gdb] Allow gdbstub to be started on an arbitrary serial port

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[ipoib] Attempt to generate ARPs as needed to repopulate REMAC cache
Michael Brown [Mon, 29 Jun 2015 13:50:16 +0000 (14:50 +0100)] 
[ipoib] Attempt to generate ARPs as needed to repopulate REMAC cache

The only way to map an eIPoIB MAC address (REMAC) to an IPoIB MAC
address is to intercept an incoming ARP request or reply.

If we do not have an REMAC cache entry for a particular destination
MAC address, then we cannot transmit the packet.  This can arise in at
least two situations:

 - An external program (e.g. a PXE NBP using the UNDI API) may attempt
   to transmit to a destination MAC address that has been obtained by
   some method other than ARP.

 - Memory pressure may have caused REMAC cache entries to be
   discarded.  This is fairly likely on a busy network, since REMAC
   cache entries are created for all received (broadcast) ARP
   requests.  (We can't sensibly avoid creating these cache entries,
   since they are required in order to send an ARP reply, and when we
   are being used via the UNDI API we may have no knowledge of which
   IP addresses are "ours".)

Attempt to ameliorate the situation by generating a semi-spurious ARP
request whenever we find a missing REMAC cache entry.  This will
hopefully trigger an ARP reply, which would then provide us with the
information required to populate the REMAC cache.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[ipoib] Mark REMAC cache as expensive
Michael Brown [Mon, 29 Jun 2015 13:12:43 +0000 (14:12 +0100)] 
[ipoib] Mark REMAC cache as expensive

As with the neighbour cache, discarding an REMAC cache entry is
potentially very disruptive.

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[comboot] Implement INT22,0x000c
Wissam Shoukair [Mon, 29 Jun 2015 11:42:51 +0000 (12:42 +0100)] 
[comboot] Implement INT22,0x000c

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[serial] Use new UART abstraction in serial console driver
Michael Brown [Mon, 29 Jun 2015 07:43:16 +0000 (08:43 +0100)] 
[serial] Use new UART abstraction in serial console driver

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[gdb] Use new UART abstraction in GDB serial transport
Michael Brown [Mon, 29 Jun 2015 09:07:56 +0000 (10:07 +0100)] 
[gdb] Use new UART abstraction in GDB serial transport

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[serial] Add general abstraction of a 16550-compatible UART
Michael Brown [Mon, 29 Jun 2015 07:39:58 +0000 (08:39 +0100)] 
[serial] Add general abstraction of a 16550-compatible UART

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[pxe] Always reconstruct packet for PXENV_GET_CACHED_INFO
Michael Brown [Mon, 29 Jun 2015 08:58:16 +0000 (09:58 +0100)] 
[pxe] Always reconstruct packet for PXENV_GET_CACHED_INFO

Avoid accidentally returning stale packets (e.g. for a previously
attempted network device) by always constructing a fresh DHCP packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[dhcp] Defer discovery if link is blocked
Michael Brown [Thu, 25 Jun 2015 16:30:49 +0000 (17:30 +0100)] 
[dhcp] Defer discovery if link is blocked

If the link is blocked (e.g. due to a Spanning Tree Protocol port not
yet forwarding packets) then defer DHCP discovery until the link
becomes unblocked.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[stp] Fix interpretaton of hello time
Michael Brown [Thu, 25 Jun 2015 16:30:12 +0000 (17:30 +0100)] 
[stp] Fix interpretaton of hello time

Times in STP packets are expressed in units of 1/256 of a second.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[stp] Add support for detecting Spanning Tree Protocol non-forwarding ports
Michael Brown [Thu, 25 Jun 2015 09:04:42 +0000 (10:04 +0100)] 
[stp] Add support for detecting Spanning Tree Protocol non-forwarding ports

A fairly common end-user problem is that the default configuration of
a switch may leave the port in a non-forwarding state for a
substantial length of time (tens of seconds) after link up.  This can
cause iPXE to time out and give up attempting to boot.

We cannot force the switch to start forwarding packets sooner, since
any attempt to send a Spanning Tree Protocol bridge PDU may cause the
switch to disable our port (if the switch happens to have the Bridge
PDU Guard feature enabled for the port).

For non-ancient versions of the Spanning Tree Protocol, we can detect
whether or not the port is currently forwarding and use this to inform
the network device core that the link is currently blocked.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 years ago[netdevice] Add a generic concept of a "blocked link"
Michael Brown [Thu, 25 Jun 2015 15:41:39 +0000 (16:41 +0100)] 
[netdevice] Add a generic concept of a "blocked link"

When Spanning Tree Protocol (STP) is used, there may be a substantial
delay (tens of seconds) from the time that the link goes up to the
time that the port starts forwarding packets.

Add a generic concept of a "blocked link" (i.e. a link which is up but
which is not expected to communicate successfully), and allow "ifstat"
to indicate when a link is blocked.

Signed-off-by: Michael Brown <mcb30@ipxe.org>