summaryrefslogtreecommitdiffstats
path: root/src/net/udp
Commit message (Collapse)AuthorAgeFilesLines
* [tftp] Guard against invalid data block numbersMichael Brown2009-02-011-0/+5
| | | | | | | | A TFTP DATA packet with a block number of zero (representing a negative offset within the file) could potentially cause problems. Fixed by explicitly rejecting such packets. Identified by Stefan Hajnoczi <stefanha@gmail.com>.
* [dhcp] Split PXE menuing code out of dhcp.cMichael Brown2009-02-011-902/+679Star
| | | | | | | | | The DHCP client code now implements only the mechanism of the DHCP and PXE Boot Server protocols. Boot Server Discovery can be initiated manually using the "pxebs" command. The menuing code is separated out into a user-level function on a par with boot_root_path(), and is entered in preference to a normal filename boot if the DHCP vendor class is "PXEClient" and the PXE boot menu option exists.
* [dns] Append local domain to relative namesStefan Hajnoczi2009-01-271-11/+65
| | | | | | | | | | | | | | | Try to qualify relative names in the DNS resolver using the DHCP Domain Name. For example: DHCP Domain Name: etherboot.org (Relative) Name: www yields: www.etherboot.org Only names with no dots ('.') will be modified. A name with one or more dots is unchanged.
* [tftp] Temporary fix for conveying TFTP block size to callersMichael Brown2009-01-271-1/+19
| | | | | | | | | | | | | | | | | | | | | pxe_tftp.c assumes that the first seek on its data-transfer interface represents the block size. Apart from being an ugly hack, this will also screw up file size calculation for files smaller than one block. The proper solution would be to extend the data-transfer interface to support the reporting of stat()-like data. This is not going to happen until the cost of adding interface methods is reduced (a fix I have planned since June 2008). In the meantime, abuse the xfer_window() method to return the block size, since it is not being used for anything else and is vaguely justifiable. Astonishingly, having returned the incorrect TFTP blocksize via PXENV_TFTP_OPEN for almost a year seems not to have affected any of the test cases run during that time; this bug was found only when someone tried running the heavily-patched version of pxegrub found in OpenSolaris.
* [dhcp] Include support for PXE boot menusMichael Brown2009-01-251-13/+193
| | | | | | | | | PXE dictates a mechanism for boot menuing, involving prompting the user with a variable message, waiting for a predefined keypress, displaying a boot menu, and waiting for a selection. This breaks the currently desirable abstraction that DHCP is a process that can happen in the background without any user interaction.
* [dhcp] Clarify language surrounding ProxyDHCPMichael Brown2009-01-231-50/+51
| | | | | | Remove the lazy assumption that ProxyDHCP == "DHCP with option 60 set to PXEClient", and explicitly separate the notion of ProxyDHCP from the notion of packets containing PXE options.
* [dhcp] Handle missing ProxyDHCP serversMichael Brown2009-01-231-1/+8
| | | | | | | | | | | | | | | | It is possible to configure a DHCP server to hand out PXE options without a ProxyDHCP server present. This requires setting option 60 to "PXEClient", which will cause gPXE to attempt ProxyDHCP. We assume in several places that dhcp->proxydhcpack is set to the DHCPACK packet containing option 60 set to "PXEClient". When we transition into ProxyDHCPREQUEST, set dhcp->proxydhcpack=dhcp->dhcpack so that this assumption holds true. We ought to rename several references to "proxydhcp" to something more accurate, such as "pxedhcp". Treating a single DHCP response as potentially both DHCPOFFER and ProxyDHCPOFFER does make the code smaller, but the variable names get confusing.
* [dhcp] Pass PXE boot menu item to PXE Boot ServerMichael Brown2009-01-231-70/+118
| | | | | | | | Pick out the first boot menu item from the boot menu (option 43.9) and pass it to the boot server as the boot menu item (option 43.71). Also improve DHCP debug messages to include more details of the packets being transmitted.
* [dhcp] Add preliminary support for PXE Boot ServersMichael Brown2009-01-211-1/+92
| | | | | | | | | Some PXE configurations require us to perform a third DHCP transaction (in addition to the real DHCP transaction and the ProxyDHCP transaction) in order to retrieve information from a "Boot Server". This is an experimental implementation, since the actual behaviour is not well specified in the PXE spec.
* [dhcp] Centralise DHCP successful state transitionsMichael Brown2009-01-211-19/+35
| | | | | | | Move all the DHCP state transition logic into a single function dhcp_next_state(). This will make it easier to add support for PXE Boot Servers, since it abstracts away the difference between "mark DHCP as complete" and "transition to boot server discovery".
* [dhcp] Allow for missing server ID in ProxyDHCPACKMichael Brown2009-01-211-9/+13
| | | | | | | | | | | | The Linux PXE server (http://www.kano.org.uk/projects/pxe) does not set the server identifier in its ProxyDHCP responses. If the server ID is missing, do not treat this as an error. This resolves the "vague and unsettling memory" mentioned in commit fdb8481d ("[dhcp] Verify server identifier on ProxyDHCPACKs"). Note that we already accept ProxyDHCPOFFERs without a server identifier; they get treated as potential BOOTP packets.
* [dhcp] Include gPXE version number within DHCP requestMichael Brown2009-01-081-0/+4
|
* [x86_64] Fix assorted 64-bit compilation errors and warningsMichael Brown2008-11-191-2/+2
| | | | | | Remove various 32-bit assumptions scattered throughout the codebase. The code is still not necessarily 64-bit clean, but will at least compile.
* [settings] Add the notion of a "tag magic" to numbered settingsMichael Brown2008-10-301-1/+1
| | | | | | | | | | | | | | | | | | | Settings can be constructed using a dotted-decimal notation, to allow for access to unnamed settings. The default interpretation is as a DHCP option number (with encapsulated options represented as "<encapsulating option>.<encapsulated option>". In several contexts (e.g. SMBIOS, Phantom CLP), it is useful to interpret the dotted-decimal notation as referring to non-DHCP options. In this case, it becomes necessary for these contexts to ignore standard DHCP options, otherwise we end up trying to, for example, retrieve the boot filename from SMBIOS. Allow settings blocks to specify a "tag magic". When dotted-decimal notation is used to construct a setting, the tag magic value of the originating settings block will be ORed in to the tag number. Store/fetch methods can then check for the magic number before interpreting arbitrarily-numbered settings.
* [tftp] Add EUNIQ_xx values to differentiate the many EINVAL errorsMichael Brown2008-10-221-7/+16
|
* [dhcp] Accept BOOTP as well as DHCPMichael Brown2008-09-251-7/+9
|
* [dhcp] Do not restrict minimum retry time for ProxyDHCPREQUESTMichael Brown2008-08-131-0/+1
| | | | | | | | | | | The ProxyDHCPREQUEST is a unicast packet, so the first request will almost always be lost due to not having the IP address in the ARP cache. If the minimum retry time is set to one second (as per commit ff2b6a5), then ProxyDHCP will time out and give up before managing to successfully transmit a request. The DHCP timers need to be reworked anyway, so this mild hack is acceptable for now.
* [retry] Added configurable timeouts to retry timerAndrew Schran2008-08-121-0/+2
| | | | | | | | New min_timeout and max_timeout fields in struct retry_timer allow users of this timer to set their own desired minimum and maximum timeouts, without being constrained to a single global minimum and maximum. Users of the timer can still elect to use the default global values by leaving the min_timeout and max_timeout fields as 0.
* [dhcp] Work around a bug in Altiris RDPMichael Brown2008-08-011-2/+2
| | | | | | | Altiris erroneously cares about the ordering of DHCP options, and will get confused if we don't construct them in the order it expects. This is observed (so far) only when attempting to deploy 64-bit Win2k3.
* [dhcp] Verify DHCP server source portMichael Brown2008-07-101-16/+45
| | | | | | Verifying server ID and DHCP transaction ID is insufficient to differentiate between DHCPACK and ProxyDHCPACK when the DHCP server and Proxy DHCP server are the same machine.
* [tftp] Strip the initial '/' to keep Windows TFTP servers happy.Michael Brown2008-07-031-6/+19
|
* [dhcp] Verify server identifier on ProxyDHCPACKsMichael Brown2008-07-011-7/+25
| | | | | | | | | | Perform the same test for a matching DHCP_SERVER_IDENTIFIER on ProxyDHCPACKs as we do for DHCPACKs. Otherwise, a retransmitted DHCPACK can end up being treated as the ProxyDHCPACK. I have a vague and unsettling memory that this test was deliberately omitted, but I can't remember why, and can't find anything in the VC logs.
* [slam] Add support for SLAM window lengths of greater than one packetMichael Brown2008-06-111-11/+30
| | | | | | | | | | | Add the definition of SLAM_MAX_BLOCKS_PER_NACK, which is roughly equivalent to a TCP window size; it represents the maximum number of packets that will be requested in a single NACK. Note that, to keep the code size down, we still limit ourselves to requesting only a single range per NACK; if the missing-block list is discontiguous then we may request fewer than SLAM_MAX_BLOCKS_PER_NACK blocks.
* [slam] Implement SLAM flow controlMichael Brown2008-06-111-107/+85Star
| | | | | | | | | | | | | | | | On any fast network, or with any driver that may drop packets (e.g. Infiniband, which has very small RX rings), the traditional usage of the SLAM protocol will result in enormous numbers of packet drops and a consequent large number of retransmissions. By adapting the client behaviour, we can force the server to act more like a multicast TFTP server, with flow control provided by a single master client. This behaviour should interoperate with any traditional SLAM client (e.g. Etherboot 5.4) on the network. The SLAM protocol isn't actually documented anywhere, so it's hard to define either behaviour as compliant or otherwise.
* [dhcp] Do not transition to DHCPREQUEST without a valid DHCPOFFERMichael Brown2008-06-111-1/+1
| | | | | | A missing test for dhcp->dhcpoffer in dhcp_timer_expired() was causing the client to transition to DHCPREQUEST after timing out on waiting for ProxyDHCP even if no DHCPOFFERs had been received.
* [slam] Request all remaining blocks if we run out of space for the blocklistMichael Brown2008-06-101-22/+41
| | | | | | | | In a SLAM NACK packet, if we run out of space to represent the missing-block list, then indicate all remaining blocks as missing. This avoids the need to wait for the one-second timeout before receiving the blocks that otherwise wouldn't have been requested due to running out of space.
* [slam] Speed up NACK transmission by restricting the block-list lengthMichael Brown2008-06-101-20/+62
| | | | | | | | | | Shorter NACK packets take less time to construct and spew out less debug output, and there's a limit to how useful it is to send a complete missing-block list anyway; if the loss rate is high then we're going to have to retransmit an updated missing-block list anyway. Also add pretty debugging output to show the list of requested blocks.
* [slam] Fix multicast address parsingMichael Brown2008-06-101-8/+11
| | | | | slam_parse_multicast_address() was failing to strip the initial "/" from the URI path.
* [slam] Add Scalable Local Area Multicast (SLAM) protocol supportMichael Brown2008-06-101-0/+749
| | | | | Tested against the mini-slamd server located in contrib/mini-slamd with a single client, on a lossy network.
* [DHCP] Add "dhcp-server" setting to help end-user diagnosticsMichael Brown2008-06-051-0/+8
|
* [Settings] Expose SMBIOS via settings APIMichael Brown2008-03-281-2/+3
| | | | In particular, expose the system UUID as a setting ("smbios/uuid").
* [DHCP] Add support for ProxyDHCP requestsMichael Brown2008-03-271-345/+546
| | | | | | | | | | | | | | | | The PXE spec is (as usual) unclear on precisely when ProxyDHCPREQUESTs should be issued. We adapt the following, slightly paranoid approach: If an offer contains an IP address, then it is a normal DHCPOFFER. If an offer contains an option #60 "PXEClient", then it is a ProxyDHCPOFFER. Note that the same packet can be both a normal DHCPOFFER and a ProxyDHCPOFFER. After receiving the normal DHCPACK, if we have received a ProxyDHCPOFFER, we unicast a ProxyDHCPREQUEST back to the ProxyDHCP server on port 4011. If we time out waiting for a ProxyDHCPACK, we treat this as a non-fatal error.
* [DHCP] Save precious packet-aligned memory by copying DHCP responsesMichael Brown2008-03-261-33/+16Star
| | | | | Copy DHCP responses to a standard malloc()ed buffer, rather than retaining the I/O buffer that they arrived in.
* [Settings] Remove assumption that all settings have DHCP tag valuesMichael Brown2008-03-253-183/+154Star
| | | | | | | | | | | | Allow for settings to be described by something other than a DHCP option tag if desirable. Currently used only for the MAC address setting. Separate out fake DHCP packet creation code from dhcp.c to fakedhcp.c. Remove notion of settings from dhcppkt.c. Rationalise dhcp.c to use settings API only for final registration of the DHCP options, rather than using {store,fetch}_setting throughout.
* [DHCP] Fix DHCP state confusion.Michael Brown2008-03-251-2/+5
| | | | | DHCP code was using an incorrect check for whether to construct a DHCPDISCOVER or DHCPREQUEST packet.
* [Settings] copy_settings() should not fail if some settings are missing!Michael Brown2008-03-241-18/+54
|
* [DHCP] Fix up fake-packet creation as used by PXENV_GET_CACHED_INFOMichael Brown2008-03-231-37/+107
| | | | | | | | | | | Add dedicated functions create_dhcpdiscover(), create_dhcpack() and create_proxydhcpack() for use by external code such as the PXE preboot code. Register ProxyDHCP options under the global scope "proxydhcp". Unregister previously-acquired DHCP and ProxyDHCP settings when DHCP succeeds.
* [DHCP] FIXME: quick temporary settings fix, needs update for new APIMarty Connor2008-03-221-0/+4
|
* [Settings] DHCP is now working using the new settings API.Michael Brown2008-03-211-3/+4
|
* [Settings] Migrate DHCP and NVO code to the new settings API (untested)Michael Brown2008-03-211-437/+197Star
|
* [Settings] Use a settings applicator to set the default TFTP URI.Michael Brown2008-03-211-0/+43
|
* [Settings] Use a settings applicator to configure IPv4 routes.Michael Brown2008-03-211-43/+0Star
|
* [Settings] Introduce settings applicators.Michael Brown2008-03-211-18/+17Star
| | | | | | | Convert DHCP option applicators in dns.c and iscsi.c to settings applicators. Kill off DHCP option applicators.
* Modify gPXE core and drivers to work with the new timer subsystemAlexey Zaytsev2008-03-021-0/+1
| | | | Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
* [DHCP] Fix RFC4390 client identifier constructions.Michael Brown2008-02-271-1/+1
| | | | | | RFC 4390 provides for the DHCP client identifier to contain the link-layer hardware type and MAC address when the MAC address exceeds 16 bytes. However, the hardware type field is only 8 bits; we were assuming 16 bits.
* Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxeMichael Brown2008-01-223-13/+14
|\
| * Make seek information part of the xfer metadata, rather than an entirelyMichael Brown2008-01-083-7/+6Star
| | | | | | | | | | | | | | separate xfer method. Add missing .alloc_iob entries to several xfer_interface_operations structures.
| * When the DHCP file/sname fields are empty, don't allow them to overrideMichael Brown2008-01-071-6/+8
| | | | | | | | their equivalent DHCP-option-specified values.
* | Add preliminary support for MTFTP.Michael Brown2007-12-261-112/+295
|/
* Fix compiler warnings that appear only on OpenBSD.Michael Brown2007-12-061-7/+7
|