summaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Collapse)AuthorFilesLines
2024-05-05rng: Introduce SPL_DM_RNGMarek Vasut1-1/+1
Add SPL variant of DM_RNG so that the DM_RNG can be disabled in SPL if necessary. This may be necessary due to e.g. size constraints of the SPL. Signed-off-by: Marek Vasut <marex@denx.de>
2024-05-03net: consider option-length when parsing NIS domainHeinrich Schuchardt1-1/+1
When parsing option 40 (network information service domain) the option length is in variable 'oplen' and not in 'size'. Addresses-Coverity-ID: 492765 Uninitialized variables (UNINIT) Fixes: 8ab388bfdbcf ("net: add support to parse the NIS domain for the dhcp options") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-18net: add support to parse the NIS domain for the dhcp optionsCharles Hardin1-0/+8
There is code in the bootp parsing for NIS domain and add the same support for the dhcp options as well. This allows the same usage of the data when the dhcp command is used in the boot command. Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2024-04-16net: wget: fix TCP sequence number wrap around issueYasuharu Shibata1-3/+1
If tcp_seq_num is wrap around, tcp_seq_num >= initial_data_seq_num isn't satisfied and store_block() isn't called. The condition has a wrap around issue, so it is fixed in this patch. Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Suggested-by: Michael Trimarchi <michael@amarulasolutions.com> Reported-by: Tim Harvey <tharvey@gateworks.com> Tested-by: Fabio Estevam <festevam@denx.de>
2024-04-16net: wget: Support retransmission a dropped packetYasuharu Shibata1-2/+10
The server sends multiple packets without waiting for an ACK by window control and if some packets are dropped, wget will return an ACK including the dropped packets. Following log indicates this issue. wget_handler() wget: Transferring, seq=97bbdd4a, ack=30,len=580 wget_handler() wget: Transferring, seq=97bbedca, ack=30,len=580 First packet of TCP sequence number is 0x97bbdd4a. Second packet of TCP sequence number should be 0x97bbe2ca, however it is 0x97bbedca and returns its ACK, so the server suppose that 0x97bbe2ca and 0x97bbedca are received appropriately. In this case, 0x97bbe2ca was lost and the data of wget was broken. In this patch, next_data_seq_num holds the next expected TCP sequence number. If the TCP sequence number different from next_data_seq_num, trying to retransmit the packet. Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com> Tested-by: Fabio Estevam <festevam@gmail.com>
2024-04-10net: nfs: fix file handle length in NFSv3Sébastien Szymanski1-5/+13
The NFS protocol uses file handles to refer to file or directory. In NFSv2 file handles have a fixed size of 32 bytes. In NFSv3 file handles have a variable length up to 64 bytes. This is also true for the MOUNT protocol. [1] When the NFSv3 server replies with a file handle length > 32 bytes, U-Boot only copies 32 bytes of that file handle and the next LOOKUP Call fails: BIOS> nfs ${loadaddr} 192.168.1.51:/nfsroot/opos93dev-br/boot/Image Using ethernet@428a0000 device File transfer via NFS from server 192.168.1.51; our IP address is 192.168.1.133 Filename '/nfsroot/opos93dev-br/boot/Image'. Load address: 0x80400000 Loading: *** ERROR: File lookup fail done BIOS> Looking at this transfer in Wireshark, we can see that the server replies with the following file handle: length: 36 [hash (CRC-32): 0x230ac67b] FileHandle: 0100070101005e000000000091763911f87c449fa73c298552db19ba0c9f60002980cfd2 and U-Boot sends the following file handle in the next LOOKUP Call: length: 32 [hash (CRC-32): 0x6314131b] FileHandle: 000000240100070101005e000000000091763911f87c449fa73c298552db19ba Fix this by using a variable length file handle for dirfh. [1] https://www.rfc-editor.org/rfc/rfc1813.html#page-106 Fixes: b0baca982048 ("net: NFS: Add NFSv3 support") Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com> Tested-by: Andrew Davis <afd@ti.com>
2024-03-26net: mdio-uclass: Bind and probe generic Ethernet PHY driverRoger Quadros1-0/+41
If DM_ETH_PHY is enabled then try to bind and probe the generic Ethernet PHY driver for each child of MDIO bus. This is to ensure that GPIO reset handling is done if available before MDIO bus driver scans for the PHYs. Signed-off-by: Roger Quadros <rogerq@kernel.org>
2024-03-07net: mdio: Handle bus level GPIO ResetRoger Quadros1-1/+36
Some platforms have bus level Reset controlled by a GPIO line. If available then handle bus reset via GPIO. Signed-off-by: Roger Quadros <rogerq@kernel.org>
2024-01-17net: tftp: remove explicit efi configuration dependencyAKASHI Takahiro1-6/+4
Now it is clear that the feature actually depends on efi interfaces, not "bootefi" command. efi_set_bootdev() will automatically be nullified if necessary efi component is disabled. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-01-09fastboot: multiresponse supportIon Agorria1-6/+23
Currently u-boot fastboot can only send one message back to host, so if there is a need to print more than one line messages must be kept sending until all the required data is obtained. This behavior can be adjusted using multiresponce ability (getting multiple lines of response) proposed in this patch. Signed-off-by: Ion Agorria <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240105072212.6615-2-clamor95@gmail.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-01-03Merge tag 'v2024.01-rc6' into nextTom Rini2-5/+11
Prepare v2024.01-rc6
2023-12-21global: Drop common.h inclusionTom Rini4-8/+1
In order to make it easier to move on to dropping common.h from code directly, remove common.h inclusion from the rest of the header file which had been including it. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-19net: fix NetConsole documentation referenceBaruch Siach1-1/+1
Fixes: d0253f7e5ca1 ("doc: move README.NetConsole to HTML documentation") Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-12-19net: wget: Support non-default HTTP portMarek Vasut1-4/+10
Currently the wget command is hard wired to HTTP port 80. This is inconvenient, as it is extremely easy to start trivial HTTP server as an unprivileged user using e.g. python http module to serve the files, but such a server has to run on one of the higher ports: " $ python3 -m http.server -d $(pwd) 8080 " Make it possible to configure HTTP server port the same way it is possible to configure TFTP server port, using environment variable 'httpdstp' (similar to 'tftpdstp'). Retain port 80 as the default fallback port. This way, users can start their own trivial server and conveniently download whatever files they need into U-Boot. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-11-22net: Make NET imply NETDEVICESTom Rini1-0/+1
Normally, when NET is enabled, CMD_NET will then be enabled and in turn NETDEVICES will (likely) be enabled via imply. However, if we disable CMDLINE in a defconfig we now no longer get CMD_NET enabling NETDEVICES for us. This suggestion (as an imply is) really isn't about the network commands but network itself and is a legacy of how intertwined NET/CMD_NET were historically. Move this over to the NET entry instead where it is a more logical fit. Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2023-11-18cmd: efidebug: add uri device pathMasahisa Kojima1-0/+71
This adds the URI device path option for 'boot add' subcommand. User can add the URI load option for downloading ISO image file or EFI application through network. Currently HTTP is only supported. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-11-18net: wget: add wget with dns utility functionMasahisa Kojima1-0/+54
Current wget takes the target uri in this format: "<http server ip>:<file path>" e.g.) 192.168.1.1:/bar The http server ip address must be resolved before calling wget. This commit adds the utility function runs wget with dhs. User can call wget with the uri like "http://foo/bar". Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-11-18net: wget: prevent overwriting reserved memoryMasahisa Kojima1-7/+73
This introduces the valid range check to store the received blocks using lmb. The same logic is implemented in tftp. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-11-05net: eth-uclass: Improve error message when MAC is not foundFabio Estevam1-1/+1
While bringinp up a new board without the MAC fuses programmed, the following error message was observed: Error: ethernet@30bf0000 address not set. Improve the error message to make it clearer the reason of the failure. Signed-off-by: Fabio Estevam <festevam@denx.de>
2023-11-05net: Add option for tracing packetsSean Anderson1-0/+3
Add an option to trace all packets send/received. This can be helpful when debugging protocol issues, as the packets can then be imported into wireshark [1] and analyzed further. [1] https://www.wireshark.org/docs/wsug_html_chunked/ChIOImportSection.html Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-05net: eth-uclass: Setup ROM source only when ROM reading passesMichal Simek1-3/+7
There is no reason to setup ROM source if read_rom_hwaddr hook doesn't exist or reading mac address fails. It is ending up with confusion about mac address source. It is nicely visible if you put mac address to DT as local-mac-address = [ff ff ff ff ff ff]; but also save ethaddr to variables setenv -f ethaddr 02:18:31:7e:3e:01 Before this patch U-Boot prints that source is ROM Address in ROM is ff:ff:ff:ff:ff:ff Address in environment is 02:18:31:7e:3e:01 After that source is DT: Address in DT is ff:ff:ff:ff:ff:ff Address in environment is 02:18:31:7e:3e:01 Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-11-05net: Get pxe config file from dhcp option 209Sean Edmond1-0/+21
Allow dhcp server pass pxe config file full path by using option 209 Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
2023-11-05net: dhcp6: Fix OPT_BOOTFILE_PARAM parsingSean Edmond1-3/+12
RFC 5970 states that OPT_BOOTFILE_PARAM (option 60) can be multiple parameters that start with a 16-bit length field followed by the parameter. For example: [ param-len 1 (16-bits) ] [ parameter 1 (variable length) ] This fix ensure we're considering "param-len 1" in the parsing. Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
2023-10-17net: bootp: Fall back to BOOTP from DHCP when unit testingSean Anderson1-0/+6
If we sent a DHCP packet and get a BOOTP response from the server, we shouldn't try to send a DHCPREQUEST packet, since it won't be DHCPACKed. Transition straight to BIND. This is only enabled for UNIT_TEST to avoid bloat, since I suspect the number of BOOTP servers in the wild is vanishingly small. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-17net: bootp: Move port numbers to headerSean Anderson2-3/+3
These defines are useful when testing bootp. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-10-17net: Fix compiling SPL when fastboot is enabledSean Anderson2-4/+4
When fastboot is enabled in U-Boot proper and SPL_NET is enabled, we will try to (unsuccessfully) reference it in SPL. Fix these linker errors by conditioning on SPL_UDP/TCP_FUNCTION_FASTBOOT. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-10-02Merge branch 'next'Tom Rini4-31/+2
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-09-24common: Drop linux/printk.h from common headerSimon Glass1-0/+1
This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-09-22net: wget: Avoid packet queue overflowRichard Weinberger1-1/+9
Make sure to stay within bounds, as a misbehaving HTTP server can trigger a buffer overflow if not properly handled. Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2023-09-14net: phy: Remove unused NEEDS_MANUAL_RELOC code bitsMarek Vasut1-4/+0
The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-09-14net: eth: Remove unused NEEDS_MANUAL_RELOC code bitsMarek Vasut1-26/+0
The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-08-22net: Fix the displayed value of bytes transferredSiddharth Vadapalli1-1/+1
In the case of NETLOOP_SUCCESS, the decimal value of the u32 variable "net_boot_file_size" is printed using "%d", resulting in negative values being reported for large file sizes. Fix this by using "%u" to print the decimal value corresponding to the bytes transferred. Fixes: 1411157d8578 ("net: cosmetic: Fixup var names related to boot file") Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-07-27net: ipv6: router advertisement message length should be within limitsEhsan Mohandesi1-0/+2
The argument len passed to function process_ra is the length of the IPv6 router advertisement message and needs to be between 0 and MTU because it is assigned to remaining_option_len and used as a loop variable. Addresses-Coverity-ID: 450971 ("TAINTED_SCALAR") Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-07-16bootstd: Use bootdev instead of bootdeviceSimon Glass1-1/+1
It seems better to call this a 'bootdev' since this is name used in the documentation. The older 'Bootdevice' name is no-longer used and may cause confusion with the 'bootdevice' environment variable. Update throughout to use bootdev. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2023-07-05Merge tag 'v2023.07-rc6' into nextTom Rini2-1/+6
Prepare v2023.07-rc6
2023-06-14net: dhcp6: Fix VCI stringSean Edmond1-1/+1
Change VCI string from "U-boot" to "U-Boot". Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-06-14net: ipv6: Fix CID 453851 and CID 436278Sean Edmond1-0/+5
CID 453851 : sprintf() shouldn't copy from/to tmp CID 436278 : DHCP6 option_len should be checked before use Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-06-14net: dsa: Fix OF fallback lookup for portsMarcus Comstedt1-1/+1
The variable 'node' was already invalid, so using it for further lookup will not work. Signed-off-by: Marcus Comstedt <marcus.comstedt@requtech.se> Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2023-05-13bootstd: Rename distro and syslinux to extlinuxSimon Glass1-2/+2
We use the terms 'distro' to mean extlinux but they are not really the same. 'Distro' could refer to any method of booting a distribution, whereas extlinux is a particular method. Also we sometimes use syslinux, but it is better to use the same term in all cases. Rename distro to syslinux and also update bootstd uses of syslinux to use extlinux instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-05net: ipv6: Add support for default gateway discovery.Ehsan Mohandesi3-11/+256
In IPv6, the default gateway and prefix length are determined by receiving a router advertisement as defined in - https://www.rfc-editor.org/rfc/rfc4861. Add support for sending router solicitation (RS) and processing router advertisements (RA). If the RA has prefix info option and following conditions are met, then gatewayip6 and net_prefix_length of ip6addr env variables are initialized. These are later consumed by IPv6 code for non-local destination IP. - "Router Lifetime" != 0 - Prefix is NOT link-local prefix (0xfe80::/10) - L flag is 1 - "Valid Lifetime" != 0 Timing Parameters: - MAX_RTR_SOLICITATION_DELAY (0-1s) - RTR_SOLICITATION_INTERVAL (4s) (min retransmit delay) - MAX_RTR_SOLICITATIONS (3 RS transmissions) The functionality is enabled by CONFIG_IPV6_ROUTER_DISCOVERY and invoked automatically from net_init_loop(). Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com> Tested-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>Reviewed-by: Tested-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Tested-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Sergei Antonov <saproj@gmail.com>
2023-05-05net: share fastboot boot handle logic between transportsDmitrii Merkurev2-31/+5
Introduce reboot, boot and continue commands support to TCP fastboot by moving existing UDP logic into the common module. Signed-off-by: Dmitrii Merkurev <dimorinny@google.com> Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Cc: Simon Glass <sjg@chromium.org> Сс: Joe Hershberger <joe.hershberger@ni.com> Сс: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-05net: add fastboot TCP supportDmitrii Merkurev4-8/+159
Known limitations are 1. fastboot reboot doesn't work (answering OK but not rebooting) 2. flashing isn't supported (TCP transport only limitation) The command syntax is fastboot tcp Signed-off-by: Dmitrii Merkurev <dimorinny@google.com> Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Cc: Simon Glass <sjg@chromium.org> Сс: Joe Hershberger <joe.hershberger@ni.com> Сс: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-05net: support being a TCP server to unblock TCP fastbootDmitrii Merkurev2-79/+79
Make following changes to unblock TCP fastboot support: 1. Implement being a TCP server support 2. Introduce dedicated TCP traffic handler (get rid of UDP signature) 3. Ensure seq_num and ack_num are respected in net_send_tcp_packet function (make sure existing wget_cmd code is reflected with the fix) Signed-off-by: Dmitrii Merkurev <dimorinny@google.com> Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Cc: Simon Glass <sjg@chromium.org> Сс: Joe Hershberger <joe.hershberger@ni.com> Сс: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-05net: dhcp6: Add DHCPv6 (DHCP for IPv6)Sean Edmond4-2/+985
Adds DHCPv6 protocol to u-boot. Allows for address assignement with DHCPv6 4-message exchange (SOLICIT->ADVERTISE->REQUEST->REPLY). Includes DHCPv6 options required by RFC 8415. Also adds DHCPv6 options required for PXE boot. Possible enhancements: - Duplicate address detection on DHCPv6 assigned address - IPv6 address assignement through SLAAC - Sending/parsing other DHCPv6 options (NTP, DNS, etc...) Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-05net: add NFSv1 supportThomas RIENOESSL1-9/+33
NFSv1 support added by Christian Gmeiner, Thomas Rienoessl, September 27, 2018. As of now, NFSv3 is the default choice. if the server does not support NFSv3, we fall back to versions 2 or 1. Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
2023-05-05nfs: handle rpc errors for mount callsThomas RIENOESSL1-5/+8
Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
2023-05-05nfs: factor out generic reply error handlingThomas RIENOESSL1-42/+52
Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
2023-05-05nfs: convert supported_nfs_versions bitfield to an enumThomas RIENOESSL1-41/+52
Prep. work to support nfs v1. Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
2023-04-07net: phy: Only call phy_init() on systems needing manual relocationMarek Vasut1-1/+1
The phy_init() is now used only to perform manual relocation of PHY driver callbacks. Wrap it in ifdeffery and only call it on systems which still require manual relocation, i.e. m68k . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Acked-by: Michal Simek <michal.simek@amd.com> Tested-by: Michal Simek <michal.simek@amd.com> #microblaze (MANUAL_RELOC)
2023-03-30net: Pull board_interface_eth_init() into common codeMarek Vasut1-0/+7
Move the board_interface_eth_init() into common ethernet uclass code, since this function could be shared by multiple drivers. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de>