summaryrefslogtreecommitdiffstats
path: root/src/net/tcp
Commit message (Collapse)AuthorAgeFilesLines
...
* [ftp] Add support for the FTP SIZE commandMarin Hannache2012-08-151-11/+60
| | | | | | | | | | The FTP SIZE command allows us to get the size of a particular file, as a consequence, we can now show proper transfer progression while fetching a file using the FTP protocol. Signed-off-by: Marin Hannache <git@mareo.fr> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Treat any unexpected connection close as an errorMichael Brown2012-08-151-7/+15
| | | | | | | | | | | | | | | | | iPXE currently checks that the server has not closed the connection mid-stream (i.e. in the middle of a chunked transfer, or before the specified Content-Length has been received), but does not check that the server got as far as starting to send data. Consequently, if the server closes the connection before any data is transferred (e.g. if the server gives up waiting while iPXE performs the validation steps for TLS), then iPXE will treat this as a successful transfer of a zero-length file. Fix by checking the RX connection state, and forcing an error if the server has closed the connection at an unexpected point. Originally-fixed-by: Marin Hannache <mareo@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-205-5/+10
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [syslog] Include hostname within syslog messages where possibleMichael Brown2012-06-201-4/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Add support for Digest authenticationMichael Brown2012-05-231-0/+173
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Provide credentials only when requested by serverMichael Brown2012-05-231-16/+128
| | | | | | | Provide HTTP Basic authentication credentials only in response to a 401 Unauthorized response from the server. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Split construction of Authorization header out of http_step()Michael Brown2012-05-231-57/+96
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Defer processing response code until after receiving all headersMichael Brown2012-05-221-6/+10
| | | | | | | | | Some headers can modify the meaning of the response code. For example, a WWW-Authenticate header can change the interpretation of a 401 Unauthorized response from "Access denied" to "Please authenticate". Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Reopen connections when server does not keep connection aliveMichael Brown2012-05-221-31/+118
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Report SCSI response only when applicableMichael Brown2012-05-161-1/+2
| | | | | | | | | | | | | iSCSI generally includes a full SCSI response only when an error occurs. iscsi_scsi_done() currently passes the NULL response through to scsi_response(), which ends up causing scsicmd_response() to dereference a NULL pointer. Fix by calling scsi_response() only if we have a non-NULL response. Reported-by: Brendon Walsh <brendonwalsh@niamu.com> Tested-by: Brendon Walsh <brendonwalsh@niamu.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Fix typo in memory allocationKevin Tran2012-04-271-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Avoid using stack-allocated memory in http_step()Michael Brown2012-04-241-14/+32
| | | | | | | | http_step() allocates a potentially large block of storage (since the URI can be arbitrarily long), and can be invoked as part of an already deep call stack via xfer_window_changed(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [syslog] Add basic support for encrypted syslog via TLSMichael Brown2012-04-101-0/+275
| | | | | | | Encrypted syslog seems not yet to be standardised, but is supported by some existing syslog servers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Disambiguate the various error causesMichael Brown2012-03-271-13/+45
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tls] Add support for Server Name Indication (SNI)Michael Brown2012-03-031-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Send any padding inline with the data segmentMichael Brown2012-03-011-28/+9Star
| | | | | | | | | | | | | Some iSCSI targets respond to a PDU before receiving the padding bytes. If the target responds quickly enough, this can cause iPXE to start processing a new TX PDU before the padding bytes have been sent, which results in a protocol violation. Fix by always transmitting the padding bytes along with the data segment. Originally-fixed-by: Shyam Iyer <shyam_iyer@dell.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Recognise status code 303 as validJason Lunz2012-03-011-0/+1
| | | | | | | | As RFC 2616 10.3.4 explains, a 303 status is the proper HTTP 1.1 behavior for what most HTTP 1.0 clients did with code 302. Signed-off-by: Jason Lunz <lunz@acm.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Allow for HTTPS-only buildsMichael Brown2012-02-282-858/+888
| | | | | | | | Separate out the core HTTP functionality (which is shared by both HTTP and HTTPS) from the provision of the "http://" URI opener. This allows for builds that support only "https://" URIs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Fail immediately if target rejects any of our parametersMichael Brown2011-12-051-12/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some iSCSI targets (observed with stgt) can be configured to reject connections that do not use header or data digests, and will respond with "HeaderDigest=Reject" and/or "DataDigest=Reject", while still allowing the connection to proceed to the full feature phase. According to a strict reading of RFC3720, we are perfectly safe to ignore these "Reject" messages: upon such a rejection "the negotiated key is left at its current value (or default if no value was set)". Since the default value for both HeaderDigest and DataDigest is "None", then the only viable conclusion to be drawn is that the value resulting from "Reject" is still "None". Unfortunately, stgt doesn't seem to agree with this interpretation of events, causing us to eventually report an unhelpful "connection timed out" message to the user when we don't get any response to our first PDU in full feature phase. Fix by detecting any rejected parameters and immediately reporting an error, which at least gives the user some insight as to what the real problem may be. Reported-by: Michal Suchanek <hramrach@centrum.cz> Tested-by: Michal Suchanek <hramrach@centrum.cz> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Include port in HTTP Host header as neededMalte Starostik2011-07-151-1/+5
| | | | | | | | | | | According to section 14.23 of RFC2616, an HTTP Host header without port implies the default port is used. Thus, when fetching from anywhere but port 80 for HTTP or 443 for HTTPS, the port ought to be explicitly given in that header. Otherwise, some servers might fail to associate the request with the correct virtual host or generate incorrect self-referencing URLs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Avoid duplicate calls to iscsi_tx_done()Michael Brown2011-06-291-4/+9
| | | | | | | | | | | | The iSCSI TX process can now be woken up by the TCP socket via xfer_window_changed(), so it is no longer valid to assume that iscsi_tx_step() can be called in state ISCSI_TX_IDLE only immediately after completing a transmission. Fix by calling iscsi_tx_done() only upon a transition into state ISCSI_TX_IDLE. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Fix size_t format specifiersMichael Brown2011-06-291-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Support read-only HTTP block devicesMichael Brown2011-06-281-59/+308
| | | | | | | | | | Provide support for HTTP range requests, and expose this functionality via the iPXE block device API. This allows SAN booting from a root path such as: sanboot http://boot.ipxe.org/freedos/fdfullcd.iso Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Eliminate polling while waiting for window to openMichael Brown2011-06-281-3/+26
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Eliminate polling while waiting for window to openMichael Brown2011-06-281-32/+46
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [process] Pass containing object pointer to process step() methodsMichael Brown2011-06-282-9/+13
| | | | | | | | | Give the step() method a pointer to the containing object, rather than a pointer to the process. This is consistent with the operation of interface methods, and allows a single function to serve as both an interface method and a process step() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ftp] Remove redundant ftp_data_deliver() methodMichael Brown2011-06-281-25/+4Star
| | | | | | | | ftp_data_deliver() does nothing except pass through the received data to the xfer interface, and so can be eliminated by using a pass-through interface. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Support chunked transfer encodingMichael Brown2011-05-051-44/+119
| | | | | | | | Booting from an HTTP SAN will require HTTP range requests, which are defined only in HTTP/1.1 and above. HTTP/1.1 mandates support for "Transfer-Encoding: chunked", so we must support it. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Impose a fixed order on settingsMichael Brown2011-03-231-3/+3
| | | | | | | Improve the appearance of the "config" user interface by ensuring that settings appear in some kind of logical order. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Change default initiator IQNMichael Brown2011-03-031-235/+140Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default initiator IQN is "iqn.2000-09.org.etherboot:UNKNOWN". This is problematic for two reasons: a) the etherboot.org domain (and hence the associated IQN namespace) is not under the control of the iPXE project, and b) some targets (correctly) refuse to allow concurrent connections from different initiators using the same initiator IQN. Solve both problems by changing the default initiator IQN to be iqn.2010-04.org.ipxe:<hostname> if a hostname is set, or iqn.2010-04.org.ipxe:<uuid> if no hostname is set. Explicit initiator IQNs set via DHCP option 203 are not affected by this change. Unfortunately, this change is likely to break some existing configurations, where ACL rules have been put in place referring to the old default initiator IQN. Users may need to update ACLs, or force the use of the old IQN using an iPXE script line such as set initiator-iqn iqn.2000-09.org.etherboot:UNKNOWN or a dhcpd.conf option such as option iscsi-initiator-iqn "iqn.2000-09.org.etherboot:UNKNOWN" Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Clarify support for NOP-InMichael Brown2011-02-251-24/+9Star
| | | | | | | | | | After a more accurate reading of RFC 3720, it becomes clear how NOPs are supposed to work. The current implementation (which just ignores NOP-Ins) is sufficient to cope with NOP-Ins sent to update CmdSN, but will need to be extended before it can cope with NOP-Ins sent as iSCSI keepalives. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Verify the correct tag in NOP-In PDUsMichael Brown2011-02-251-4/+4
| | | | | | | We should be checking the target transfer tag, rather than the initiator task tag. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Accept NOP-In PDUs sent by the targetMichael Brown2011-02-241-0/+50
| | | | | | | | | | | | Some iSCSI targets (observed with a Synology DS207+ NAS) send unsolicited NOP-Ins to the initiator. RFC 3720 is remarkably unclear and possibly self-contradictory on how NOPs are supposed to work, but it seems as though we can legitimately just ignore any unsolicited NOP-In PDU. Reported-by: Marc Lecuyer <marc@maxiscreen.com> Originally-implemented-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Disambiguate the expected target errors in the login responseMichael Brown2011-02-231-1/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Disambiguate the common EINVAL casesMichael Brown2010-12-011-4/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Ensure ISID is consistent within an iSCSI sessionMichael Brown2010-10-181-1/+4
| | | | | | | | | | | | | | | | Commit 5f4ab0d ("[iscsi] Randomise a portion of the ISID to force new session instantiation") introduced a regression by randomising the ISID on each call to iscsi_start_login(), which may be called more than once per connection, rather than on each call to iscsi_open_connection(), which is guaranteed to be called only once per connection. This is incorrect behaviour that causes our connection to be rejected by some iSCSI targets (observed with a COMSTAR target under OpenSolaris). Fix by generating the ISID in iscsi_open_connection(), and storing the randomised ISID as part of the session state. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Randomise a portion of the ISID to force new session instantiationMichael Brown2010-10-161-1/+1
| | | | | | | | | | | | | | | | When a connection to an iSCSI target is broken without gracefully closing the TCP socket, a subsequent connection attempt may fail because the target believes that we are attempting session reinstatement (see RFC3720 section 5.3.1). This has been observed using the Microsoft iSCSI target. Section 9.1.1 of RFC3720 states that initiators should use a stable ISID, however section 5.3.1 shows that the only way to explicitly request that a new session be created is to use a new ISID. Fix by randomising the "qualifier" portion of the ISID. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Replace gPXE block-device API with an iPXE asynchronous interfaceMichael Brown2010-09-141-156/+283
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The block device interface used in gPXE predates the invention of even the old gPXE data-transfer interface, let alone the current iPXE generic asynchronous interface mechanism. Bring this old code up to date, with the following benefits: o Block device commands can be cancelled by the requestor. The INT 13 layer uses this to provide a global timeout on all INT 13 calls, with the result that an unexpected passive failure mode (such as an iSCSI target ACKing the request but never sending a response) will lead to a timeout that gets reported back to the INT 13 user, rather than simply freezing the system. o INT 13,00 (reset drive) is now able to reset the underlying block device. INT 13 users, such as DOS, that use INT 13,00 as a method for error recovery now have a chance of recovering. o All block device commands are tagged, with a numerical tag that will show up in debugging output and in packet captures; this will allow easier interpretation of bug reports that include both sources of information. o The extremely ugly hacks used to generate the boot firmware tables have been eradicated and replaced with a generic acpi_describe() method (exploiting the ability of iPXE interfaces to pass through methods to an underlying interface). The ACPI tables are now built in a shared data block within .bss16, rather than each requiring dedicated space in .data16. o The architecture-independent concept of a SAN device has been exposed to the iPXE core through the sanboot API, which provides calls to hook, unhook, boot, and describe SAN devices. This allows for much more flexible usage patterns (such as hooking an empty SAN device and then running an OS installer via TFTP). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Generalise metadata "whence" field to "flags" fieldMichael Brown2010-09-031-2/+2
| | | | | | | | | | | | | iPXE has never supported SEEK_END; the usage of "whence" offers only the options of SEEK_SET and SEEK_CUR and so is effectively a boolean flag. Further flags will be required to support additional metadata required by the Fibre Channel network model, so repurpose the "whence" field as a generic "flags" field. xfer_seek() has always been used with SEEK_SET, so remove the "whence" field altogether from its argument list. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Pass through unknown interface method callsMichael Brown2010-06-221-2/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Convert all data-xfer interfaces to generic interfacesMichael Brown2010-06-224-195/+121Star
| | | | | | | | | | | | | | Remove data-xfer as an interface type, and replace data-xfer interfaces with generic interfaces supporting the data-xfer methods. Filter interfaces (as used by the TLS layer) are handled using the generic pass-through interface capability. A side-effect of this is that deliver_raw() no longer exists as a data-xfer method. (In practice this doesn't lose any efficiency, since there are no instances within the current codebase where xfer_deliver_raw() is used to pass data to an interface supporting the deliver_raw() method.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [refcnt] Add ref_init() wrapper functionMichael Brown2010-06-223-3/+3
| | | | | | | Standardise on using ref_init() to initialise an embedded reference count, to match the coding style used by other embedded objects. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Enable automated extraction of error usage reportsMichael Brown2010-05-311-11/+44
| | | | | | | Add preprocessor magic to the error definitions to enable every error usage to be tracked. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Allow base64 encoding in large binary valuesPiotr JaroszyƄski2010-05-281-23/+47
| | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Use generic base16 functions for iSCSI reverse CHAPMichael Brown2010-05-281-24/+17Star
| | | | | | Yes, I forgot to convert this function before pushing. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Use generic base16 functions for iSCSIMichael Brown2010-05-281-30/+21Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [base64] Allow base64_encode() to handle arbitrary dataMichael Brown2010-05-281-4/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Rename gPXE to iPXEMichael Brown2010-04-204-37/+37
| | | | | | | | | | | Access to the gpxe.org and etherboot.org domains and associated resources has been revoked by the registrant of the domain. Work around this problem by renaming project from gPXE to iPXE, and updating URLs to match. Also update README, LOG and COPYRIGHTS to remove obsolete information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Disambiguate some common authentication errorsMichael Brown2010-03-171-14/+27
| | | | Signed-off-by: Michael Brown <mcb30@etherboot.org>
* [iscsi] Fix interoperability with QNAP TS-639ProDanny Volkind2010-02-221-3/+10
| | | | | Modified-by: Michael Brown <mcb30@etherboot.org> Signed-off-by: Michael Brown <mcb30@etherboot.org>