summaryrefslogtreecommitdiffstats
path: root/src/net/ethernet.c
Commit message (Collapse)AuthorAgeFilesLines
* [ethernet] Use standard 1500 byte MTU unless explicitly overriddenMichael Brown2018-07-171-0/+1
| | | | | | | | | | | | | Devices that support jumbo frames will currently default to the largest possible MTU. This assumption is valid for virtual adapters such as virtio-net, where the MTU must have been configured by a system administrator, but is unsafe in the general case of a physical adapter. Default to the standard Ethernet MTU, unless explicitly overridden either by the driver or via the ${netX/mtu} setting. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ethernet] Make LACP support configurable at build timeMichael Brown2016-04-181-3/+0Star
| | | | | | | Add a build configuration option NET_PROTO_LACP to control whether or not LACP support is included for Ethernet devices. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ethernet] Add minimal support for receiving LLC framesMichael Brown2015-06-251-2/+36
| | | | | | | | | | | | | | | In some Ethernet framing variants the two-byte protocol field is used as a length, with the Ethernet header being followed by an IEEE 802.2 LLC header. The first two bytes of the LLC header are the DSAP and SSAP. If the received Ethernet packet appears to use this framing, then interpret the two-byte DSAP and SSAP as being the network-layer protocol. This allows support for receiving Spanning Tree Protocol frames (which use an LLC header with {DSAP,SSAP}=0x4242) to be added without requiring a full LLC protocol layer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix the REQUIRE_SYMBOL mechanismMichael Brown2015-03-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | At some point in the past few years, binutils became more aggressive at removing unused symbols. To function as a symbol requirement, a relocation record must now be in a section marked with @progbits and must not be in a section which gets discarded during the link (either via --gc-sections or via /DISCARD/). Update REQUIRE_SYMBOL() to generate relocation records meeting these criteria. To minimise the impact upon the final binary size, we use existing symbols (specified via the REQUIRING_SYMBOL() macro) as the relocation targets where possible. We use R_386_NONE or R_X86_64_NONE relocation types to prevent any actual unwanted relocation taking place. Where no suitable symbol exists for REQUIRING_SYMBOL() (such as in config.c), the macro PROVIDE_REQUIRING_SYMBOL() can be used to generate a one-byte-long symbol to act as the relocation target. If there are versions of binutils for which this approach fails, then the fallback will probably involve killing off REQUEST_SYMBOL(), redefining REQUIRE_SYMBOL() to use the current definition of REQUEST_SYMBOL(), and postprocessing the linked ELF file with something along the lines of "nm -u | wc -l" to check that there are no undefined symbols remaining. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use REQUIRE_OBJECT() to drag in per-object configurationMichael Brown2015-03-051-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | | | | These files cannot be automatically relicensed by util/relicense.pl since they either contain unusual but trivial contributions (such as the addition of __nonnull function attributes), or contain lines dating back to the initial git revision (and so require manual knowledge of the code's origin). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ethernet] Provide eth_random_addr() to generate random Ethernet addressesHannes Reinecke2014-06-021-0/+16
| | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ethernet] Add support for generating multicast hash for IPv6 addressesMichael Brown2013-09-031-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Add method for generating EUI-64 address from link-layer addressMichael Brown2013-09-031-0/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ethernet] Expose eth_broadcast as a global constantMichael Brown2012-08-311-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-201-1/+2
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Allow underlying PXE stack to construct link-layer headerMichael Brown2012-03-021-7/+6Star
| | | | | | | | | | | | | | 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>
* [netdevice] Allow link layer to report broadcast/multicast packets via pull()Michael Brown2011-07-151-1/+7
| | | | | | | | 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>
* [lacp] Add simple LACP implementationMichael Brown2010-05-101-0/+3
| | | | | | | | | | Some switch configurations will refuse to enable our port unless we can speak LACP to inform the switch that we are alive. Add a very simple passive LACP implementation that is sufficient to convince at least Linux's bonding driver (when tested using qemu attached to a tap device enslaved to a bond device configured as "mode=802.3ad"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Rename gPXE to iPXEMichael Brown2010-04-201-6/+6
| | | | | | | | | | | 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>
* [netdevice] Add the concept of an "Ethernet-compatible" MAC addressMichael Brown2009-10-231-0/+12
| | | | | | | | | | | | | | The iBFT is Ethernet-centric in providing only six bytes for a MAC address. This is most probably an indirect consequence of a similar design flaw in the Windows NDIS stack. (The WinOF IPoIB stack performs all sorts of contortions in order to pretend to the NDIS layer that it is dealing with six-byte MAC addresses.) There is no sensible way in which to extend the iBFT without breaking compatibility with programs that expect to parse it. Add the notion of an "Ethernet-compatible" MAC address to our link layer abstraction, so that link layers can provide their own workarounds for this limitation.
* [802.11] Support multicast hashingMichael Brown2009-08-121-2/+1Star
| | | | | | | 802.11 multicast hashing is the same as standard Ethernet hashing, so just expose and use eth_mc_hash(). Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
* [netdevice] Allow the hardware and link-layer addresses to differ in sizeMichael Brown2009-08-121-0/+12
| | | | | | | | | | IPoIB has a 20-byte link-layer address, of which only eight bytes represent anything relating to a "hardware address". The PXE and EFI SNP APIs expect the permanent address to be the same size as the link-layer address, so fill in the "permanent address" field with the initial link layer address (as generated by register_netdev() based upon the real hardware address).
* [netdevice] Make ll_broadcast per-netdevice rather than per-ll_protocolMichael Brown2009-07-181-1/+18
| | | | | | | | | 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.
* [netdevice] Add netdev argument to link-layer push and pull handlersJoshua Oreman2009-06-231-2/+6
| | | | | | | | | | | | | | | In order to construct outgoing link-layer frames or parse incoming ones properly, some protocols (such as 802.11) need more state than is available in the existing variables passed to the link-layer protocol handlers. To remedy this, add struct net_device *netdev as the first argument to each of these functions, so that more information can be fetched from the link layer-private part of the network device. Updated all three call sites (netdevice.c, efi_snp.c, pxe_undi.c) and both implementations (ethernet.c, ipoib.c) of ll_protocol to use the new argument. Signed-off-by: Michael Brown <mcb30@etherboot.org>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-181-0/+2
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [ethernet] Fix eth_mc_hash() return statusMichael Brown2009-01-211-0/+1
| | | | | eth_mc_hash() was missing a return within a switch statement, and so always falling through to the default case and returning failure.
* [netdevice] Change link-layer push() and pull() methods to take raw typesMichael Brown2008-10-161-14/+14
| | | | | | | | | | EFI requires us to be able to specify the source address for individual transmitted packets, and to be able to extract the destination address on received packets. Take advantage of this to rationalise the push() and pull() methods so that push() takes a (dest,source,proto) tuple and pull() returns a (dest,source,proto) tuple.
* [netdevice] Split multicast hashing out into an mc_hash methodMichael Brown2008-10-161-2/+30
| | | | | | 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.
* [undi] Fill in ProtType correctly in PXENV_UNDI_ISRMichael Brown2008-08-201-19/+21
| | | | | | | | | Determine the network-layer packet type and fill it in for UNDI clients. This is required by some NBPs such as emBoot's winBoot/i. This change requires refactoring the link-layer portions of the gPXE netdevice API, so that it becomes possible to strip the link-layer header without passing the packet up the network stack.
* Various warnings fixups for OpenBSD with gcc-3.3.5.Michael Brown2007-12-071-1/+1
|
* Add untested support for UNDI transmit and receive.Michael Brown2007-07-021-0/+1
|
* pkbuff->iobuf changeoverMichael Brown2007-05-191-13/+13
| | | | | | | | 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;'
* Use stdio.h instead of vsprintf.hMichael Brown2007-01-191-1/+1
|
* Made eth_ntoa() public for use in legacy drivers' DBG() statements.Michael Brown2006-09-151-1/+1
|
* Remove _PROTOCOL macros for gcc 3.2 compatibilityMarty Connor2006-08-091-3/+1Star
|
* Clarified packet ownership transfer between a few functions.Michael Brown2006-08-091-3/+5
| | | | | | | | | | | | | Added a large number of missing calls to free_pkb(). In the case of UDP, no received packets were ever freed, which lead to memory exhaustion remarkably quickly once pxelinux started up. In general, any function with _rx() in its name which accepts a pk_buff *must* either call free_pkb() or pass the pkb to another _rx() function (e.g. the next layer up the stack). Since the UDP (and TCP) layers don't pass packet buffers up to the higher-layer protocols (the "applications"), they must free the packet buffer after calling the application's newdata() method.
* Simplify RX data path.Michael Brown2006-06-181-22/+24
| | | | | | | | | | Kill off the static single net device and move to proper dynamic registration (which we need with the new device model). Break the (flawed) assumption that all network-layer protocols can use ARP; such network-layer protocols (i.e. IPv4) must now register as an ARP protocol using ARP_NET_PROTOCOL() and provide a single method for checking the existence of a local network-layer address.
* For consistencyMichael Brown2006-06-161-1/+1
|
* Simplify TX datapath.Michael Brown2006-06-161-71/+23Star
|
* Tidied up debugging messagesMichael Brown2006-05-271-1/+1
|
* Rewrote printf and friends to better support standard C semantics.Michael Brown2006-05-141-0/+1
|
* Network layer now works as a proof of conceptMichael Brown2006-04-281-9/+32
|
* Network API now allows for multiple network devices (although theMichael Brown2006-04-241-48/+69
| | | | | | | | | | | | | implementation allows for only one, and does so without compromising on the efficiency of static allocation). Link-layer protocols are cleanly separated from the device drivers. Network-layer protocols are cleanly separated from individual network devices. Link-layer and network-layer protocols are cleanly separated from each other.
* Remove the concept of the media-independent link-layer header and replaceMichael Brown2006-04-191-0/+116
it with metadata in the pkb structure. This is required since UNDI will want to be able to parse the link-layer header without destroying it.