aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/tcp
Commit message (Collapse)AuthorAgeFilesLines
* [base64] Add buffer size parameter to base64_encode() and base64_decode()Michael Brown2015-04-242-2/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [base16] Add buffer size parameter to base16_encode() and base16_decode()Michael Brown2015-04-242-12/+16
| | | | | | | | | | | | | | The current API for Base16 (and Base64) encoding requires the caller to always provide sufficient buffer space. This prevents the use of the generic encoding/decoding functionality in some situations, such as in formatting the hex setting types. Implement a generic hex_encode() (based on the existing format_hex_setting()), implement base16_encode() and base16_decode() in terms of the more generic hex_encode() and hex_decode(), and update all callers to provide the additional buffer length parameter. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Support MD5-sess Digest authenticationMichael Brown2015-03-091-2/+42
| | | | | | | Microsoft IIS supports only MD5-sess for Digest authentication. Requested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Abstract out HTTP Digest hash algorithm operationsMichael Brown2015-03-091-28/+56
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Rewrite unrelicensable portions of iscsi.cMichael Brown2015-03-021-36/+28
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | | | | These files cannot be automatically relicensed by util/relicense.pl since they either contain unusual but trivial contributions (such as the addition of __nonnull function attributes), or contain lines dating back to the initial git revision (and so require manual knowledge of the code's origin). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-023-3/+15
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Expose build timestamp, build name, and product namesMichael Brown2014-06-241-2/+2
| | | | | | | | 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>
* [scsi] Improve sense code parsingMichael Brown2014-06-031-4/+7
| | | | | | | | 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>
* [http] Profile receive datapathMichael Brown2014-04-281-0/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Accept Content-Length header with trailing whitespaceMichael Brown2014-03-251-1/+2
| | | | | | | At least one HTTP server (Google's OCSP responder) has been observed to generate a Content-Length header with trailing whitespace. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Automatically retry request on a 503 Service UnavailableMichael Brown2014-03-071-1/+45
| | | | | | | | | | | | | | | | | | 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>
* [http] Use a retry timer to trigger retried requestsMichael Brown2014-03-071-15/+44
| | | | | | | Use a retry timer to allow for the possibility of deferring a retried request. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Refactor URI parsing and formattingMichael Brown2014-02-272-30/+63
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* [settings] Force settings into alphabetical order within sectionsMichael Brown2013-12-053-6/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [syslog] Add support for IPv6 syslog serverMichael Brown2013-12-051-1/+0
| | | | | | | | | | | Note that IANA has not yet assigned a DHCPv6 option code for the syslog server. When a code is assigned, the definition of DHCPV6_LOG_SERVERS should be updated. Until then, an IPv6 address of a syslog server can be configured manually using e.g. set syslog6 3ffe:302:11:2::8309 Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Explicitly separate the concept of a completed fetched settingMichael Brown2013-12-053-51/+24
| | | | | | | | | | The fetch_setting() family of functions may currently modify the definition of the specified setting (e.g. to add missing type information). Clean up this interface by requiring callers to provide an explicit buffer to contain the completed definition of the fetched setting, if required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Allow console input and output to be disabled independentlyMichael Brown2013-11-281-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Pass escape sequence context to ANSI escape sequence handlersMichael Brown2013-11-271-1/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Add support for HTTP POSTMichael Brown2013-08-191-3/+121
| | | | | | | | | | | | | | Allow HTTP POST requests to be generated when the URI includes a parameter list. For example: #!ipxe params param mac ${net0/mac} param uuid ${uuid} param asset ${asset} chain http://boot.ipxe.org/demo/boot.php##params Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nfs] Add support for NFS protocolMarin Hannache2013-07-151-0/+250
| | | | | | Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Include version number within only a single object fileMichael Brown2012-11-021-2/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Fix HTTP SAN bootingMichael Brown2012-08-171-6/+6
| | | | | | | | | | | | | | | Commit 501527d ("[http] Treat any unexpected connection close as an error") introduced a regression causing HTTP SAN booting to fail. At the end of the response to the HEAD request, the call to http_done() would erroneously believe that the server had disconnected in the middle of the HTTP headers. Fix by treating the header block from a HEAD request as a trailer block. This fixes the problem and also simplifies the logic in http_rx_header(). Reported-by: Shao Miller <shao.miller@yrdsb.edu.on.ca> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [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/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Add support for Digest authenticationMichael Brown2012-05-221-0/+173
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Provide credentials only when requested by serverMichael Brown2012-05-221-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-221-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-231-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/+9
| | | | | | | | | | | | | 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/+4
| | | | | | | | 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>