aboutsummaryrefslogtreecommitdiff
path: root/src/net/ipv4.c
AgeCommit message (Collapse)AuthorFilesLines
2014-04-28[ipv4] Profile transmit and receive datapathsMichael Brown1-0/+15
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04[tcpip] Provide tcpip_mtu() to determine the maximum transmission unitMichael Brown1-0/+1
Provide the function tcpip_mtu() to allow external code to determine the (transport-layer) maximum transmission unit for a given socket address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04[tcpip] Provide tcpip_netdev() to determine the transmitting network deviceMichael Brown1-0/+20
Provide the function tcpip_netdev() to allow external code to determine the transmitting network device for a given socket address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-02[tcpip] Add IP statistics collection as per RFC 4293Michael Brown1-10/+45
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-05[settings] Merge SETTING_IPv4 and SETTING_IPv6Michael Brown1-3/+3
Allow for equivalent IPv4 and IPv6 settings (which requires equivalent settings to be adjacent within the settings list). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-05[settings] Force settings into alphabetical order within sectionsMichael Brown1-3/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-05[settings] Allow for IPv6 setting types in non-IPv6 buildsMichael Brown1-0/+45
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[settings] Explicitly separate the concept of a completed fetched settingMichael Brown1-3/+3
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-10-21[icmp] Add support for sending ICMP echo requestsMichael Brown1-2/+2
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[ipv4] Add IPv4 socket address converterMichael Brown1-0/+37
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03[ipv6] Replace IPv6 stackMichael Brown1-1/+1
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[tcpip] Pass through network device to transport layer protocolsMichael Brown1-1/+1
NDP requires knowledge of the network device on which a packet was received. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-27[ipv4] Generalise fragment reassembly mechanismMichael Brown1-117/+39
Generalise the concept of fragment reassembly to allow for code sharing between IPv4 and IPv6 protocols. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20[dhcp] Request broadcast responses when we already have an IPv4 addressMichael Brown1-1/+1
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-03-02[arp] Maintain an ARP transmission queueMichael Brown1-46/+38
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>
2011-07-16[ipv4] Improve debuggingMichael Brown1-45/+51
Use autocolourisation to improve legibility, and move per-packet messages to DBG2(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-16[ipv4] Fix fragment reassemblyMichael Brown1-92/+120
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-07-15[ipv4] Use broadcast link-layer address for all broadcast IPv4 addressesMichael Brown1-7/+7
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[ipv4] Discard unwanted unicast packetsMichael Brown1-10/+50
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[netdevice] Allow link layer to report broadcast/multicast packets via pull()Michael Brown1-5/+8
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-06-28[ipv4] Record ARP resolution errorsMichael Brown1-0/+2
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-05-05[ipv4] Include network device metadata in packet tracesMichael Brown1-3/+10
(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-03-23[settings] Match terminology in online documentationMichael Brown1-2/+2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-23[settings] Impose a fixed order on settingsMichael Brown1-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>
2010-10-07[netdevice] Pass both link-layer addresses in net_tx() and net_rx()Michael Brown1-2/+6
FCoE requires the use of fabric-provided MAC addresses, which breaks the assumption that the net device's MAC address is implicitly the source address for net_tx() and the (unicast) destination address for net_rx(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-03[retry] Hold reference while timer is running and during expiry callbackMichael Brown1-1/+1
Guarantee that a retry timer cannot go out of scope while the timer is running, and provide a guarantee to the expiry callback that the timer will remain in scope during the entire callback (similar to the guarantee provided to interface methods). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-20[build] Fix misaligned table entries when using gcc 4.5Piotr Jaroszyński1-2/+0
Declarations without the accompanying __table_entry cause misalignment of the table entries when using gcc 4.5. Fix by adding the appropriate __table_entry macro or (where possible) by removing unnecessary forward declarations. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22[retry] Use start_timer_fixed() instead of direct timeout manipulationMichael Brown1-2/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22[retry] Add timer_init() wrapper functionMichael Brown1-1/+1
Standardise on using timer_init() to initialise an embedded retry timer, to match the coding style used by other embedded objects. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19[build] Rename gPXE to iPXEMichael Brown1-10/+10
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>
2010-03-23[netdevice] Add netdev_is_open() wrapper functionMichael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-11-16[ipv4] Ignore non-open net devices when performing routingMichael Brown1-0/+2
We do not discard routing table entries when closing an interface. It is plausible that multiple interfaces may be on the same physical network; if so, then we may end up in a situation whereby outbound packets attempt to route via a closed interface. Fix by ignoring non-open net devices in ipv4_route().
2009-11-16[ipv4] Allow calculation of default subnet maskMichael Brown1-11/+11
ipv4.c calculates the default subnet mask before calling fetch_ipv4_setting() to retrieve the configured subnet mask (if any). However, as of commit 612f4e7 "[settings] Avoid returning uninitialised data on error in fetch_xxx_setting()", fetch_ipv4_setting() will zero the IP address if the setting does not exist, rather than leaving it unaltered. Fix by fetching the setting first and calculating the default subnet mask only if necessary.
2009-11-16[ipv4] Use a zero address to indicate "no gateway", rather than INADDR_NONEMichael Brown1-7/+6
ipv4.c uses a gateway address of INADDR_NONE to represent "no gateway". It initialises the gateway address to INADDR_NONE before calling fetch_ipv4_setting() to retrieve the configured gateway address (if any). However, as of commit 612f4e7 "[settings] Avoid returning uninitialised data on error in fetch_xxx_setting()", fetch_ipv4_setting() will zero the IP address if the setting does not exist, rather than leaving it unaltered. Fix by using a zero IP address to indicate "no gateway", so that a non-existent gateway address setting will be treated as such.
2009-07-17[netdevice] Make ll_broadcast per-netdevice rather than per-ll_protocolMichael Brown1-1/+1
IPoIB has a link-layer broadcast address that varies according to the partition key. We currently go through several contortions to pretend that the link-layer address is a fixed constant; by making the broadcast address a property of the network device rather than the link-layer protocol it will be possible to simplify IPoIB's broadcast handling.
2009-05-18[legal] Add a selection of FILE_LICENCE declarationsMichael Brown1-0/+2
Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
2009-02-17[icmp] Add support for responding to pingsMichael Brown1-0/+3
2009-01-21[tcpip] Allow for transmission to multicast IPv4 addressesMichael Brown1-1/+8
When sending to a multicast address, it may be necessary to specify the source address explicitly, since the multicast destination address does not provide enough information to deduce the source address via the miniroute table. Allow the source address specified via the data-xfer metadata to be passed down through the TCP/IP stack to the IPv4 layer, which can use it as a default source address.
2008-11-18[build] Keep gcc 4.4 happyMichael Brown1-1/+1
gcc 4.4 adds another few warnings, and also seems to complain if we place %ebp in the clobber list for any inline asm.
2008-10-16[netdevice] Split multicast hashing out into an mc_hash methodMichael Brown1-12/+1
Multicast hashing is an ugly overlap between network and link layers. EFI requires us to provide access to this functionality, so move it out of ipv4.c and expose it as a method of the link layer.
2008-05-19[IPv4] Fix multicast address checkingMichael Brown1-1/+1
From: Viswanath Krishnamurthy <viswa.krish@gmail.com> The current ipv4 incorrectly checks the IP address for multicast address. This causes valid IPv4 unicast address to be trated as multicast address For e.g if the PXE/tftp server IP address is 192.168.4.XXX where XXX is 224 or greater, it gets treated as multicast address and a ethernet multicast address is sent out on the wire causing timeouts
2008-03-25[Settings] Remove assumption that all settings have DHCP tag valuesMichael Brown1-56/+87
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.
2008-03-23[IPv4] Use default netmasks when no subnet mask is specified.Michael Brown1-7/+20
2008-03-21[Settings] Use a settings applicator to configure IPv4 routes.Michael Brown1-32/+36
2007-12-07Various warnings fixups for OpenBSD with gcc-3.3.5.Michael Brown1-8/+8
2007-08-20use malloc attributeHolger Lubitz1-4/+3
2007-07-03Never attempt to route the broadcast address.Michael Brown1-0/+8
2007-06-27Kill off hotplug.h and just make net devices normal reference-countedMichael Brown1-20/+2
structures. DHCP still broken and #if 0'd out.
2007-05-19pkbuff->iobuf changeoverMichael Brown1-50/+50
Achieved via Perl using: perl -pi -e 's/pk_buff/io_buffer/g; s/Packet buffer/I\/O buffer/ig; ' \ -e 's/pkbuff\.h/iobuf.h/g; s/pkb_/iob_/g; s/_pkb/_iob/g; ' \ -e 's/pkb/iobuf/g; s/PKB/IOB/g;'
2007-01-19Use stdio.h instead of vsprintf.hMichael Brown1-1/+1