summaryrefslogtreecommitdiffstats
path: root/src/net
Commit message (Collapse)AuthorAgeFilesLines
...
* [netdevice] Add mechanism for reporting detailed link status codesMichael Brown2009-06-241-0/+30
| | | | | | | | Expand the NETDEV_LINK_UP bit into a link_rc status code field, allowing specific reasons for link failure to be reported via "ifstat". Originally-authored-by: Joshua Oreman <oremanj@rwcr.net>
* [tcp] Avoid rewinding sequence numbers on receiving old duplicate ACKsMichael Brown2009-06-231-27/+31
| | | | | | | | | Commit 558c1a4 ("[tcp] Improve robustness in the presence of duplicated received packets") introduced a regression in that an old duplicate ACK received while in the ESTABLISHED state would pass through normal ACK processing, including updating tcp->snd_seq. Fix by ensuring that ACK processing ignores all duplicate ACKs.
* [tcp] Attempt to catch all possible error cases with debug messagesMichael Brown2009-06-231-11/+36
| | | | | | | All TCP errors or unusual events should now generate a debugging message at DBGLVL_LOG, with enough information (SEQ and ACK numbers) to be able to identify the corresponding packet (or missing packet) in a network trace from the remote end.
* [tcp] Include current sequence numbers in "timer expired" messagesMichael Brown2009-06-231-2/+3
|
* [tcp] Move high-frequency debug messages to DBGLVL_EXTRAMichael Brown2009-06-231-21/+21
| | | | | | This makes it possible to leave TCP debugging enabled in order to see interesting TCP events, without flooding the console with at least one message per packet.
* [netdevice] Add netdev argument to link-layer push and pull handlersJoshua Oreman2009-06-232-5/+9
| | | | | | | | | | | | | | | In order to construct outgoing link-layer frames or parse incoming ones properly, some protocols (such as 802.11) need more state than is available in the existing variables passed to the link-layer protocol handlers. To remedy this, add struct net_device *netdev as the first argument to each of these functions, so that more information can be fetched from the link layer-private part of the network device. Updated all three call sites (netdevice.c, efi_snp.c, pxe_undi.c) and both implementations (ethernet.c, ipoib.c) of ll_protocol to use the new argument. Signed-off-by: Michael Brown <mcb30@etherboot.org>
* [tcp] Improve robustness in the presence of duplicated received packetsMichael Brown2009-06-231-13/+28
| | | | | | | | | | | | | | | | | | | | | | gPXE responds to duplicated ACKs with an immediate retransmission, which can lead to a sorceror's apprentice syndrome. It also responds to out-of-range (or old duplicate) ACKs with a RST, which can cause valid connections to be dropped. Fix the sorceror's apprentice syndrome by leaving the retransmission timer running (and so inhibiting the immediate retransmission) when we receive a potential duplicate ACK. This seems to match the behaviour of Linux observed via wireshark traces. Fix the RST issue by sending RST only on out-of-range ACKs that occur before the connection is fully established, as per RFC 793. These problems were exposed during development of the 802.11 wireless link layer; the 802.11 protocol has a failure mode that can easily cause duplicated packets. The fixes were tested in a controlled way by faking large numbers of duplicated packets in the rtl8139 driver. Originally-fixed-by: Joshua Oreman <oremanj@rwcr.net>
* [ethernet] Add MII link status functions from LinuxDaniel Verkamp2009-05-261-0/+147
| | | | Signed-off-by: Michael Brown <mcb30@etherboot.org>
* [settings] Allow for arbitrarily-named settingsMichael Brown2009-05-262-7/+16
| | | | | This provides a mechanism for using arbitrarily-named variables within gPXE, using the existing syntax for settings.
* [dhcp] Choose ProxyDHCP port based on presence of PXE optionsMichael Brown2009-05-221-6/+22
| | | | | | | | | | | | | | | | | | | | | | | If the ProxyDHCPOFFER already includes PXE options (i.e. option 60 is set to "PXEClient" and option 43 is present) then assume that the ProxyDHCPREQUEST can be sent to port 67, rather than port 4011. This is a reasonable assumption, since in that case the ProxyDHCP server has already demonstrated by responding to the DHCPDISCOVER that it is listening on port 67. (If the ProxyDHCP server were not listening on port 67, then the standard DHCP server would have been configured to respond with option 60 set to "PXEClient" but no option 43 present.) The PXE specification is ambiguous on this point; the specified behaviour covers only the cases in which option 43 is *not* present in the ProxyDHCPOFFER. In these cases, we will continue to send the ProxyDHCPREQUEST to port 4011. This change is required in order to allow us to interoperate with dnsmasq, which listens only on port 67. (dnsmasq relies on unspecified behaviour of the Intel PXE stack, which it seems will retain the ProxyDHCPOFFER as an options source and never issue a ProxyDHCPREQUEST, thereby enabling dnsmasq to omit listening on port 4011.)
* [tftp] Process OACKs even if malformedMichael Brown2009-05-201-12/+28
| | | | | | | | | | | IBM Tivoli PXE Server 5.1.0.3 is reported to send trailing garbage bytes at the end of the OACK packet, which causes gPXE to reject the packet and abort the TFTP transfer. Work around the problem by processing as much as possible of the OACK, and treating name/value parsing errors as non-fatal. Reported-by: Shao Miller <Shao.Miller@yrdsb.edu.on.ca>
* [dhcp] Send broadcast PXE boot server discovery requests to port 67Michael Brown2009-05-201-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently send all boot server discovery requests to port 4011. Section 2.2.1 of the PXE spec states that boot server discovery packets should be "sent broadcast (port 67), multicast (port 4011), or unicast (port 4011)". Adjust our behaviour so that any boot server discovery packets that are sent to the broadcast address are directed to port 67 rather than port 4011. This is required for operation with dnsmasq as a PXE server, since dnsmasq listens only on port 67, and relies upon this (specified) behaviour. This change may break some setups using the (itself very broken) Linux PXE server from kano.org.uk. This server will, in its default configuration, listen only on port 4011. It never constructs a boot server list (PXE_BOOT_SERVERS, option 43.8), and uses the wrong definitions for the discovery control bits (PXE_DISCOVERY_CONTROL, option 43.6). The upshot is that it will always instruct the client to perform multicast and broadcast discovery only. In setups lacking a valid multicast route on the server side, this used to work because gPXE would eventually give up on the (non-responsive) multicast address and send a broadcast request to port 4011, which the Linux PXE server would respond to. Now that gPXE correctly sends this broadcast request to port 67 instead, it is never seen by the Linux PXE server, and the boot fails. The fix is to either (a) set up a multicast route correctly on the server side before starting the PXE server, or (b) edit /etc/pxe.conf to contain the server's unicast address in the "multicast_address" field (a hack that happens to work). Suggested-by: Simon Kelley <simon@thekelleys.org.uk>
* [dhcp] Perform ProxyDHCP only if we do not already have PXE optionsMichael Brown2009-05-201-2/+6
| | | | | | | | | | This prevents gPXE from wasting time attempting to contact a ProxyDHCP server on port 4011 if the DHCP response already contains the relevant PXE options. This behaviour is hinted at (though not explicitly specified) in the PXE spec, and seems to match what the Intel client does. Suggested-by: Simon Kelley <simon@thekelleys.org.uk>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-1826-0/+52
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [dhcp] Accept filename via DHCP option 67 as well as BOOTP filename fieldMichael Brown2009-04-151-4/+8
| | | | | Allow options with dedicated BOOTP fields to fall back to using the equivalent DHCP option if the relevant field is empty.
* [http] Support HTTP redirectionMichael Brown2009-03-301-0/+28
|
* [xfer] Implement xfer_vreopen() to properly handle redirectionsMichael Brown2009-03-308-11/+11
| | | | | When handling a redirection event, we need to close the existing connection before opening the new connection.
* [netdevice] Add debug message for unknown network-layer protocolsMichael Brown2009-03-261-2/+4
| | | | Suggested-by: Bill Lortz <Bill.Lortz@premier.org>
* [build] Enable building with the Intel C compiler (icc)Michael Brown2009-03-261-1/+1
|
* [tables] Incorporate table data type information into table definitionMichael Brown2009-03-131-2/+2
| | | | | | | Eliminate the potential for mismatches between table names and the table entry data type by incorporating the data type into the definition of the table, rather than specifying it explicitly in each table accessor method.
* [tables] Redefine methods for accessing linker tablesMichael Brown2009-03-134-36/+7Star
| | | | | | | | | | | | | | | Intel's C compiler (icc) chokes on the zero-length arrays that we currently use as part of the mechanism for accessing linker table entries. Abstract away the zero-length arrays, to make a port to icc easier. Introduce macros such as for_each_table_entry() to simplify the common case of iterating over all entries in a linker table. Represent table names as #defined string constants rather than unquoted literals; this avoids visual confusion between table names and C variable or type names, and also allows us to force a compilation error in the event of incorrect table names.
* [tcp] Avoid setting PSH flag when SYN flag is setMichael Brown2009-03-101-1/+3
| | | | | | | | Some firewall devices seem to regard SYN,PSH as an invalid flag combination and reject the packet. Fix by setting PSH only if SYN is not set. Reported-by: DSE Incorporated <dseinc@gmail.com>
* [iscsi] Include credentials in iBFT only if used during iSCSI loginMichael Brown2009-02-201-12/+11Star
| | | | | | | | Avoid passing credentials in the iBFT that were available but not required for login. This works around a problem in the Microsoft iSCSI initiator, which will refuse to initiate sessions if the CHAP password is fewer than 12 characters, even if the target ends up not asking for CHAP authentication.
* [crypto] Change cipher_{en,de}crypt() to void functionsMichael Brown2009-02-191-17/+5Star
| | | | | | It is a programming error, not a runtime error, if we attempt to use block ciphers with an incorrect blocksize, so use an assert() rather than an error status return.
* [crypto] Split crypto_algorithm into {digest,cipher,pubkey}_algorithmMichael Brown2009-02-181-17/+17
| | | | | | | | The various types of cryptographic algorithm are fundamentally different, and it was probably a mistake to try to handle them via a single common type. pubkey_algorithm is a placeholder type for now.
* [crypto] Move AES_convert_key() hack into axtls_aes.cMichael Brown2009-02-181-4/+0Star
| | | | | | Although the nature of the hack is essentially unchanged, this allows us to remove the hardcoded assumption in tls.c that the RX cipher is AES.
* [crypto] Rename aes_algorithm to aes_cbc_algorithmMichael Brown2009-02-181-2/+2
|
* [dhcp] Use a default user-class of "gPXE"Michael Brown2009-02-171-0/+2
| | | | | This change makes it possible to break the PXE-chaining infinite loop even when restricted to a Windows DHCP server.
* [http] Send authentication information whenever username is presentMichael Brown2009-02-171-9/+8Star
| | | | | Send authentication information if the username is present, even if the password is empty.
* [icmp] Add support for responding to pingsMichael Brown2009-02-172-0/+104
|
* [xfer] Make consistent assumptions that xfer metadata can never be NULLMichael Brown2009-02-156-30/+9Star
| | | | | | | | | | | | | The documentation in xfer.h and xfer.c does not say that the metadata parameter is optional in calls such as xfer_deliver_iob_meta() and the deliver_iob() method. However, some code in net/ is prepared to accept a NULL pointer, and xfer_deliver_as_iob() passes a NULL pointer directly to the deliver_iob() method. Fix this mess of conflicting assumptions by making everything assume that the metadata parameter is mandatory, and fixing xfer_deliver_as_iob() to pass in a dummy metadata structure (as is already done in xfer_deliver_iob()).
* [http] Allow for URI encodings within username and passwordMichael Brown2009-02-131-2/+15
|
* [http] Add support for HTTP Basic authenticationMichael Brown2009-02-131-0/+28
|
* [tls] Use our own ASN.1 routines for certificate parsingMichael Brown2009-02-101-67/+110
| | | | | | Use our own, more robust, ASN.1 parsing routines to extract the RSA public key from a server certificate. Remove the now-unused AXTLS ASN.1 parser.
* [pxe] Obey lists of PXE Boot Servers and associated Discovery Control bitsMichael Brown2009-02-051-29/+169
| | | | | | | | Various combinations of options 43.6, 43.7 and 43.8 dictate which servers we send Boot Server Discovery requests to, and which servers we should accept responses from. Obey these options, and remove the explicit specification of a single Boot Server from start_pxebs() and dependent functions.
* [iobuf] Add iob_disown() and use it where it simplifies codeMichael Brown2009-02-015-14/+9Star
| | | | | | | | | | | | | | | | | | | | | | | | | There are many functions that take ownership of the I/O buffer they are passed as a parameter. The caller should not retain a pointer to the I/O buffer. Use iob_disown() to automatically nullify the caller's pointer, e.g.: xfer_deliver_iob ( xfer, iob_disown ( iobuf ) ); This will ensure that iobuf is set to NULL for any code after the call to xfer_deliver_iob(). iob_disown() is currently used only in places where it simplifies the code, by avoiding an extra line explicitly setting the I/O buffer pointer to NULL. It should ideally be used with each call to any function that takes ownership of an I/O buffer. (The SSA optimisations will ensure that use of iob_disown() gets optimised away in cases where the caller makes no further use of the I/O buffer pointer anyway.) If gcc ever introduces an __attribute__((free)), indicating that use of a function argument after a function call should generate a warning, then we should use this to identify all applicable function call sites, and add iob_disown() as necessary.
* [dhcp] Send user class in DHCP requestsMichael Brown2009-02-011-2/+25
|
* [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-013-934/+774Star
| | | | | | | | | 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-232-73/+122
| | | | | | | | 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.
* [tcp] Always set PUSH flag on TCP transmissionsMichael Brown2009-01-211-1/+1
| | | | | | | | | Apparently this can cause a major speedup on some iSCSI targets, which will otherwise wait for a timer to expire before responding. It doesn't seem to hurt other simple TCP test cases (e.g. HTTP downloads). Problem and solution identified by Shiva Shankar <802.11e@gmail.com>
* [dhcp] Add preliminary support for PXE Boot ServersMichael Brown2009-01-212-1/+103
| | | | | | | | | 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.
* [tcpip] Allow for transmission to multicast IPv4 addressesMichael Brown2009-01-216-19/+25
| | | | | | | | | | | When sending to a multicast address, it may be necessary to specify the source address explicitly, since the multicast destination address does not provide enough information to deduce the source address via the miniroute table. Allow the source address specified via the data-xfer metadata to be passed down through the TCP/IP stack to the IPv4 layer, which can use it as a default source address.
* [ethernet] Fix eth_mc_hash() return statusMichael Brown2009-01-211-0/+1
| | | | | eth_mc_hash() was missing a return within a switch statement, and so always falling through to the default case and returning failure.
* [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".