summaryrefslogtreecommitdiffstats
path: root/src/net/tcp
Commit message (Collapse)AuthorAgeFilesLines
...
* [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>
* [http] GET / if URI doesn't contain a pathJoshua Oreman2010-01-271-1/+2
| | | | | | | | | | | Commit 3d9dd93 introduced a regression in HTTP: if a URI without a path is specified (e.g. http://netboot.me), we send the empty string as our GET request. Reintroduce an extra slash when uri->path is NULL, to turn this into the expected GET /. Reported-by: Kyle Kienapfel <doctor.whom@gmail.com> Signed-off-by: Joshua Oreman <oremanj@rwcr.net> Signed-off-by: Marty Connor <mdc@etherboot.org>
* [ftp] User and password URI support for the FTP protocolgL2n30Y06arv22010-01-211-2/+24
| | | | | | | | | | | | The default user and password are used for anonymous FTP by default. This patch adds support for an explicit user name and password in an FTP URI: imgfetch ftp://user:password@server.com/path/to/file Edited-by: Stefan Hajnoczi <stefanha@gmail.com>. Bugs are my fault. Signed-off-by: Marty Connor <mdc@etherboot.org>
* [uri] Decode/encode URIs when parsing/unparsingJoshua Oreman2010-01-211-19/+12Star
| | | | | | | | | | | | | | | Currently, handling of URI escapes is ad-hoc; escaped strings are stored as-is in the URI structure, and it is up to the individual protocol to unescape as necessary. This is error-prone and expensive in terms of code size. Modify this behavior by unescaping in parse_uri() and escaping in unparse_uri() those fields that typically handle URI escapes (hostname, user, password, path, query, fragment), and allowing unparse_uri() to accept a subset of fields to print so it can be easily used to generate e.g. the escaped HTTP path?query request. Signed-off-by: Joshua Oreman <oremanj@rwcr.net> Signed-off-by: Marty Connor <mdc@etherboot.org>
* [scsi] Make LUN a property of the SCSI backend onlyMichael Brown2009-08-101-1/+0Star
| | | | | Nothing within the SCSI core actually refers to the LUN, so we can simplify matters by treating it as purely a property of the backend.
* [scsi] Generalise iscsi_parse_lun() to scsi_parse_lun()Michael Brown2009-08-101-37/+1Star
|
* [scsi] Generalise iscsi_detached_command() to scsi_detached_command()Michael Brown2009-08-101-6/+1Star
|
* [scsi] Make SCSI command issuing partially asynchronousMichael Brown2009-07-181-18/+11Star
| | | | | Move the icky call to step() from iscsi.c to scsi.c; this takes it at least one step further away from where it really doesn't belong.
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-183-0/+6
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [http] Support HTTP redirectionMichael Brown2009-03-301-0/+28
|
* [xfer] Implement xfer_vreopen() to properly handle redirectionsMichael Brown2009-03-303-4/+4
| | | | | When handling a redirection event, we need to close the existing connection before opening the new connection.
* [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.
* [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.
* [xfer] Make consistent assumptions that xfer metadata can never be NULLMichael Brown2009-02-152-2/+2
| | | | | | | | | | | | | 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
|
* [iobuf] Add iob_disown() and use it where it simplifies codeMichael Brown2009-02-011-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [i386] Change [u]int32_t to [unsigned] int, rather than [unsigned] longMichael Brown2008-11-191-1/+1
| | | | | | This brings us in to line with Linux definitions, and also simplifies adding x86_64 support since both platforms have 2-byte shorts, 4-byte ints and 8-byte long longs.
* [makefile] Add -Wformat-nonliteral as an extra warning categoryMichael Brown2008-10-101-20/+41
| | | | | | | | | | | -Wformat-nonliteral is not enabled by -Wall and needs to be explicitly specified. Modified the few files that use nonliteral format strings to work with this new setting in place. Inspired by a patch from Carl Karsten <carl@personnelware.com> and an identical patch from Rorschach <r0rschach@lavabit.com>.
* [iscsi] Fix LUN parsing in the iSCSI root-pathMichael Brown2008-09-281-11/+14
|
* [iscsi] Change default initiator name prefix to "iqn.2000-01.org.etherboot:"Michael Brown2008-09-191-1/+1
| | | | | | | | | | | | The domain etherboot.org was actually registered on 2000-01-09, not 2000-09-01. (To put it another way, it was registered on 1/9/2000 (US date format) rather than 1/9/2000 (sensible date format); this may illuminate the cause of the error.) "iqn.2000-09.org.etherboot:" is still valid as per RFC3720, but may be surprising to users, so change it to something less unexpected. Thanks to the anonymous contributor for pointing this one out.
* [iSCSI] Add support for mutual CHAPMichael Brown2008-08-111-45/+266
| | | | Allow initiator to verify target authentication using CHAP.
* [ftp] Terminate processing after receiving an errorSergey Vlasov2008-07-301-0/+1
| | | | | | | | | When an error reply (not 1xx, 2xx or 3xx) was received, ftp_reply() invoked ftp_done() to close connections, but did not return, and the rest of code in this function could try to send commands to the closed control connection. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
* [ftp] Cope with RETR completion prior to all data receivedMichael Brown2008-07-301-15/+33
| | | | | | | | | | | | Based on a patch contributed by Sergey Vlasov <vsu@altlinux.ru> : In my testing with "qemu -net user" the 226 response to RETR was often received earlier than final packets of the data connection; this caused the received file to become truncated without any error indication. Fix this by adding an intermediate state FTP_TRANSFER between FTP_RETR and FTP_QUIT, so that the transfer is considered to be complete only when both the end of data connection is encountered and the final reply to the RETR command is received.
* [iSCSI] Produce meaningful errors on login failureMichael Brown2008-06-041-3/+34
| | | | | | | | Return the most appropriate of EACCES, EPERM, ENODEV, ENOTSUP, EIO or EINVAL depending on the exact error returned by the target, rather than just always returning EPERM. Also, ensure that error strings exist for these errors.
* [iSCSI] Offer CHAP authentication only if we have a username and passwordMichael Brown2008-04-241-4/+5
| | | | | | | | | | | | | | | | Some EMC targets will fail if we advertise that we can authenticate with CHAP, but the target is configured to allow unauthenticated access to that target. We advertise AuthMethod=CHAP,None; the target should (I think) select AuthMethod=None for unprotected targets. IETD does this, but an EMC Celerra NS83 doesn't. Fix by offering only AuthMethod=None if the user hasn't supplied a username and password; this means that we won't be offering CHAP authentication unless the user is expecting to use it (in which case the target is presumably configured appropriately). Many thanks to Alessandro Iurlano <alessandro.iurlano@gmail.com> for reporting and helping to diagnose this problem.
* [http] gPXE is a HTTP/1.0 client, not a HTTP/1.1 clientH. Peter Anvin2008-03-311-1/+1
| | | | | | | | | | | | | | | gPXE is not compliant with the HTTP/1.1 specification (RFC 2616), since it lacks support for "Transfer-Encoding: chunked". gPXE is, however, compliant with the HTTP/1.0 specification (RFC 1945), which does not require "Transfer-Encoding: chunked" to be supported. The only HTTP/1.1 feature that gPXE uses is the "Host:" header, but servers universally accept that one from HTTP/1.0 clients as an optional extension (it is obligatory for HTTP/1.1). gPXE does not, for example, appear to support connection caching. Advertising as a HTTP/1.0 client will typically make the server close the connection immediately upon sending the last data, which is actually beneficial if we aren't going to keep the connection alive anyway.
* [Settings] Remove assumption that all settings have DHCP tag valuesMichael Brown2008-03-251-11/+19
| | | | | | | | | | | | 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.