david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

1137 Commits

Author SHA1 Message Date
Michael Brown 44a0dc7848 [syslog] Add support for IPv6 syslog server
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>
2013-12-05 01:27:33 +00:00
Michael Brown 6248894f52 [dns] Add support for resolving IPv6 addresses via AAAA records
Our policy is to prefer IPv6 addreses to IPv4 addresses, but to
request IPv6 addresses only if we have an IPv6 address for the name
server itself.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-05 00:41:49 +00:00
Michael Brown 17451b53e2 [settings] Allow for IPv6 setting types in non-IPv6 builds
Allow for the existence of references to IPv6 setting types without
dragging in the whole IPv6 stack, by placing the definition of
setting_type_ipv6 in core/settings.c and providing weak stub methods
for parse_ipv6_setting() and format_ipv6_setting().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-05 00:41:49 +00:00
Michael Brown 22001cb206 [settings] Explicitly separate the concept of a completed fetched setting
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>
2013-12-05 00:37:02 +00:00
Michael Brown b2251743d8 [console] Allow console input and output to be disabled independently
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-28 05:54:53 +00:00
Michael Brown 02a63c6dec [console] Pass escape sequence context to ANSI escape sequence handlers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-27 11:27:50 +00:00
Michael Brown 017e6c56af [dhcpv6] Allow stateful DHCPv6 to apply obtained IPv6 addresses
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-15 15:23:09 +00:00
Michael Brown 6b1eee0452 [ipv6] Separate the concepts of prefix and address creation
Allow for IPv6 routing table entries to be created for an on-link
prefix where a local address has not yet been assigned to the network
device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-15 15:22:54 +00:00
Michael Brown 2fa34085e2 [dhcpv6] Add basic support for stateful and stateless DHCPv6
Add support for the stateful and stateless variants of the DHCPv6
protocol.  The resulting settings block is registered as
"net<x>.dhcpv6", and DHCPv6 options can be obtained using
e.g. "${net0.dhcpv6/23:ipv6}" to obtain the IPv6 DNS server address.

IPv6 addresses obtained via stateful DHCPv6 are not yet applied to the
network device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-14 12:35:43 +00:00
Michael Brown c1570d3dfb [ipv6] Add "ipv6" setting type
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-14 12:35:43 +00:00
Michael Brown 95623e353b [ipv6] Use given source address only if it is not the unspecified address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-14 12:35:43 +00:00
Michael Brown 4484edd1c0 [settings] Move user-class setting from dhcp.c to settings.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-14 12:35:43 +00:00
Michael Brown 6871a8113f [ipv6] Add IPv6 network device configurator
Include IPv6 within the generic network device configurator
mechanism.  The IPv6 configurator will send a router solicitation and
wait for a router advertisement to be received.  (As per RFC4861
section 6.3.7, we do this even if advertisements have been received
prior to sending the router solicitation.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-07 15:04:47 +00:00
Michael Brown 759dcf5a9b [dhcp] Add DHCP network device configurator
Provide an interface to DHCP via the generic network device
configurator mechanism.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-05 17:30:20 +00:00
Michael Brown f2bc138391 [netdevice] Add generic concept of a network device configurator
iPXE supports multiple mechanisms for network device configuration:
DHCPv4 for IPv4, FIP for FCoE, and SLAAC for IPv6.  At present, DHCPv4
requires an explicit action (e.g. a "dhcp" command), FIP is initiated
implicitly upon opening a network device, and SLAAC takes place
whenever a RA happens to be received.

Add a generic concept of a network device configurator, which provides
a common interface to triggering configuration and to reporting the
result of the configuration process.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-05 17:30:15 +00:00
Michael Brown 5c11ff6304 [netdevice] Make all net_driver methods optional
Most network upper-layer drivers do not implement all three methods
(probe, notify, and remove).  Save code by making all methods
optional.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-01 02:26:44 +00:00
Michael Brown b15dbc9cc6 [ipv6] Add ndp_tx_router_solicitation() to send router solicitations
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-25 17:29:25 +01:00
Michael Brown 10d19bd2ac [pxe] Always retrieve cached DHCPACK and apply to relevant network device
When chainloading, always retrieve the cached DHCPACK packet from the
underlying PXE stack, and apply it as the original contents of the
"net<X>.dhcp" settings block.  This allows cached DHCP settings to be
used for any chainloaded iPXE binary (not just undionly.kkpxe).

This change eliminates the undocumented "use-cached" setting.  Issuing
the "dhcp" command will now always result in a fresh DHCP request.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-25 17:29:25 +01:00
Michael Brown 1aa67eba16 [ipv6] Automatically choose source for link-local and multicast destinations
When transmitting to a link-local or multicast destination address,
use the network device's link-local address as the source address if
no explicit source address has been specified.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-25 14:44:06 +01:00
Michael Brown fec127cb07 [ipv6] Treat sin6_scope_id consistently
sin6_scope_id is never exposed outside of the local system, and so
should be a native-endian quantity.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-25 13:49:51 +01:00
Michael Brown 33652880a7 [ipv6] Support stateless address autoconfiguration (SLAAC)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-23 14:07:57 +01:00
Michael Brown 2dca2e6ade [ipv6] Extract link layer addresses from router advertisements
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-23 14:07:56 +01:00
Michael Brown 595e32d7ab [ipv6] Handle IPv6 option length correctly
The IPv6 option length field represents the length of the option data
field, not the overall length of the option.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-23 14:07:56 +01:00
Michael Brown 46873eda44 [ping] Add concept of a ping socket
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 15:08:18 +01:00
Michael Brown 5c2ffc26cc [icmp] Add support for sending ICMP echo requests
Merge common functionality between IPv4 and IPv6 ICMP echo handling,
and add support for transmitting ICMP echo requests and delivering
ICMP echo replies to a (not yet implemented) ping_rx() function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 15:08:12 +01:00
Michael Brown 2c76c1a6d8 [ipv6] Add IPv6 socket address converter
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 14:34:08 +01:00
Michael Brown 365a09d867 [ipv4] Add IPv4 socket address converter
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 14:34:08 +01:00
Michael Brown b6a9152f8c [socket] Add concept of a generalised socket address converter
Add sock_aton() and sock_ntoa() to allow for parsing and transcription
of arbitrary socket addresses.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 14:34:03 +01:00
Michael Brown 8f30ea4a6b [netdevice] Add find_netdev_by_index()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 14:34:02 +01:00
Michael Brown e6ad90540b [udp] Add AF_INET6 socket opener
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 14:34:02 +01:00
Michael Brown 9f324cf9a5 [tcp] Add AF_INET6 socket opener
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 14:34:02 +01:00
Michael Brown 37ccbd301d [neighbour] Add nstat() function to print out neighbour table
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-25 14:36:30 +01:00
Michael Brown a9fa0d5f2b [ipv6] Add inet6_aton()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-11 11:27:13 +01:00
Michael Brown 8aaa48beb8 [ipv6] Fix uninitialised-variable warning
Fix uninitialised-variable warning reported by gcc 4.5.2.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 20:01:17 +01:00
Michael Brown f7f3087cc5 [ipv6] Replace IPv6 stack
Replace the existing partially-implemented IPv6 stack with a fresh
implementation.

This implementation is not yet complete.  The IPv6 transmit and
receive datapaths are functional (including fragment reassembly and
parsing of arbitrary extension headers).  NDP neighbour solicitations
and advertisements are supported.  ICMPv6 echo is supported.

At present, only link-local addresses may be used, and there is no way
to specify an IPv6 address as part of a URI (either directly or via
a DNS lookup).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 16:30:46 +01:00
Michael Brown c6a04085d2 [neighbour] Generalise concept of neighbour discovery
Split the protocol-independent portions of arp.c into a separate file
neighbour.c, to allow for sharing of functionality between IPv4+ARP
and IPv6+NDP.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 02:02:58 +01:00
Michael Brown 6bf36f57a0 [tcpip] Pass through network device to transport layer protocols
NDP requires knowledge of the network device on which a packet was
received.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 02:02:58 +01:00
Michael Brown 0f787df284 [ethernet] Add support for generating multicast hash for IPv6 addresses
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 02:02:51 +01:00
Michael Brown 0b65c8cad6 [netdevice] Add method for generating EUI-64 address from link-layer address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 01:24:15 +01:00
Michael Brown d5f69e9388 [netdevice] Add concept of a network device index
IPv6 link-local socket addresses require some way to specify a local
network device.  We cannot simply use a pointer to the network device,
since a struct sockaddr_in6 may be long-lived and has no way to hold a
reference to the network device.

Using a network device index allows a socket address to cleanly refer
to a network device without worrying about whether or not that device
continues to exist.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 01:24:15 +01:00
Michael Brown 22a0c4475c [ipv4] Generalise fragment reassembly mechanism
Generalise the concept of fragment reassembly to allow for code
sharing between IPv4 and IPv6 protocols.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-27 16:39:43 +01:00
Michael Brown ae0124cd40 [linux] Give tap devices a name and bus type
Give tap devices a meaningful name, and avoid segmentation faults when
attempting to retrieve ${net0/bustype} by assigning a new bus type for
tap devices.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-27 16:39:43 +01:00
Michael Brown 82e452d427 [http] Add support for HTTP POST
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>
2013-08-19 17:22:58 +01:00
Marin Hannache 53c01d6444 [nfs] Fix an issue with the selection of a local port
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-06 15:58:35 +01:00
Michael Brown 252d28f098 [tcpip] Allow binding to unspecified privileged ports (below 1024)
Originally-implemented-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-06 15:56:54 +01:00
Michael Brown 0350682865 [ipv6] Rename sin_{family,port} to sin6_{family,port} in struct sockaddr_in6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-06 15:55:23 +01:00
Michael Brown e972057381 [udp] Move high-frequency debug messages to DBGLVL_EXTRA
This makes it possible to leave UDP debugging enabled in order to see
interesting UDP events, without flooding the console with at least one
message per packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-06 15:52:31 +01:00
Michael Brown 063645118c [settings] Clarify usage of the term "named setting"
There are currently two conflicting usages of the term "named setting"
within iPXE: one refers to predefined settings (such as show up in the
"config" UI), the other refers to settings identified by a name (such
as "net0.dhcp/ip").

Split these usages into the term "predefined setting" and "named
setting" to avoid ambiguity.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-18 15:50:02 +01:00
Marin Hannache 30de9e8300 [nfs] Add support for NFS protocol
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 17:56:29 +02:00
Michael Brown eba6bb38f2 [cmdline] Accept "netX" in iPXE commands
Allow any iPXE command expecting a network device name to accept
"netX" as a synonym for "most recently opened network device".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-13 15:22:34 +02:00
Michael Brown 66ea458125 [settings] Make "netX" settings block function as a symbolic link
Add a facility for settings blocks to act as symbolic links to other
settings blocks, and reimplement the "netX" virtual settings block
using this facility.

The primary advantage of this approach is that unscoped settings such
as ${mac} and ${filename} will now reflect the settings obtained from
the most recently opened network device: in most cases, this will mean
the settings obtained from the most recent DHCP attempt.  This should
improve conformance to the principle of least astonishment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-13 15:11:45 +02:00
Michael Brown c0cff94320 [netdevice] Add "bustype" and "busloc" settings
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-12 22:38:19 +02:00
Michael Brown d4f8e56bb4 [tcp] Fix comment to match code behaviour
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-12 11:15:42 +02:00
Michael Brown 18d0818f94 [tcp] Do not send RST for unrecognised connections
On large networks with substantial numbers of monitoring agents,
unwanted TCP connection attempts may end up flooding iPXE's ARP cache.

Fix by silently dropping packets received for unrecognised TCP
connections.  This should not cause problems, since many firewalls
will also silently drop any such packets.

Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-12 03:20:05 +02:00
Michael Brown c4bce43c3c [netdevice] Reset MAC address when asked to clear the "mac" setting
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-16 15:41:20 +01:00
Michael Brown 08bf79582a [netdevice] Add "chip" setting
Suggested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-16 15:32:17 +01:00
Michael Brown 15d2f947f5 [settings] Eliminate settings "tag magic"
Create an explicit concept of "settings scope" and eliminate the magic
values used for numerical setting tags.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 19:52:12 +01:00
Michael Brown 2095ed413e [netdevice] Add netdev_tx_defer() to allow drivers to defer transmissions
Devices with small transmit descriptor rings may temporarily run out
of space.  Provide netdev_tx_defer() to allow drivers to defer packets
for retransmission as soon as a descriptor becomes available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 14:05:42 +01:00
Michael Brown 4678864ce6 [build] Fix dubious uses of bitwise operators
Detected by sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 17:31:23 +01:00
Michael Brown b9663b8049 [build] Fix uses of literal 0 as a NULL pointer
Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 17:13:44 +01:00
Michael Brown 445ac9fbdc [netdevice] Use link-layer address as part of RNG seed
iPXE currently seeds the random number generator using the system
timer tick count.  When large numbers of machines are booted
simultaneously, multiple machines may end up choosing the same DHCP
transaction ID (XID) value; this can cause problems.

Fix by using the least significant (and hence most variable) bits of
each network device's link-layer address to perturb the random number
generator.  This introduces some per-machine unique data into the
random number generator's seed, and so reduces the chances of DHCP XID
collisions.

This does not affect the ANS X9.82-compatible random bit generator
used by TLS and other cryptography code, which uses an entirely
separate source of entropy.

Originally-implemented-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 14:34:03 +01:00
Michael Brown e42bc3aa37 [libc] Use __einfo() tuple as first argument to EUNIQ()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 00:45:13 +01:00
Michael Brown d938e50136 [uuid] Abstract UUID mangling code out to a separate uuid_mangle() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 15:06:40 +00:00
Michael Brown a9b63ecda5 [dhcp] Use PXE byte ordering for UUID in DHCP option 97
The PXE spec does not specify a byte ordering for UUIDs, but RFC4578
suggests that it follows the EFI spec, in which the first three fields
are little-endian.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 00:54:42 +00:00
Michael Brown 02b914e812 [tftp] Allow TFTP block size to be controlled via the PXE TFTP API
The PXE TFTP API allows the caller to request a particular TFTP block
size.  Since mid-2008, iPXE has appended a "?blksize=xxx" parameter to
the TFTP URI constructed internally; nothing has ever parsed this
parameter.  Nobody seems to have cared that this parameter has been
ignored for almost five years.

Fix by using xfer_window(), which provides a fairly natural way to
convey the block size information from the PXE TFTP API to the TFTP
protocol layer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-06 17:35:30 +00:00
Michael Brown 77f64b11f7 [netdevice] Separate VLAN support from presence of VLAN-supporting drivers
Some NICs (e.g. Hermon) provide hardware support for stripping the
VLAN tag, but do not provide any way for this support to be disabled.
Drivers for this hardware must therefore call vlan_find() to identify
a suitable receiving network device.

Provide a weak version of vlan_find() which will always return NULL if
VLAN support has not been enabled (either directly, or by enabling
a feature such as FCoE which requires VLAN support).  This allows the
VLAN code to be omitted from builds where the user has not requested
support for VLANs.

Inspired-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-01 16:36:34 +00:00
Stefan Hajnoczi 7426177d63 [netdevice] Add vlan_tag() to get the VLAN tag of a network device
The iBFT has a VLAN field that should be filled in.  Add the
vlan_tag() function to extract the VLAN tag of a network device.

Since VLAN support is optional, define a weak function that returns 0
when iPXE is built without VLAN support.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-01 16:11:40 +00:00
Michael Brown 0acc52519d [tls] Concatenate received non-data records before processing
Allow non-data records to be split across multiple received I/O
buffers, to accommodate large certificate chains.

Reported-by: Nicola Volpini <Nicola.Volpini@kambi.com>
Tested-by: Nicola Volpini <Nicola.Volpini@kambi.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-01-31 09:59:36 +00:00
Stefan Weil 3fcb8cf8dc [src] Fix spelling in comments, debug messages and local variable names
Fixes in comments and debug messages:

  existance -> existence
  unecessary -> unnecessary
  occured -> occurred
  decriptor -> descriptor
  neccessary -> necessary
  addres, adress -> address
  initilize -> initialize
  sucessfully -> successfully
  paramter -> parameter
  acess -> access
  upto -> up to
  likelyhood ->likelihood
  thru -> through
  substracting -> subtracting
  lenght -> length
  isnt -> isn't
  interupt -> interrupt
  publically -> publicly (this one was not wrong, but unusual)
  recieve -> receive
  accessable -> accessible
  seperately -> separately
  pacet -> packet
  controled -> controlled
  dectect -> detect
  indicies -> indices
  extremly -> extremely
  boundry -> boundary
  usefull -> useful
  unuseable -> unusable
  auxilliary -> auxiliary
  embeded -> embedded
  enviroment -> environment
  sturcture -> structure
  complier -> compiler
  constructes -> constructs
  supress -> suppress
  intruduced -> introduced
  compatability -> compatibility
  verfication -> verification
  ths -> the
  reponse -> response

Fixes in local variable names:

  retreive -> retrieve

Most of these fixes were made using codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-01-03 15:18:48 +00:00
Michael Brown 4867085c0c [build] Include version number within only a single object file
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-02 14:46:39 +00:00
Michael Brown 88e19fcda9 [netdevice] Clear network device setting before unregistering
Avoid memory leaks by clearing any (non-child) settings immediately
before unregistering the network device settings block.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 22:44:00 -07:00
Michael Brown 947976da0c [netdevice] Do not force a poll on net_tx()
Including a netdev_poll() within net_tx() can cause the net_step()
loop to end up processing hundreds or thousands of packets within a
single step, since each received packet being processed may trigger a
response which, in turn causes a poll for further received packets.

Network devices must now ensure that the TX ring is at least as large
as the RX ring, in order to avoid running out of TX descriptors.  This
should not cause any problems; unlike the RX ring, there is no
substantial memory cost incurred by increasing the TX ring size.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 14:04:41 -07:00
Michael Brown 885384faf3 [arp] Increase robustness of ARP discarder
Take ownership from the ARP cache at the start of arp_destroy(), to
ensure that no code path can lead to arp_destroy() being re-entered.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-19 23:03:38 +01:00
Michael Brown d23db28488 [tls] Fix potential memory leak
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-28 10:54:07 +01:00
Michael Brown 1e199c8260 [tls] Fix uninitialised variable
Reported-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-28 10:52:17 +01:00
Michael Brown 72db14640c [tls] Split received records over multiple I/O buffers
TLS servers are not obliged to implement the RFC3546 maximum fragment
length extension, and many common servers (including OpenSSL, as used
in Apache's mod_ssl) do not do so.  iPXE may therefore have to cope
with TLS records of up to 16kB.  Allocations for 16kB have a
non-negligible chance of failing, causing the TLS connection to abort.

Fix by maintaining the received record as a linked list of I/O
buffers, rather than a single contiguous buffer.  To reduce memory
pressure, we also decrypt in situ, and deliver the decrypted data via
xfer_deliver_iob() rather than xfer_deliver_raw().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-27 01:56:01 +01:00
Michael Brown 03f0c23f8b [ipoib] Expose Ethernet-compatible eIPoIB link-layer addresses and headers
Almost all clients of the raw-packet interfaces (UNDI and SNP) can
handle only Ethernet link layers.  Expose an Ethernet-compatible link
layer to local clients, while remaining compatible with IPoIB on the
wire.  This requires manipulation of ARP (but not DHCP) packets within
the IPoIB driver.

This is ugly, but it's the only viable way to allow IPoIB devices to
be driven via the raw-packet interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:59 +01:00
Michael Brown f54a61e434 [infiniband] Include destination address vector in ib_complete_recv()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:58 +01:00
Michael Brown cbe41cb31b [infiniband] Use explicit "source" and "dest" address vector parameter names
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:58 +01:00
Michael Brown f747fac3e1 [infiniband] Allow queue pairs to have a custom allocator for receive iobufs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:57 +01:00
Michael Brown de802310bc [retry] Expose retry_poll() to explicitly poll all running timers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 20:21:15 +01:00
Michael Brown 1cbb1581f1 [ethernet] Expose eth_broadcast as a global constant
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 20:21:10 +01:00
Michael Brown 79300e2ddf [tls] Disambiguate most error causes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-25 04:08:04 +01:00
Michael Brown 8f7cd88af5 [http] Fix HTTP SAN booting
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>
2012-08-17 18:00:40 +01:00
Marin Hannache 1170a36e6b [ftp] Add support for the FTP SIZE command
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>
2012-08-15 17:04:41 +01:00
Michael Brown 501527daab [http] Treat any unexpected connection close as an error
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>
2012-08-15 16:29:22 +01:00
Michael Brown c3b4860ce3 [legal] Update FSF mailing address in GPL licence texts
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 19:55:45 +01:00
Michael Brown a5d16a91af [tcp] Truncate TCP window to prevent future packet discards
Whenever memory pressure causes a queued packet to be discarded (and
so retransmitted), reduce the maximum TCP window to a size that would
have prevented the discard.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:13:47 +01:00
Michael Brown 024247317d [arp] Try to avoid discarding ARP cache entries
Discarding the active ARP cache entry in the middle of a download will
substantially disrupt the TCP stream.  Try to minimise any such
disruption by treating ARP cache entries as expensive, and discarding
them only when nothing else is available to discard.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:08:38 +01:00
Michael Brown b0e236a9ee [netdevice] Process all received packets in net_poll()
The current logic is to process at most one received packet per call
to net_poll(), on the basis that refilling the hardware descriptor
ring should be delayed as little as possible.  However, this limits
the rate at which packets can be processed and ultimately ends up
adding latency which, in turn, limits the achievable throughput.

With temporary modifications in place to essentially remove all
resource constraints (heap size increased to 16MB, RX descriptor ring
increased to 64 descriptors) and a TCP window size of 1MB, the
throughput on a gigabit (i.e. 119MBps) network can be observed to fall
off exponentially from around 115MBps to around 75MBps.  Changing
net_poll() to process all received packets results in a steady
119MBps throughput.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-04 13:41:49 +01:00
Michael Brown 19859d8ead [arp] Prevent ARP cache entries from being deleted mid-transmission
Each ARP cache entry maintains a transmission queue, which is sent out
as soon as the link-layer address is known.  If multiple packets are
queued, then it is possible for memory pressure to cause the ARP cache
discarder to be invoked during transmission of the first packet, which
may cause the ARP cache entry to be deleted before the second packet
can be sent.  This results in an invalid pointer dereference.

Avoid this problem by reference-counting ARP cache entries and
ensuring that an extra reference is held while processing the
transmission queue, and by using list_first_entry() rather than
list_for_each_entry_safe() to traverse the queue.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-01 18:31:23 +01:00
Michael Brown 55f52bb77a [tcp] Avoid potential NULL pointer dereference
Commit ea61075 ("[tcp] Add support for TCP window scaling") introduced
a potential NULL pointer dereference by referring to the connection's
send window scale before checking whether or not the connection is
known.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-30 19:03:07 +01:00
Michael Brown 49ac629821 [tcp] Use a zero window size for RST packets
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-30 19:00:05 +01:00
Michael Brown 9a8c6b00d4 [tls] Request a maximum fragment length of 2048 bytes
The default maximum plaintext fragment length for TLS is 16kB, which
is a substantial amount of memory for iPXE to have to allocate for a
temporary decryption buffer.

Reduce the memory footprint of TLS connections by requesting a maximum
fragment length of 2kB.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-29 15:28:15 +01:00
Michael Brown ea61075c60 [tcp] Add support for TCP window scaling
The maximum unscaled TCP window (64kB) implies a maximum bandwidth of
around 300kB/s on a WAN link with an RTT of 200ms.  Add support for
the TCP window scaling option to remove this upper limit.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-29 15:05:33 +01:00
Michael Brown 1d77d03216 [tcpip] Allow for architecture-specific TCP/IP checksum routines
Calculating the TCP/IP checksum on received packets accounts for a
substantial fraction of the response latency.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:17 +01:00
Michael Brown cbc54bf559 [syslog] Include hostname within syslog messages where possible
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 14:59:06 +01:00
Michael Brown 7ea6764031 [settings] Move "domain" setting from dns.c to settings.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 14:39:03 +01:00
Michael Brown c0942408b7 [dhcp] Request broadcast responses when we already have an IPv4 address
FCoE requires the use of multiple local unicast link-layer addresses.
To avoid the complexity of managing multiple addresses, iPXE operates
in promiscuous mode.  As a consequence, any unicast packets with
non-matching IPv4 addresses are rejected at the IPv4 layer (rather
than at the link layer).

This can cause problems when issuing a second DHCP request: if the
address chosen by the DHCP server does not match the existing address,
then the DHCP response will itself be rejected.

Fix by requesting a broadcast response from the DHCP server if the
network interface already has any IPv4 addresses.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 12:01:50 +01:00
Michael Brown af47789ef2 [tls] Mark security negotiation as a pending operation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 18:59:41 +01:00
Michael Brown 5482b0abb6 [tcp] Mark any unacknowledged transmission as a pending operation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 18:56:07 +01:00
Michael Brown 5af9ad51c8 [crypto] Fix unused-but-set variable warning
Reported-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-23 23:48:12 +01:00
Michael Brown 658c25aa82 [http] Add support for Digest authentication
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-22 23:43:44 +01:00
Michael Brown 5f2226aa36 [http] Provide credentials only when requested by server
Provide HTTP Basic authentication credentials only in response to a
401 Unauthorized response from the server.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-22 23:43:36 +01:00
Michael Brown 8f5d44b5c6 [http] Split construction of Authorization header out of http_step()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-22 23:18:14 +01:00
Michael Brown 46df5c92a8 [http] Defer processing response code until after receiving all headers
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>
2012-05-22 12:33:05 +01:00
Michael Brown 8a5ba6733d [http] Reopen connections when server does not keep connection alive
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-22 12:32:59 +01:00
Michael Brown 073331c2ee [crypto] Automatically perform OCSP checks when applicable
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-22 00:47:19 +01:00
Michael Brown 73b21174b2 [iscsi] Report SCSI response only when applicable
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>
2012-05-16 10:55:58 +01:00
Michael Brown 4855e86d95 [crypto] Include "?subject=" in cross-signed certificate URI
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-09 10:07:16 +01:00
Michael Brown 0e4ee60a75 [crypto] Reduce standard debugging output
X.509 certificate processing currently produces an overwhelming amount
of debugging information.  Move some of this from DBGLVL_LOG to
DBGLVL_EXTRA, to make the output more manageable.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-09 10:01:14 +01:00
Michael Brown 3e6e0078e0 [crypto] Automatically download cross-signed certificates
Automatically attempt to download any required cross-signing
certificates from http://ca.ipxe.org/auto, in order to enable the use
of standard SSL certificates issued by public CAs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 19:17:05 +01:00
Michael Brown f19565f58f [tls] Use asynchronous certificate validator
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 12:49:02 +01:00
Michael Brown 29dcb0631b [crypto] Add asynchronous certificate validator
To allow for automatic download of cross-signing certificates and for
OCSP, the validation of certificates must be an asynchronous process.
Create a stub validator which uses a job-control interface to report
the result of certificate validation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 12:49:01 +01:00
Michael Brown 99c798d87a [crypto] Add x509_append_raw()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 12:49:01 +01:00
Michael Brown 0ad8b601dd [crypto] Allow for X.509 certificates with no common name
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 12:49:01 +01:00
Michael Brown 8a0331c29b [tcp] Discard all TCP connections on shutdown
Allow detection of genuine memory leaks by ensuring that all TCP
connections are freed on shutdown.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 12:49:01 +01:00
Michael Brown 52dd4bacad [tcp] Fix potential NULL pointer dereference
Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-08 12:49:01 +01:00
Michael Brown 557f467bab [crypto] Allow certificate chains to be long-lived data structures
At present, certificate chain validation is treated as an
instantaneous process that can be carried out using only data that is
already in memory.  This model does not allow for validation to
include non-instantaneous steps, such as downloading a cross-signing
certificate, or determining certificate revocation status via OCSP.

Redesign the internal representation of certificate chains to allow
chains to outlive the scope of the original source of certificates
(such as a TLS Certificate record).

Allow for certificates to be cached, so that each certificate needs to
be validated only once.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-04 17:54:31 +01:00
Michael Brown 601cb3610f [crypto] Parse OCSP responder URI from X.509 certificate
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-05-04 15:15:34 +01:00
Kevin Tran e01cf6fb3a [http] Fix typo in memory allocation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-27 21:07:12 +01:00
Michael Brown 45e0327987 [http] Avoid using stack-allocated memory in http_step()
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>
2012-04-23 23:26:29 +01:00
Michael Brown 2f3f0ca953 [mii] Remove unused functionality
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-18 16:32:57 +01:00
Michael Brown 52e5ddce68 [tftp] Allow builds without TFTP support
Allow TFTP to be configured out by moving the next-server setting
definition (which is used by autoboot.c) from tftp.c to settings.c.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-17 11:50:11 +01:00
Stefan Weil dcccb1fb7b [tls] Fix wrong memset in function tls_clear_cipher
sizeof(cipherspec) is obviously wrong in this context, because it will
only zero the first 4 or 8 bytes (cipherspec is a pointer).

This problem was reported by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-10 13:14:15 +01:00
Michael Brown 943b3003bd [syslog] Add basic support for encrypted syslog via TLS
Encrypted syslog seems not yet to be standardised, but is supported by
some existing syslog servers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-10 11:54:31 +01:00
Michael Brown b9720e4ebf [http] Disambiguate the various error causes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 21:40:44 +01:00
Michael Brown 3ff7927d2f [syslog] Pass internal syslog() priority through to syslog console
Use a private ANSI escape sequence to convey the priority of an
internal syslog() message through to the syslog server.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 21:58:58 +01:00
Michael Brown c2875ae329 [console] Do not share ANSI escape context between lineconsole users
An ANSI escape sequence context cannot be shared between multiple
users.  Make the ANSI escape sequence context part of the line console
definition and provide individual contexts for each user.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 21:58:50 +01:00
Michael Brown 64d17dbd50 [console] Exclude text-based UI output from logfile-based consoles
The output from text-based user interfaces such as the "config"
command is not generally meaningful for logfile-based consoles such as
syslog and vmconsole.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 19:02:30 +01:00
Michael Brown e024cd39a8 [console] Allow usage to be defined independently for each console
Add the concept of a "console usage", such as "standard output" or
"debug messages".  Allow usages to be associated with each console
independently.  For example, to send debugging output via the serial
port, while preventing it from appearing on the local console:

  #define CONSOLE_SERIAL CONSOLE_USAGE_ALL
  #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG )

If no usages are explicitly specified, then a default set of usages
will be applied.  For example:

  #define CONSOLE_SERIAL

will have the same affect as

  #define CONSOLE_SERIAL CONSOLE_USAGE_ALL

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 17:40:01 +01:00
Michael Brown f2af64aba5 [crypto] Differentiate "untrusted root" and "incomplete chain" error cases
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 11:41:22 +00:00
Michael Brown 2d9d0adc4e [crypto] Add previous certificate in chain as a parameter to parse_next()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 01:34:40 +00:00
Michael Brown cf78afa5c5 [tls] Support sending a client certificate
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 20:42:51 +00:00
Michael Brown 7869f71ae7 [tls] Treat handshake digest algorithm as a session parameter
Simplify code by recording the active handshake digest algorithm as a
session parameter.  (Note that we must still accumulate digests for
all supported algorithms, since we don't know which digest will
eventually be used until we receive the Server Hello.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 17:10:39 +00:00
Michael Brown a156c15746 [tls] Use hybrid MD5+SHA1 algorithm
TLSv1.1 and earlier use a hybrid of MD5 and SHA-1 to generate digests
over the handshake messages.  Formalise this as a separate digest
algorithm "md5+sha1".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 16:57:16 +00:00
Michael Brown 8583c323a2 [tls] Check certificate validity period against current date and time
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 23:14:17 +00:00
Michael Brown 5da712385e [tls] Include current time within the client random bytes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 23:07:13 +00:00
Michael Brown f3a791c6de [tls] Validate server certificate
Validate the server certificate against the trusted root certificate
store.  The server must provide a complete certificate chain, up to
and including the trusted root certificate that is embedded into iPXE.

Note that the date and time are not yet validated.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 00:26:19 +00:00
Michael Brown 4d3b5473f8 [tls] Add full X.509 certificate parsing
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 00:22:22 +00:00
Michael Brown dc87161c30 [tls] Use iPXE native RSA algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 14:44:53 +00:00
Michael Brown 554627c960 [802.11] Use rbg_generate() for secure random numbers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 15:58:04 +00:00
Michael Brown b63bcd73a0 [tls] Use const to mark incoming data being processed
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 15:57:34 +00:00
Michael Brown 1c29b4d979 [crypto] Upgrade AES and RSA code to upstream axTLS version 1.4.5
All axTLS files are now vanilla versions of the upstream axTLS files,
with one minor exception: the unused "ctx" parameter of
bi_int_divide() has been marked with "__unused" to avoid a compilation
error.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-09 17:14:39 +00:00
Michael Brown c8f52cccfb [tls] Formalise the definition of a TLS cipher suite
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 23:13:52 +00:00
Michael Brown 6069b09bfc [tls] Support (and prefer) SHA-256 variants of existing cipher suites
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 15:36:38 +00:00
Michael Brown 015c936791 [tls] Support TLS version 1.2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 15:28:39 +00:00
Michael Brown cdb4802ff1 [802.11] Avoid using struct md5_ctx directly
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 10:18:16 +00:00
Michael Brown 4fde501e39 [802.11] Add missing #include <byteswap.h>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-04 15:14:16 +00:00
Michael Brown 281f9aa7a6 [tls] Send empty Certificate record if requested by server
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-03 22:47:16 +00:00
Michael Brown a42f6cab14 [tls] Verify the contents of the Finished record
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-03 22:29:20 +00:00
Michael Brown 56a7981d58 [tls] Allow transmitted records to be scheduled independently
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-03 22:15:25 +00:00
Michael Brown b7f8d1bbfd [tls] Add support for Server Name Indication (SNI)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-03 20:15:21 +00:00
Michael Brown d9ce3bfe4c [tls] Support TLS version 1.1
Advertise support for TLS version 1.1, and be prepared to downgrade to
TLS version 1.0.  Tested against Apache with mod_gnutls, using the
GnuTLSPriorities directive to force specific protocol versions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-03 16:19:12 +00:00
Michael Brown d620606d3e [arp] Maintain an ARP transmission queue
Allow packet transmission to be deferred pending successful ARP
resolution.  This avoids the time spent waiting for a higher-level
protocol (e.g. TCP or TFTP) to attempt retransmission.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-02 23:46:29 +00:00
Michael Brown 6324bd9389 [undi] Allow underlying PXE stack to construct link-layer header
Some PXE stacks (observed with a QLogic 8242) will always try to
prepend a link-layer header, even if the caller uses P_UNKNOWN to
indicate that the link-layer header has already been filled in.  This
results in an invalid packet being transmitted.

Work around these faulty PXE stacks where possible by stripping the
existing link-layer header and allowing the PXE stack to (re)construct
the link-layer header itself.

Originally-fixed-by: Buck Huppmann <buckh@pobox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-02 18:02:03 +00:00
Michael Brown 1d293776ea [iscsi] Send any padding inline with the data segment
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>
2012-03-01 16:33:05 +00:00
Jason Lunz cb10137e19 [http] Recognise status code 303 as valid
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>
2012-03-01 16:16:53 +00:00
Michael Brown 851b93fbc3 [syslog] Separate out generic line-based console functionality
Abstract out the generic line-handling portions of the syslog
putchar() routine, to allow use by other console types.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-28 23:10:01 +00:00
Michael Brown c72b8969e2 [syslog] Disable console when no syslog server is defined
Explicitly disable the syslog console when no syslog server is
defined, rather than (ab)using the socket family address as an
equivalent console-enabled flag.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-28 23:10:01 +00:00
Michael Brown 99de239867 [http] Allow for HTTPS-only builds
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>
2012-02-28 14:54:32 +00:00
Michael Brown 75090f2abf [tls] Use ANS X9.82 Approved RBG as source of random data for TLS
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-21 12:42:54 +00:00
Michael Brown a8756182c3 [802.11] Add missing #include <string.h>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-21 12:42:37 +00:00
Michael Brown bb36f3d7dc [udp] Propagate transmission errors to UDP interface users
Suggested-by: Simon Rowe <simon.rowe@eu.citrix.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-20 19:29:49 +00:00
Michael Brown 187cd80106 [dns] Allow trailing dots in DNS names
Reported-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-01-10 23:25:00 +00:00
Michael Brown 8926c233f6 [dhcp] Add PXE-mandated DHCP options [128,135] to parameter request list
The PXE specification requires us to request DHCP options 128 to 135
inclusive, although these have no defined purpose.

Suggested-by: Ralf Buettner <rab@bootix.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-12-06 13:54:45 +00:00
Michael Brown bd718b2110 [iscsi] Fail immediately if target rejects any of our parameters
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>
2011-12-05 20:39:07 +00:00
Michael Brown 18178b087f [infiniband] Reset port state after closing device
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-11-15 03:59:10 +00:00
Michael Brown 1e7fbc5bf3 [infiniband] Open device prior to creating SMI and GSI queue pairs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-11-15 03:59:10 +00:00
Michael Brown 774ea3d263 [infiniband] Poll event queues only for devices that are open
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-11-15 03:59:09 +00:00
Michael Brown 4f4369064b [netdevice] Allow driver to preinitialise the link-layer address
Drivers are currently expected to initialise only the hardware
address, with the link-layer protocol code taking care of converting
this into a valid link-layer address.  Some drivers (e.g. undinet) can
legitimately determine both the hardware and link-layer addresses,
which may differ.

Allow for this situation by checking to see if the link-layer address
is empty before initialising it from the hardware address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-10-28 22:32:33 +01:00
Michael Brown 38b205d0a4 [list] Tidy up naming convention for list_contains() and friends
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-10-14 14:33:31 +01:00
Michael Brown 12767d2202 [dhcp] Use a random DHCP transaction identifier (xid)
iPXE currently uses the last four bytes of the MAC address as the DHCP
transaction identifier.  Reduce the probability of collisions by
generating a random transaction identifier.

Originally-implemented-by: Amos Kong <akong@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-09-19 17:35:42 +01:00
Michael Brown 469bd11f39 [tcp] Allow sufficient headroom for TCP headers
TCP currently neglects to allow sufficient space for its own headers
when allocating I/O buffers.  This problem is masked by the fact that
the maximum link-layer header size (802.11) is substantially larger
than the common Ethernet link-layer header.

Fix by allowing sufficient space for any TCP headers, as well as the
network-layer and link-layer headers.

Reported-by: Scott K Logan <logans@cottsay.net>
Debugged-by: Scott K Logan <logans@cottsay.net>
Tested-by: Scott K Logan <logans@cottsay.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-09-19 15:52:54 +01:00
Michael Brown 149b502306 [ipv4] Improve debugging
Use autocolourisation to improve legibility, and move per-packet
messages to DBG2().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-16 01:49:47 +01:00
Michael Brown 13186b64b6 [ipv4] Fix fragment reassembly
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-16 01:49:47 +01:00
Michael Brown 17f09dfe03 [retry] Fix potential use-after-free in timer_expired()
timer->refcnt is allowed to be NULL, in which case the timer's
expired() method may end up freeing the timer object.

Discovered using valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-16 01:49:47 +01:00
Michael Brown 5b41381f33 [ipv4] Use broadcast link-layer address for all broadcast IPv4 addresses
When transmitting, use the broadcast link-layer address for any
broadcast address (e.g. 192.168.0.255), not just INADDR_BROADCAST
(255.255.255.255).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-15 19:21:07 +01:00
Michael Brown dfbb3bd184 [ipv4] Discard unwanted unicast packets
Explicitly discard any unicast packets for addresses that we do not
control, to avoid unexpected behaviour when operating in promiscuous
mode (which is now the default, thanks to FCoE).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-15 18:58:44 +01:00
Michael Brown a667bf044a [netdevice] Allow link layer to report broadcast/multicast packets via pull()
Allow the link layer to directly report whether or not a packet is
multicast or broadcast at the time of calling pull(), rather than
relying on heuristics to determine this at a later stage.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-15 18:48:46 +01:00
Malte Starostik 69b7d57265 [http] Include port in HTTP Host header as needed
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>
2011-07-15 16:46:58 +01:00
Michael Brown 1b8984eb5d [iscsi] Avoid duplicate calls to iscsi_tx_done()
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>
2011-06-29 14:52:30 +01:00
Michael Brown 00afad8122 [http] Fix size_t format specifiers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-29 11:48:29 +01:00
Michael Brown 2988b26653 [http] Support read-only HTTP block devices
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>
2011-06-28 14:45:14 +01:00
Michael Brown 5eb60f4883 [tls] Eliminate polling while TX state machine is idle
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:12 +01:00
Michael Brown bce34e87df [iscsi] Eliminate polling while waiting for window to open
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:12 +01:00
Michael Brown 3ad1a1a60a [http] Eliminate polling while waiting for window to open
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:12 +01:00
Michael Brown 019d4c1c18 [infiniband] Use a one-shot process for CMRC shutdown
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:11 +01:00
Michael Brown ce3bc9e88b [fc] Use a one-shot process for Fibre Channel name server queries
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:10 +01:00
Michael Brown 08ac74b708 [fc] Use a one-shot process for Fibre Channel ELS requests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:10 +01:00
Michael Brown e01ec74601 [process] Pass containing object pointer to process step() methods
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>
2011-06-28 14:45:08 +01:00
Michael Brown c68bf14559 [tcp] Send xfer_window_changed() when window opens
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:08 +01:00
Michael Brown 1e90ff0eb7 [infiniband] Send xfer_window_changed() when CMRC connection is established
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:07 +01:00
Michael Brown 0cc03ac76a [tls] Send xfer_window_changed() when TLS session is established
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:07 +01:00
Michael Brown 5f608a44a5 [fc] Send xfer_window_changed() when FCP link is established
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:07 +01:00
Michael Brown bf8bfa23e2 [fc] Maintain a list of Fibre Channel upper-layer protocol users
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 14:45:01 +01:00
Michael Brown 5763472b34 [ftp] Remove redundant ftp_data_deliver() method
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>
2011-06-28 13:39:14 +01:00
Michael Brown cc7c2a9dcd [ipv4] Record ARP resolution errors
At the time of attempting ARP resolution, we already know the
transmitting network device.  We can therefore record ARP errors using
netdev_tx_err() so that they show up in the output of "ifstat".

Inspired-by: Dominik Russenberger <dominik.russenberger@terreactive.ch>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 10:21:30 +01:00
Michael Brown d6115c91cf [netdevice] Allow non-completion TX errors to be recorded
Allow TX errors to be recorded against a network device even when the
packet didn't make it as far as netdev_tx().

Inspired-by: Dominik Russenberger <dominik.russenberger@terreactive.ch>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-06-28 10:19:23 +01:00
Michael Brown c1cc769ef4 [ipv4] Include network device metadata in packet traces
(Ab)use the "ident" field in transmitted IPv4 packets to convey
metadata about the network device.  In particular:

    bits 0-3 represent the low bits of the "RX" good packet counter
    bits 4-7 represent the low bits of the "RXE" bad packet counter
    bits 8-15 represent the transmitted packet sequence number

This allows some relevant information about the internal state of the
network device to be read out from a packet trace from a non-debug
build of iPXE.  In particular, it allows a packet trace containing
packets transmitted by iPXE to indicate whether or not any packets
have been received by iPXE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-05-05 18:10:31 +01:00
Michael Brown 8f51db233a [http] Support chunked transfer encoding
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>
2011-05-05 15:32:34 +01:00
Michael Brown 0b6808aadc [netdevice] Improve detection of bugs in drivers' TX completion handling
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-05-03 20:07:30 +01:00
Michael Brown 9e3604168a [netdevice] Move high-frequency debug messages to DBGLVL_EXTRA
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-05-03 20:01:11 +01:00
Michael Brown c4369eb6c2 [tcp] Update ts_recent whenever window is advanced
Commit 3f442d3 ("[tcp] Record ts_recent on first received packet")
failed to achieve its stated intention.

Fix this (and reduce the code size) by moving the ts_recent update to
tcp_rx_seq().  This is the code responsible for advancing the window,
called by both tcp_rx_syn() and tcp_rx_data(), and so the window check
is now redundant.

Reported-by: Frank Weed <zorbustheknight@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-04-03 00:44:22 +01:00
Michael Brown 58dcb2e15e [tftp] Avoid setting current working URI to "tftp://0.0.0.0/"
Set the current working URI to NULL rather than to "tftp://0.0.0.0/".

Reported-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-31 04:54:27 +01:00
Michael Brown 1588b9336e [netdevice] Simplify link-down status message
For devices that start in a link-down state, the user will see a
message such as:

  [Link status: The socket is not connected (http://ipxe.org/38086001)]
  Waiting for link-up on net0...

This is potentially misleading, since it suggests that there is a
genuine problem.  Add a dedicated error message for "link down",
giving instead:

  [Link status: Down (http://ipxe.org/38086101)]
  Waiting for link-up on net0...

Reported-by: Tal Aloni <tal.aloni.il@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-30 12:45:12 +01:00
Piotr Jaroszyński 8ab2f51997 [netdevice] Mark devices as open only if opening succeeds
netdev_close() assumes that devices that are open are on the
open_list, which wasn't true if device specific opening failed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-27 18:59:13 +01:00
Michael Brown 3f442d3f60 [tcp] Record ts_recent on first received packet
Commit 6861304 ("[tcp] Handle out-of-order received packets")
introduced a regression in which ts_recent would not be updated until
the first packet is received in the ESTABLISHED state, i.e. the
timestamp from the SYN+ACK packet would be ignored.  This causes the
connection to be dropped by strictly-conforming TCP peers, such as
FreeBSD.

Fix by delaying the timestamp window check until after processing the
received SYN flag.

Reported-by: winders@sonnet.com
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-26 15:02:41 +00:00
Michael Brown 02a6f46c09 [settings] Match terminology in online documentation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-23 21:21:12 +00:00
Michael Brown 8482451812 [settings] Impose a fixed order on settings
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>
2011-03-23 11:57:29 +00:00
Michael Brown a04603a070 [settings] Reject attempts to change a network device's bus ID
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-23 01:25:17 +00:00
Michael Brown f5fd4dec3b [settings] Formalise notion of setting applicability
Expose a function setting_applies() to allow a caller to determine
whether or not a particular setting is applicable to a particular
settings block.

Restrict DHCP-backed settings blocks to accepting only DHCP-based
settings.

Restrict network device settings blocks to accepting only DHCP-based
settings and network device-specific settings such as "mac".

Inspired-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-22 19:54:58 +00:00
Michael Brown e49d81689c [syslog] Add support for sending console output to a syslog server
Originally-implemented-by: Anselm Martin Hoffmeister <anselm@hoffmeister.be>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-10 05:36:31 +00:00
Michael Brown 960dee6dd0 [iscsi] Change default initiator IQN
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>
2011-03-03 22:23:44 +00:00
Michael Brown bbe265e08b [dns] Fix memory leak in settings applicator
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-03 20:09:29 +00:00
Michael Brown ef87c4ad08 [iscsi] Clarify support for NOP-In
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>
2011-02-25 11:11:30 +00:00
Michael Brown 9625132bf5 [iscsi] Verify the correct tag in NOP-In PDUs
We should be checking the target transfer tag, rather than the
initiator task tag.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-02-25 10:41:23 +00:00
Michael Brown 711df439df [iscsi] Accept NOP-In PDUs sent by the target
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>
2011-02-24 13:25:32 +00:00
Michael Brown 7ef314514c [iscsi] Disambiguate the expected target errors in the login response
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-02-23 09:52:02 +00:00
Michael Brown 66caec3f00 [netdevice] Allow devices to indicate that interrupts are not supported
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-25 14:16:11 +00:00
Michael Brown 17d28f4877 [nvo] Allow resizing of non-volatile stored option blocks
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-19 13:52:48 +00:00
Michael Brown 17b6a3c506 [dhcp] Allow use of custom reallocation functions for DHCP option blocks
Allow functions other than realloc() to be used to reallocate DHCP
option block data, and specify the reallocation function at the time
of calling dhcpopt_init().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-11 21:24:40 +00:00
Michael Brown 310d46c1ed [dhcp] Rename length fields for DHCP options
Rename "len" to "used_len" and "max_len" to "alloc_len".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-10 03:39:26 +00:00
Michael Brown 6cee8904d1 [dhcp] Remove redundant length fields in struct dhcp_packet
The max_len field is never used, and the len field is used only by
dhcp_tx().  Remove these two fields, and perform the necessary trivial
calculation in dhcp_tx() instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-10 03:39:26 +00:00
Michael Brown 708c5060b9 [dhcp] Use Ethernet-compatible chaddr, if possible
For IPoIB, we currently use the hardware address (i.e. the eight-byte
GUID) as the DHCP chaddr.  This works, but some PXE servers (notably
Altiris RDP) refuse to respond if the chaddr field is anything other
than six bytes in length.

We already have the notion of an Ethernet-compatible link-layer
address, which is used in the iBFT (the design of which similarly
fails to account for non-Ethernet link layers).  Use this as the first
preferred alternative to the actual link-layer address when
constructing the DHCP chaddr field.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-15 18:46:19 +00:00
Michael Brown 5273c2748c [vlan] Expose vlan_find() to network card drivers
Some network cards automatically strip the VLAN header, providing the
VLAN tag via a side channel such as a completion queue entry.  These
cards need to be able to report receive completions directly against
the relevant VLAN device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 18:46:50 +00:00
Michael Brown 51a9e517f2 [vlan] Use "-" instead of "." as separator in VLAN device names
VLAN device names have the form "netX.Y", e.g. "net0.5" for VLAN 5 on
net0.  This use of "." conflicts with the use of "." as the
hierarchical separator in settings block names, with the result that
VLAN device settings cannot be accessed by name.

It would be trivial to treat the VLAN device settings as being a child
of the trunk device settings, but this would cause the VLAN device
settings to be applied to the trunk device: for example, setting
"net0.5/ip" would then apply the IP address to both net0.5 and net0.

Fix by changing the VLAN device name to use "-" instead of ".": the
VLAN device "net0.5" is now "net0-5".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 17:15:52 +00:00
Michael Brown 67b45186a5 [settings] Apply settings block name in register_settings()
Pass the settings block name as a parameter to register_settings(),
rather than defining it with settings_init() (and then possibly
changing it by directly manipulating settings->name).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 16:35:00 +00:00
Michael Brown de6a59470b [iscsi] Disambiguate the common EINVAL cases
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 01:23:50 +00:00
Michael Brown 34dab1007c [dns] Disambiguate "no nameserver" and "no DNS record" errors
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 00:47:09 +00:00
Michael Brown 54ec712ebe [fcoe] Use only the first instance of a FIP descriptor
Almost all FIP packets contain at most one instance of each
descriptor.  A VLAN notification may contain multiple VLAN
descriptors.  The FCoE specification does not provide any guidance
regarding prioritisation of VLANs, so we may choose to arbitrarily
choose the first listed VLAN.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-27 16:04:57 +00:00
Michael Brown 98817e2c38 [fcoe] Tidy up debug message
The increase in length in Fibre Channel device names causes the
"selected FCF" message to wrap beyond 80 characters.  Fix by using
abbreviations where possible.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-27 16:04:57 +00:00
Michael Brown 1415ec9c9a [fc] Allow Fibre Channel ports to be explicitly named
Use the network interface name as the Fibre Channel port name.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-27 14:37:53 +00:00
Michael Brown d17e87da7d [fcoe] Create Fibre Channel port only when we have selected an FCF
Create the Fibre Channel port only when the FCoE port has selected a
Fibre Channel Forwarder to use.  This avoids the confusion of having
an FC port created for the network device on which only VLAN discovery
is performed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-27 14:21:08 +00:00
Michael Brown 1790f56fb2 [fcoe] Add support for FIP VLAN discovery
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-26 01:09:41 +00:00
Michael Brown b4706c88c9 [vlan] Provide vlan_can_be_trunk()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-26 01:09:40 +00:00
Michael Brown f1e1545372 [vlan] Add non-error debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-26 01:09:40 +00:00
Michael Brown 7e1b1d6145 [vlan] Allow duplicate VLAN creation attempts
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-26 01:09:35 +00:00
Michael Brown 6fd09b541f [vlan] Add support for IEEE 802.1Q VLANs
Originally-implemented-by: michael-dev@fami-braun.de
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-20 16:52:04 +00:00
Michael Brown 4576c2da58 [netdevice] Allow per-device receive queue processing to be frozen
Several use cases (e.g. the UNDI API and the EFI SNP API) require
access to the raw network device receive queue, and so currently use
manual calls to netdev_poll() on a specific network device in order to
prevent received packets from being processed by the network stack.

As an alternative, provide a flag that allows receive queue processing
to be frozen on a per-device basis.  When receive queue processing is
frozen, packets will be enqueued as normal, but will not be
automatically dequeued and passed up the network stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-20 15:46:00 +00:00
Michael Brown d012f87018 [tcp] Use MAX_LL_NET_HEADER_LEN instead of defining our own MAX_HDR_LEN
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown 5de4fba4f9 [udp] Use MAX_LL_NET_HEADER_LEN instead of defining our own UDP_MAX_HLEN
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown 3d9096f719 [lacp] Fix dumping of raw LACP packets
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-18 17:41:44 +00:00
Michael Brown 24fc6aa5b0 [netdevice] Use net device name in debugging messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-18 17:41:02 +00:00
Michael Brown 67dc832d15 [tcp] Set PSH flag only on packets containing data
Suggested-by: Yelena Kadach <klenusik@hotmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-11 01:14:05 +00:00
Shao Miller 98b3599a65 [list] Fix typographical error from previous commit
Fix typographical error from commit ea631f6 ("[list] Add
list_first_entry()").  The symptom was PXELINUX 3.86 causing a stack
overflow under VMware.

Tested-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-11 00:30:22 +00:00
Michael Brown 8e718df5e1 [fc] Add support for Fibre Channel name server lookups
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:36 +00:00
Michael Brown 41231fda9c [fc] Hold ULP's peer reference while ULP exists
Allow fc_ulp_decrement() to guarantee to fc_peer_decrement() that the
peer reference remains valid for the duration of the call, by ensuring
that ulp->peer remains valid while ulp is valid.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:36 +00:00
Michael Brown 0cd185e734 [fc] Allow peers and ULPs to log out when usage count reaches zero
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:36 +00:00
Michael Brown c09f87e3b7 [fc] Hold reference to peers and ULPs while calling fc_link_examine()
Allow link examination methods to safely assume that their
self-reference remains valid for the duration of the method call.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:36 +00:00