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

4981 Commits

Author SHA1 Message Date
Michael Brown 87b59677ba [realtek] Add ability to dump all internal registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-20 12:36:14 +00:00
Michael Brown f473b9c3f6 [efi] Disable SNP devices when running iPXE as the application
Some UEFI builds will set up a timer to continuously poll any SNP
devices.  This can drain packets from the network device's receive
queue before iPXE gets a chance to process them.

Use netdev_rx_[un]freeze() to explicitly indicate when we expect our
network devices to be driven via the external SNP API (as we do with
the UNDI API on the standard BIOS build), and disable the SNP API
except when receive queue processing is frozen.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14 17:09:51 +00:00
Michael Brown f618178e60 [efi] Unload our own image before exiting UEFI application
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14 16:20:55 +00:00
Michael Brown e662912c53 [efi] Avoid accidentally calling main() twice
EFIRC() uses PLATFORM_TO_ERRNO(), which evaluates its argument twice
(and can't trivially use a braced-group expression or an inline
function to avoid this, since it gets used outside of function
context).

The expression "EFIRC(main())" will therefore end up calling main()
twice, which is not the intended behaviour.  Every other instance of
EFIRC() is of the simple form "EFIRC(rc)", so fix by converting this
instance to match.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14 16:20:55 +00:00
Michael Brown 87465258ab [netdevice] Notify upper-layer drivers when RX processing is (un)frozen
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14 14:05:38 +00:00
Michael Brown 24bbaf6a38 [lotest] Allow loopback testing on shared networks
Allow for extraneous packets to be received during loopback testing,
and so permit loopback tests to be performed when ports are connected
to a switch (rather than requiring ports to be directly connected with
a loopback cable).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-13 23:35:18 +00:00
Michael Brown a17ee3610d [console] Fix display of characters with top bit set
Inhibit implicit sign-padding of characters with the top bit set
(e.g. accented characters), which confuses the mucurses library by
colliding with the bits used to store character attributes and
colours.

Reported-by: Marc Delisle <Marc.Delisle@cegepsherbrooke.qc.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-13 14:21:59 +00:00
Michael Brown 2602965806 [efi] Connect driver to devices as part of installation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-12 15:34:44 +00:00
Michael Brown 8de6b973c4 [efi] Allow driver to be unloaded
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 16:39:46 +00:00
Michael Brown 9681170fbe [efi] Allow for 64-bit EFI_STATUS codes
On a 64-bit build, EFI_STATUS codes are 64-bit quantities, with the
"error/warning" bit located in bit 63.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 16:39:46 +00:00
Michael Brown 3f43c1354e [image] Add "--timeout" parameter to image downloading commands
iPXE will detect timeout failures in several situations: network
link-up, DHCP, TCP connection attempts, unacknowledged TCP data, etc.
This does not cover all possible circumstances.  For example, if a
connection to a web server is successfully established and the web
server acknowledges the HTTP request but never sends any data in
response, then no timeout will be triggered.  There is no timeout
defined within the HTTP specifications, and the underlying TCP
connection will not generate a timeout since it has no way to know
that the HTTP layer is expecting to receive data from the server.

Add a "--timeout" parameter to "imgfetch", "chain", etc.  If no
progress is made (i.e. no data is downloaded) within the timeout
period, then the download will be aborted.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 13:32:39 +00:00
Michael Brown b850a6be28 [monojob] Reset timeout when progress is made
Redefine the timeout parameter from "time since start of job" to "time
since progress was last made".  This does not affect any existing
behaviour, since all existing users of the timeout parameter do not
provide progress indication.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 13:16:18 +00:00
Michael Brown 145fc26ed5 [realtek] Dump all MII register contents when link status changes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 12:22:23 +00:00
Michael Brown 9d615539f0 [mii] Add mii_dump() to dump all MII registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 12:21:54 +00:00
Michael Brown 42bf3b9aa9 [http] Automatically retry request on a 503 Service Unavailable
A web server may return a 503 Service Unavailable response along with
a Retry-After header to direct the client to retry the request at a
later time.

The Retry-After header may be a number of seconds, or a full HTTP
timestamp (e.g. "Fri, 7 Mar 2014 17:22:14 GMT").  We have no
reasonable way of parsing a full HTTP timestamp; if the server chooses
to use this format then we simply retry after a fixed 5-second delay.

As per RFC 2616, in the absence of a Retry-After header we treat a
status code of 503 Service Unavailable as being equivalent to 500
Internal Server Error, and immediately fail the request.

Requested-by: Suresh Sundriyal <ssundriy@vmware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-07 17:32:26 +00:00
Michael Brown 0d657b8e94 [http] Use a retry timer to trigger retried requests
Use a retry timer to allow for the possibility of deferring a retried
request.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-07 17:32:22 +00:00
Michael Brown 08f9170ba4 [linux] Avoid starting currticks() from zero every time
iPXE uses currticks() (along with the MAC address(es) of any network
devices) to seed the (non-cryptographic) random number generator.  The
current implementation of linux_currticks() ensures that the first
call to currticks() will always return zero; this results in identical
random number sequences on each run of iPXE on a given machine.  This
can cause odd-looking behaviour due to e.g. the reuse of local TCP
port numbers.

Fix by effectively rounding down the start time recorded by
linux_currticks() to the nearest whole second; this makes it unlikely
that consecutive runs of iPXE will use the exact same RNG sequence.

(Note that none of this affects the cryptographic RNG, which uses
/dev/random as a source of entropy.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-07 17:30:05 +00:00
Michael Brown 859664ea2a [tcp] Update window even if ACK does not acknowledge new data
iPXE currently ignores ACKs which do not acknowledge any new data.
(In particular, it does not stop the retransmission timer; this is
done to prevent an immediate retransmission if a duplicate ACK is
received while the transmit queue is non-empty.)

If a peer provides a window size of zero and later sends a duplicate
ACK to update the window size, this update will therefore be ignored
and iPXE will never be able to transmit data.

Fix by updating the window size even for ACKs which do not acknowledge
new data.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-07 17:30:01 +00:00
Michael Brown f17a30d547 [netdevice] Mark devices as open before calling open() method
When opening a VLAN device, vlan_open() will call netdev_open() on the
trunk device.  This will result in a call to netdev_notify(), which
will cause vlan_notify() to call vlan_sync() on the original VLAN
device, which will see that the trunk device is now open but the VLAN
device apparently isn't (since it has not yet been flagged as open by
netdev_open()).  The upshot is a second attempt to open the VLAN
device, which will result in an erroneous second call to vlan_open().
This convoluted chain of events then terminates harmlessly since
vlan_open() calls netdev_open() on the trunk device, which just
returns immediately since the trunk device is by now flagged as being
already open.

Prevent this from happening by having netdev_open() flag the device as
open prior to calling the device's open() method, and reflagging it as
closed if the open() method fails.

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-05 15:25:08 +00:00
Michael Brown 1137fa3268 [romprefix] Do not clobber stack segment when returning to BIOS
Commit c429bf0 ("[romprefix] Store boot bus:dev.fn address as autoboot
device location") introduced a regression by using register %cx to
temporarily hold the PCI bus:dev.fn address, despite the fact that %cx
was already being used to hold the stored BIOS stack segment.
Consequently, when returning to the BIOS after a failed or cancelled
boot attempt, iPXE would end up calling INT 18 with the stack segment
set equal to the PCI bus:dev.fn address.  Writing to essentially
random areas of memory tends to upset even the more robust BIOSes.

Fix by using register %ax to temporarily hold the PCI bus:dev.fn
address.

Reported-by: Anton D. Kachalov <mouse@yandex-team.ru>
Tested-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-05 12:32:00 +00:00
Michael Brown ac5c2e851b [realtek] Include link status register details in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04 16:30:06 +00:00
Michael Brown 0fac055119 [bzimage] Report exact initrd length via bzImage header
iPXE currently pads initrd images to a multiple of 4kB and inserts
zero padding between images, as required by some versions of the Linux
kernel.  The overall length reported via the ramdisk_size field in the
bzImage header includes this zero padding.

This causes problems when using memdisk to load a gzip-compressed disk
image.  memdisk treats the ramdisk_size field as containing the exact
length of the initrd image, and uses this length to locate the 8-byte
gzip footer.  This will generally cause memdisk to fail to decompress
the disk image.

Fix by reporting the exact length of the initrd image set, including
any padding inserted between images but excluding any padding added at
the end of the final image.

Reported-by: Levente LEVAI <levail@aviatronic.hu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04 14:38:16 +00:00
Michael Brown e191298a1d [tcp] Calculate correct MSS from peer address
iPXE currently advertises a fixed MSS of 1460, which is correct only
for IPv4 over Ethernet.  For IPv6 over Ethernet, the value should be
1440 (allowing for the larger IPv6 header).  For non-Ethernet link
layers, the value should reflect the MTU of the underlying network
device.

Use tcpip_mtu() to calculate the transport-layer MTU associated with
the peer address, and calculate the MSS to allow for an optionless TCP
header as per RFC 6691.

As a side benefit, we can now fail a connection immediately with a
meaningful error message if we have no route to the destination
address.

Reported-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04 13:23:29 +00:00
Michael Brown 6414b5ca03 [tcpip] Provide tcpip_mtu() to determine the maximum transmission unit
Provide the function tcpip_mtu() to allow external code to determine
the (transport-layer) maximum transmission unit for a given socket
address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04 13:13:54 +00:00
Michael Brown db67de6f31 [tcpip] Provide tcpip_netdev() to determine the transmitting network device
Provide the function tcpip_netdev() to allow external code to
determine the transmitting network device for a given socket address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04 13:02:58 +00:00
Michael Brown ff1e7fc72b [prefix] Ignore PCI autoboot device location if set to 00:00.0
qemu can load an option ROM which is not associated with a particular
PCI device using the "-option-rom" syntax.  Under these circumstances,
we should ignore the PCI bus:dev.fn address that we expect to find in
%ax on entry to the initialisation vector.

Fix by using the PCI bus:dev.fn address only if it is non-zero.  Since
00:00.0 will always be the host bridge, it can never be the address of
a network card.

Reported-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-03 16:28:43 +00:00
Alex Williamson c429bf0aa2 [romprefix] Store boot bus:dev.fn address as autoboot device location
Per the BIOS Boot Specification, the initialization phase of the ROM
is called with the PFA (PCI Function Address) in the %ax register.
The intention is that the ROM code will store that device address
somewhere and use it for booting from that device when the Boot Entry
Vector (BEV) is called.  iPXE does store the PFA, but doesn't use it
to select the boot network device.  This renders BIOS IPL lists fairly
ineffective.

Fix by using the BBS-specified bus:dev.fn address as the autoboot
device location.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-03 15:35:08 +00:00
Alex Williamson 90fc273b2b [prefix] Allow prefix to specify a PCI autoboot device location
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-03 15:34:17 +00:00
Alex Williamson 123bae9d93 [autoboot] Enable infrastructure to specify an autoboot device location
iPXE will currently attempt to boot from every network device for
which it has a driver.  Where a system has more than one network
device supported by iPXE, this renders BIOS IPL lists ineffective.

Allow an autoboot device location to be specified.  If such a location
is specified, then only devices matching that location will be used as
part of the automatic boot sequence.  If no such location is
specified, then all devices will be used.

Note that this does not affect the "autoboot" command, which will
continue to use all devices.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-03 15:11:03 +00:00
Alex Williamson 27d1b40ee9 [romprefix] Allow ROM banner timeout to be configured independently
iPXE currently prints a "Press Ctrl-B" banner twice: once when the ROM
is first called for initialisation and again if we attempt to boot
from the ROM.  This slows boot, especially when the NIC is not the
primary boot device.  Tools such as libguestfs make use of QEMU VMs
for performing maintenance on disk images and may make use of NICs in
the VM for network support.  If iPXE introduces a static init-time
delay, that directly translates to increased runtime for the tools.

Fix by allowing the ROM banner timeout to be configured independently
of the main banner timeout.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-03 13:09:25 +00:00
Michael Brown f22c19f3fb [cmdline] Add the "ipstat" command
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-02 23:57:47 +00:00
Michael Brown 11963c4f5f [tcpip] Add IP statistics collection as per RFC 4293
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-02 20:33:35 +00:00
Michael Brown c165e8d1fc [image] Ensure every image has a fully resolved URI
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-27 13:32:58 +00:00
Michael Brown 7667536527 [uri] Refactor URI parsing and formatting
Add support for parsing of URIs containing literal IPv6 addresses
(e.g. "http://[fe80::69ff:fe50:5845%25net0]/boot.ipxe").

Duplicate URIs by directly copying the relevant fields, rather than by
formatting and reparsing a URI string.  This relaxes the requirements
on the URI formatting code and allows it to focus on generating
human-readable URIs (e.g. by not escaping ':' characters within
literal IPv6 addresses).  As a side-effect, this allows relative URIs
containing parameter lists (e.g. "../boot.php##params") to function
as expected.

Add validity check for FTP paths to ensure that only printable
characters are accepted (since FTP is a human-readable line-based
protocol with no support for character escaping).

Construct TFTP next-server+filename URIs directly, rather than parsing
a constructed "tftp://..." string,

Add self-tests for URI functions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-27 13:32:53 +00:00
Michael Brown c7b69ac793 [params] Use reference counters for form parameter lists
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-26 23:34:07 +00:00
Michael Brown 09b057ce84 [settings] Remove "uristring" setting type
Commit b5f5f73 ("[cmdline] Expand settings within each command-line
token individually") effectively rendered the "uristring" setting type
obsolete, since strings containing whitespace no longer break the
command line parser.  The concept of the "uristring" type is not well
defined, since URI escaping rules depend on which portion of a URI is
being escaped.

Remove the "uristring" type, converting it into an alias for the
"string" setting type so as to avoid breaking existing scripts.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-26 23:34:07 +00:00
Michael Brown ced4f8d1d3 [dhcp] Copy exactly the required length when resizing DHCP options
When resizing DHCP options, iPXE currently calculates the length to be
copied by subtracting the destination pointer from the end of buffer
pointer.  This works and guarantees not to write beyond the end of the
buffer, but may end up reading beyond the end of the buffer.

Fix by calculating the required length exactly.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-26 16:44:05 +00:00
Michael Brown ff341c1861 [dns] Update end-of-name pointer after processing CNAME record
Commit d4c0226 ("[dns] Support DNS search lists") introduced a
regression when handling CNAME records resolving to names longer than
the original name.  The "end of name" offset stored in dns->offset was
not updated to reflect the length of the new name, causing
dns_question() to append the (empty) search suffix at an incorrect
offset within the name buffer, resulting in a mangled DNS name.

In the case of a CNAME record resolving to a name shorter than or
equal in length to the original name, then the mangling would occur in
an unused portion of the name buffer.  In the common case of a name
server returning the A (or AAAA) record along with the CNAME record,
this would cause name resolution to succeed despite the mangling.  (If
the name server did not return the A or AAAA record along with the
CNAME record, then the mangling would be revealed by the subsequent
invalid query packet.)

Reported-by: Nicolas Sylvain <nsylvain@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-26 16:04:34 +00:00
Michael Brown d4c0226a6c [dns] Support DNS search lists
Update the DNS resolver to support DNS search lists (as provided by
DHCP option 119, DHCPv6 option 24, or NDP option 31).

Add validation code to ensure that parsing of DNS packets does not
overrun the input, get stuck in infinite loops, or (worse) write
beyond the end of allocated buffers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-02-05 14:56:49 +00:00
Michael Brown 3fa7a3b136 [intel] Add some missing PCI IDs
Tested-by: Philipp Hagen <Philipp.Hagen@she.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-29 16:43:39 +00:00
Michael Brown 290a43efda [cmdline] Always clear screen after reconfiguring console
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 22:43:55 +00:00
Michael Brown 3ee2c4ac1c [fbcon] Allow ANSI CUP with missing arguments
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 22:43:55 +00:00
Michael Brown 20a90a40c3 [cmdline] Add margin options to the "console" command
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 14:28:51 +00:00
Michael Brown 43c8c272ae [cmdline] Rename "console" command's --bpp option to --depth
Rename the "--bpp" option to "--depth", to free up the single-letter
option "-b" for "--bottom" in preparation for adding margin support.

This does not break backwards compatibility with documented features,
since the "console" command has not yet been documented.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 14:28:49 +00:00
Michael Brown 11ad25933f [vesafb] Allow for an arbitrary margin around the text area
Allow for an arbitrary margin to be specified in the console
configuration.  If the actual screen size does not match the requested
screen size, then update any margins specified so that they remain in
the same place relative to the requested screen size.  If margins are
unspecified (i.e. zero), then leave them as zero.

The underlying assumption here is that any specified margins are
likely to describe an area within a background picture, and so should
remain in the same place relative to that background picture.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 14:28:32 +00:00
Michael Brown 608d6cac9e [fbcon] Allow for an arbitrary margin around the text area
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 14:26:31 +00:00
Michael Brown 7fc380e950 [fbcon] Centre background picture on console
Centre the background picture on the console, to give a more
consistent result when the aspect ratio does not match the requested
width and height.

Once drawn for the first time, nothing should ever overwrite the
margins of the display.  We can therefore eliminate the logic used to
redraw only the margin areas, and use much simpler code to draw the
complete initial background image.

Simplify the redrawing logic further by making the background picture
buffer equal in size to the frame buffer.  In the common case of a
background picture which is designed to fill the screen, this wastes
no extra memory, and the combined code simplifications reduce the size
of fbcon.o by approximately 15%.

Redefine the concept of "margin" to match the intuitive definition
(i.e. the size of the gap, rather than the position of the boundary
line).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 14:16:34 +00:00
Michael Brown b20fe32315 [vesafb] Handle failures from fbcon_init()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-22 14:16:30 +00:00
Michael Brown c6c8078964 [png] Add support for PNG images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-12 22:53:16 +01:00
Michael Brown f4d2342e5a [test] Generalise pnm_ok() to pixbuf_ok()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-12 22:53:16 +01:00