summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* [autoboot] Allow autoboot device to be identified by link-layer addressMichael Brown2014-07-083-15/+65
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow network devices to be created on top of arbitrary SNP devicesMichael Brown2014-07-0311-397/+643
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Add yet another potential location for isolinux.binMichael Brown2014-06-261-1/+2
| | | | | Reported-by: Martin Sofaru <ipxe@fhloston.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix erroneous object name in version objectMichael Brown2014-06-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 8290a95 ("[build] Expose build timestamp, build name, and product names") introduced a regression in the build process which resulted in broken final binaries which had names based on object files (e.g. "undionly.kpxe" or "intel.rom") rather than on device IDs (e.g. "8086100e.mrom"). The underlying problem is the -DOBJECT=<name> macro which is used to generate the obj_<name> symbols used to select objects required for the final binary. The macro definition is derived from the initial portion (up to the first dot) of the object being built. In the case of e.g. undionly.kpxe.version.o, this gives -DOBJECT=undionly. This results in undionly.kpxe.version.o claiming to be the "undionly" object; the real "undionly" object will therefore never get dragged in to the build. Fix by renaming $(BIN)/%.version.o to $(BIN)/version.%.o, so that the object is always built with -DOBJECT=version (as might be expected, since it is built from core/version.c). Final binaries which have names based on device IDs (such as "8086100e.mrom") are not affected by this problem, since the object name "8086100e" will not conflict with that of the underlying "intel" object. This problem was not detected by the per-commit smoke testing procedure, which happens to use the binary bin/8086100e.mrom. Reported-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Restructure EFI driver modelMichael Brown2014-06-257-486/+582
| | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a single instance of EFI_DRIVER_BINDING_PROTOCOL (attached to our image handle); this matches the expectations scattered throughout the EFI specification. Open the underlying hardware device using EFI_OPEN_PROTOCOL_BY_DRIVER and EFI_OPEN_PROTOCOL_EXCLUSIVE, to prevent other drivers from attaching to the same device. Do not automatically connect to devices when being loaded as a driver; leave this task to the platform firmware (or to the user, if loading directly from the EFI shell). When running as an application, forcibly disconnect any existing drivers from devices that we want to control, and reconnect them on exit. Provide a meaningful driver version number (based on the build timestamp), to allow platform firmware to automatically load newer versions of iPXE drivers if multiple drivers are present. Include device paths within debug messages where possible, to aid in debugging. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide a meaningful EFI SNP device nameMichael Brown2014-06-252-2/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow device paths to be easily included in debug messagesMichael Brown2014-06-252-36/+52
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Expose build timestamp, build name, and product namesMichael Brown2014-06-2410-37/+101
| | | | | | | | Expose the build timestamp (measured in seconds since the Epoch) and the build name (e.g. "rtl8139.rom" or "ipxe.efi"), and provide the product name and product short name in a single centralised location. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [debug] Allow debug message colours to be customised via DBGCOL=...Michael Brown2014-06-162-3/+39
| | | | | | | | | | | | | | | | | | When multiple iPXE binaries are running concurrently (e.g. in the case of undionly.kpxe using an underlying iPXE driver via the UNDI interface) it would be helpful to be able to visually distinguish debug messages from each binary. Allow the range of debug colours used to be customised via the DBGCOL=... build parameter. For example: # Restrict to colours 31-33 (red, green, yellow) make DBGCOL=31-33 # Restrict to colours 34-36 (blue, magenta, cyan) make DBGCOL=34-36 Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Check if git index actually existsPeter Lemenkov2014-06-161-0/+2
| | | | | | | | | If iPXE is used as a git submodule then the ../.git/index file will not exist, and the build will fail. Fix by checking that the git index file exists before adding it as a build dependency. Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smbios] Expose board serial number as ${board-serial}Dale Hamel2014-06-122-0/+29
| | | | | | | | With blade servers, the chassis serial number (exposed via ${serial}) may not be unique. Expose ${board-serial} as a named setting to provide easy access to a more meaningful serial number. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [igbvf] Allow changing of MAC addressHannes Reinecke2014-06-121-0/+4
| | | | | | | | | The VF might not have assigned a MAC address upon startup, and will end up with a random MAC address during probe(). With this patch the MAC address can be changed later on. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [igbvf] Assign random MAC address if none is setHannes Reinecke2014-06-121-10/+4Star
| | | | | | | | | If the VF doesn't have a MAC address assigned we should create a random MAC address. Signed-off-by: Hannes Reinecke <hare@suse.de> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Include IP address origin in iBFTMichael Brown2014-06-122-0/+15
| | | | | | | | | | | The iBFT includes an "origin" field to indicate the source of the IP address. We use the heuristic of assuming that the source should be "manual" if the IP address originates directly from the network device settings block, and "DHCP" otherwise. This is an imperfect guess, but is likely to be correct in most common situations. Originally-implemented-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Read IPv4 settings only from the relevant network deviceMichael Brown2014-06-121-9/+14
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [scsi] Improve sense code parsingMichael Brown2014-06-035-19/+93
| | | | | | | | Parse the sense data to extract the reponse code, the sense key, the additional sense code, and the additional sense code qualifier. Originally-implemented-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ethernet] Provide eth_random_addr() to generate random Ethernet addressesHannes Reinecke2014-06-022-0/+17
| | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ifmgmt] Do not sleep CPU while configuring network devicesMichael Brown2014-06-011-4/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | iPXE currently calls cpu_nap() while performing DHCP, in order to reduce CPU utilisation on virtual machines. Under mild broadcast load (~100 packets per second), this can cause received packets to be dropped because the receive descriptor ring is overrun before the next 18Hz timer interrupt wakes up the CPU. The result is that DHCP is likely to intermittently fail on networks with appreciable amounts of broadcast (or multicast) traffic. This behaviour was introduced in the series of commits which generalised the "dhcp" command to the "ifconf" command. The earlier code (which did not handle IPv6 configuration) had no call to cpu_nap() and so did not suffer from this problem. Fix by removing the call to cpu_nap() in ifpoller_progress(). This has the undesirable side effect that CPU utilisation will remain at 100% while waiting for DHCP to complete (which can take several seconds, if we have to wait around for potential ProxyDHCP offers to arrive). Reported-by: Alex Davies <adavies@jumptrading.com> Reported-by: Christoffer Stokbæk <christoffers@easyspeedy.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Allow for the PIC interrupt vector offset to be changedMichael Brown2014-05-271-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Some external code (observed with FreeBSD's bootloader) will continue to make INT 13 calls after reconfiguring the 8259 PIC to change the vector offsets for IRQs. If an IRQ (e.g. the timer IRQ) subsequently occurs while iPXE is in protected mode, this will cause a general protection fault since the corresponding IDT entry is empty. A general protection fault is INT 0x0d, which happens to overlap with the original IRQ5. We therefore do have an ISR set up to handle a general protection fault, but this ISR simply reflects the interrupt down to the real-mode INT 0x0d and then attempts to return. Since our ISR is expecting a hardware interrupt rather than a general protection fault, it doesn't remove the error code from the stack before issuing the iret instruction; it therefore attempts to return to a garbage address. Since the segment part of this address is likely to be invalid, a second general protection fault occurs. This cycle continues until we run out of stack space and triple fault. Fix by reflecting all INTs down to real mode. This actually reduces the code size by four bytes (but increases the bss size by almost 2kB). Reported-by: Brian Rak <dn@devicenull.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Avoid potentially copying from a NULL pointer in ipv6_tx()Michael Brown2014-05-231-1/+2
| | | | | | | | | | | | | If ipv6_tx() is called with a non-NULL network device, a NULL or unspecified source address, and a destination address which does not match any routing table entry, then it will attempt to copy the source address from a NULL pointer. I don't think that there is currently any code path which could trigger this behaviour, but we should probably ensure that it can never happen. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Include network device when transcribing multicast addressesMichael Brown2014-05-231-1/+1
| | | | | | | Destination multicast addresses require a sin6_scope_id, which should therefore be transcribed to a network device name by ipv6_sock_ntoa(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Do not set sin6_scope_id on source addressMichael Brown2014-05-231-1/+0Star
| | | | | | | | The transmitting network device is specified via the destination address, not the source address. There is no reason to set sin6_scope_id on the source address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcpv6] Do not set sin6_scope_id on the unspecified client socket addressMichael Brown2014-05-231-1/+0Star
| | | | | | | | | | | | | | | Setting sin6_scope_id to a non-zero value will cause the check against the "empty socket address" in udp_demux() to fail, and incoming DHCPv6 responses on interfaces other than net0 will be rejected with a spurious "No UDP connection listening on port 546" error. The transmitting network device is specified via the destination address, not the source address. Fix by simply not setting sin6_scope_id on the client socket 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>
* [ipv6] Fix definition of IN6_IS_ADDR_LINKLOCAL()Michael Brown2014-05-212-1/+39
| | | | | | | | Fix an erroneous htonl() in the definition of IN6_IS_ADDR_LINKLOCAL(), and add self-tests for the IN6_IS_ADDR_xxx() family of macros. Reported-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Do not try to fetch loaded image device path protocolMichael Brown2014-05-201-23/+0Star
| | | | | | | | | | | Some UEFI systems (observed with a Mac Pro) do not provide a loaded image device path protocol. We don't currently use the loaded image device path protocol for anything beyond printing a debug message, so simply remove the code which attempts to fetch it. Reported-by: Matt Woodward <pxematt@woodwardcc.com> Tested-by: Matt Woodward <pxematt@woodwardcc.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Make EFI_HII_DATABASE_PROTOCOL optionalMichael Brown2014-05-201-1/+10
| | | | | | | | | | | | Some UEFI systems (observed with a Mac Pro) do not provide EFI_HII_DATABASE_PROTOCOL. We can continue to function without providing access to network device settings via HII, so make this protocol optional and fall back to simply not providing any HII protocols. Reported-by: Matt Woodward <pxematt@woodwardcc.com> Tested-by: Matt Woodward <pxematt@woodwardcc.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Make EFI_DEVICE_PATH_TO_TEXT_PROTOCOL optionalMichael Brown2014-05-201-9/+15
| | | | | | | | | | | Some UEFI systems (observed with a Mac Pro) do not provide EFI_DEVICE_PATH_TO_TEXT_PROTOCOL. Since we use this protocol only for debug messages, make it optional and fall back to printing the raw device path bytes. Reported-by: Matt Woodward <pxematt@woodwardcc.com> Tested-by: Matt Woodward <pxematt@woodwardcc.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow for optional protocolsMichael Brown2014-05-192-2/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nfs] Rewrite NFS URI handlingMarin Hannache2014-05-184-90/+228
| | | | | | | | Get the NFS URI manipulation code out of nfs_open.c. The resulting code is now much more readable. Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Prevent strndup() from reading beyond the end of the stringMichael Brown2014-05-182-3/+21
| | | | | | | | | | | | strndup() may be called on a string which is not NUL-terminated. Use strnlen() instead of strlen() to ensure that we do not read beyond the end of such a string. Add self-tests for strndup(), including a test case with an unterminated string. Originally-fixed-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for strdup()Michael Brown2014-05-181-0/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [syslog] Strip invalid characters from hostnameMichael Brown2014-05-161-6/+31
| | | | | | | | | | Avoid generating syntactically invalid log messages by ensuring that invalid characters are not present in the hostname. In particular, ensure that any whitespace is stripped, since whitespace functions as a field separator for syslog messages. Reported-by: Alex Davies <adavies@jumptrading.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Increase receive ring fill levelMichael Brown2014-05-161-2/+2
| | | | | | | | | | | | | | | | | | As of commit d28bb51 ("[tcp] Defer sending ACKs until all received packets have been processed"), increasing the RX ring size will increase the number of received packets per transmitted ACK (since each poll will process up to one complete receive ring). Under KVM, this can make a substantial (up to ~200%) difference to the overall download speed, since transmissions are very expensive. Increase the ring fill level from four to eight packets: this increases the download speed by around 50% at a cost of around 8kB of heap space. Further speedups are possible by increasing the ring size further, but it would be preferable to find alternative methods which do not use noticeable amounts of heap space. Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nfs] Fix an invalid free() when loading a regular (non-symlink) fileMarin Hannache2014-05-161-3/+4
| | | | | | | | | An invalid free() was ironically introduced by fixing another invalid free in commit 7aa69c4 ("[nfs] Fix an invalid free() when loading a symlink"). Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lkrnprefix] Make real-mode setup code relocatableMichael Brown2014-05-151-3/+4
| | | | | | | | | | | | The bzImage boot protocol allows the real-mode code to be loaded at any segment within base memory. (The fact that both iPXE and recent versions of Syslinux will load the real-mode code at 1000:0000 is a coincidence; it is not guaranteed by the specification.) Fix by making the code relocatable. Reported-by: Andrew Stuart <andrew@shopcusa.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Merge util/geniso and util/genlisoChristian Hesse2014-05-143-137/+125Star
| | | | | | | | Rework geniso and genliso to provide a single merged utility for generating ISO images. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Apply quota only to number of complete received packetsMichael Brown2014-05-141-4/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid errors when build directory is mounted via NFSMichael Brown2014-05-132-4/+4
| | | | | Reported-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lkrnprefix] Function as a bzImage kernelMichael Brown2014-05-131-132/+83Star
| | | | | | | | | | | | | | | | | | | | The .lkrn prefix currently provides a zImage kernel with unused setup sectors and the whole iPXE binary placed within the "protected mode kernel" portion of the zImage. The work carried out years ago to create the .mrom format provides a mechanism allowing the iPXE binary to be split into a small real-mode header and a larger payload. This neatly matches the way that a bzImage is loaded: the "setup sectors" can contain the header and the "protected mode kernel" can contain the payload. This removes the size restrictions on an iPXE .lkrn image (and hence on derived image formats such as .iso). Also remove obsolete copyright information, since none of the original code or functionality now remains. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Defer sending ACKs until all received packets have been processedMichael Brown2014-05-121-8/+25
| | | | | | | | | | | | | | | | | | | | | When running inside a virtual machine (or when using the UNDI driver), transmitting packets can be expensive. When we receive several packets in one poll (e.g. because a slow BIOS timer interrupt routine has caused us to fall behind in processing), we can safely send just a single ACK to cover all of the received packets. This reduces the time spent transmitting and allows us to clear the backlog much faster. Various RFCs (starting with RFC1122) state that there should be an ACK for at least every second segment. We choose not to enforce this rule. Under normal operation each poll should find at most one received packet, and we will then not delay any ACKs. We delay (i.e. omit) ACKs only when under sufficiently heavy load that we are finding multiple packets per poll; under these conditions it is important to clear the backlog quickly since any delay may lead to dropped packets. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nfs] Fix an invalid free() when loading a symlinkMarin Hannache2014-05-121-0/+11
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix version.o dependency upon git indexMichael Brown2014-05-121-1/+1
| | | | | | | | | | | | | | | | | | | Commit 8540300 ("[build] Disable ccache for all relevant build targets") attempted to generalise the rule for $(BIN)/version.o to $(BIN)/version.% in order to apply the dependency to all relevant build targets (debug objects, assembly listings, etc). This generalisation appears to work for the ccache override directives, but seems to cause make (at least, GNU make 4.0) to simply ignore the dependency upon the git index. Since version.c contains only some string constants, there is unlikely to be a substantive need for its debug objects, assembly listings, etc. Restore the previous form of the dependency and accept that hypothetical builds with e.g. DEBUG=version will not be handled correctly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Exclude time spent in hypervisor from profilingMichael Brown2014-05-061-0/+3
| | | | | | | | When profiling, exclude any time spent inside the hypervisor responding to our MMIO accesses. This substantially reduces the variance accumulated on many other profilers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [profile] Allow interrupts to be excluded from profiling resultsMichael Brown2014-05-044-17/+114
| | | | | | | | | Interrupt processing adds noise to profiling results. Allow interrupts (from within protected mode) to be profiled separately, with time spent within the interrupt handler being excluded from any other profiling currently in progress. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Place an upper limit on the number of PXENV_UNDI_ISR calls per pollMichael Brown2014-05-031-1/+5
| | | | | | | | | PXENV_UNDI_ISR calls may implicitly refill the underlying receive ring, and so could continue to retrieve packets indefinitely. Place an upper limit on the number of calls to PXENV_UNDI_ISR per call to undinet_poll(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Do not switch to real mode to check for NIC interruptMichael Brown2014-05-031-4/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Report any PXENV_UNDI_ISR errors via netdev_rx_err()Michael Brown2014-05-031-1/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Profile transmit and receive datapathsMichael Brown2014-05-031-1/+33
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Profile all PXE API callsMichael Brown2014-05-031-6/+97
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Work around missing PXENV_UNDI_OPEN only when necessaryMichael Brown2014-05-031-2/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>