summaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Collapse)AuthorFilesLines
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-06net: 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-06net: 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-06net: 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-06net: 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-06net: 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-06net: 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-06nfs: handle rpc errors for mount callsThomas RIENOESSL1-5/+8
Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
2023-05-06nfs: factor out generic reply error handlingThomas RIENOESSL1-42/+52
Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
2023-05-06nfs: 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>
2023-03-03Correct SPL uses of PHY_FIXEDSimon Glass1-1/+1
This converts 3 usages of this option to the non-SPL form, since there is no SPL_PHY_FIXED defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10Correct SPL use of NETDEVICESSimon Glass1-1/+1
This converts 1 usage of this option to the non-SPL form, since there is no SPL_NETDEVICES defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10Correct SPL uses of FASTBOOT_FLASHSimon Glass1-1/+1
This converts 3 usages of this option to the non-SPL form, since there is no SPL_FASTBOOT_FLASH defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-02-02net: ipv6: Fixed IPv6 string to address conversion off-by-one errorEhsan Mohandesi1-1/+1
One extra character was being checked in the IPv6 string which caused the last character of the address to be neither '\0' nor ':'. This raises an error condition and causes the function to always return an error. This issue was resolved by this fix. Signed-off-by: Ehsan Mohandesi <emohandesi@microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
2023-02-02net: ipv6: Fix IPv6 netmask parsingSean Edmond1-3/+6
It should be possible to specify a netmask when setting a static IPv6 address. For example: setenv ip6addr 2001:cafe:cafe:cafe::100/64 The net_prefix_length and net_ip6 should be updated properly. Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-02-02net: tftp: Fix for DATA ACK for block count out of orderSean Edmond1-0/+8
In rfc7440, if an ACK is not received by the server or if the last data block in a window is dropped, the server will timeout and retransmit the window. In this case, the block count received will be less than the internal block count. In this case, the client should not ACK. ACK should only be sent if the received block count is greater than the expected block count. Signed-off-by: Sean Edmond <seanedmond@linux.microsoft.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-02-02net: dsa: allow rcv() and xmit() to be optionalTim Harvey1-13/+15
Allow rcv() and xmit() dsa driver ops to be optional in case a driver does not care to mangle a packet as in U-Boot only one network port is enabled at a time and thus no packet mangling is necessary. Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Fabio Estevam <festevam@denx.de> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2023-02-02net: dsa: ensure dsa driver has proper opsTim Harvey1-0/+17
Add a function to sanity check a dsa driver having proper ops. Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-02-02net: dsa: move cpu port probe to dsa_post_probeTim Harvey1-1/+10
In order to ensure that a DSA driver probe gets called before dsa_ops->port_probe move the port_probe of the cpu_port to a post-probe function. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-02-02net: mdio-uclass: scan for dm mdio children on post-bindTim Harvey1-0/+4
If a DM_MDIO driver is used we need to scan the subnodes as well. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-01-24bootstd: Add a new pre-scan priority for bootdevsSimon Glass1-2/+2
We need extensions to be set up before we start trying to boot any of the bootdevs. Add a new priority before all the others for tht sort of thing. Also add a 'none' option, so that the first one is not 0. While we are here, comment enum bootdev_prio_t fully and expand the test for the 'bootdev hunt' command. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Rename bootdev checkersSimon Glass1-1/+1
These functions return 0 if the check passes, so the names are somewhat confusing. Rename them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Add a hunter for ethernetSimon Glass1-23/+41
Sometimes ethernet devices are attached to PCI. Since it is quick to scan, add this into the ethernet hunter. Run dhcp to establish the network connection. Drop this from the bootdev since that is not needed now. Update a log message for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24sandbox: Allow ethernet bootdevs to be disabled for testsSimon Glass1-1/+13
Most tests don't want these and can create a lot of noise. Add a way to disable them. Use that in tests, with a flag provided to enable them for tests that need this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24sandbox: Allow ethernet to be disabled at runtimeSimon Glass1-0/+4
For bootstd tests it is seldom useful to have ethernet enabled. Add a way to disable it, so that ethernet operations like tftpboot do nothing. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-20global: Finish CONFIG -> CFG migrationTom Rini1-7/+7
At this point, the remaining places where we have a symbol that is defined as CONFIG_... are in fairly odd locations. While as much dead code has been removed as possible, some of these locations are simply less obvious at first. In other cases, this code is used, but was defined in such a way as to have been missed by earlier checks. Perform a rename of all such remaining symbols to be CFG_... rather than CONFIG_... Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11fastboot: remove #ifdef CONFIG when it is possiblePatrick Delaunay1-5/+3
Much of the fastboot code predates the introduction of Kconfig and has quite a few #ifdefs in it which is unnecessary now that we can use IS_ENABLED() et al. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
2023-01-09Merge branch 'next'Tom Rini4-437/+55
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-29net: wget: fix implicit declarationMichael Walle1-0/+1
The compiler complains about the missing declaration of print_size(): net/wget.c:415:3: warning: implicit declaration of function ‘print_size’ [-Wimplicit-function-declaration] Fix it. Signed-off-by: Michael Walle <michael@walle.cc>
2022-12-22net: don't memcpy to NULLHeinrich Schuchardt1-1/+1
In ndisc_receive() 7 bytes are copied from a buffer of size 6 to NULL. net_nd_packet_mac is a pointer. If it is NULL, we should set it to the address of the buffer with the MAC address. Addresses-Coverity-ID: 430974 ("Out-of-bounds access") Fixes: c6610e1d90ea ("net: ipv6: Add Neighbor Discovery Protocol (NDP)") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
2022-12-22net: ipv6: Add missing break into IPv6 protocol handlerViacheslav Mitrofanov1-0/+1
IPv6 protocol handler is not terminated with a break statment. It can lead to running unexpected code. Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2022-12-22Convert CONFIG_HOSTNAME et al to KconfigTom Rini1-0/+52
This converts the following to Kconfig: CONFIG_GATEWAYIP CONFIG_HOSTNAME CONFIG_IPADDR CONFIG_NETMASK CONFIG_ROOTPATH CONFIG_SERVERIP CONFIG_UBOOTPATH To do this, we introduce a CONFIG_USE_ form of each of the above and change include/env_default.h to test for that to be set before setting a value. Further, we don't want to stringify the IP address related values as they are now properly strings via Kconfig. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-08net: Remove eth_legacy.cTom Rini3-437/+3
As there are no more non-DM_ETH cases for networking, remove this legacy file and update the Makefile to match current usage. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-05net: ping6: Add ping6 commandViacheslav Mitrofanov4-0/+136
Implement ping6 command to ping hosts using IPv6. It works the same way as an ordinary ping command. There is no ICMP request so it is not possible to ping our host. This patch adds options in Kconfig and Makefile to build ping6 command. Series-changes: 3 - Added structures and functions descriptions - Added to ping6_receive() return value instead of void Series-changes: 4 - Fixed structures and functions description style Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: tftp: Add IPv6 support for tftpbootViacheslav Mitrofanov2-7/+68
The command tftpboot uses IPv4 by default. Add the possibility to use IPv6 instead. If an address in the command is an IPv6 address it will use IPv6 to boot or if there is a suffix -ipv6 in the end of the command it also force using IPv6. All other tftpboot features and parameters are left the same. Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: ipv6: Incorporate IPv6 support into u-boot net subsystemViacheslav Mitrofanov1-1/+22
Add net_ip6_handler (an IPv6 packet handler) into net_loop. Add neighbor discovery mechanism into network init process. That is the main step to run IPv6 in u-boot. Now u-boot is capable to use NDP and handle IPv6 packets. Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: ipv6: Add implementation of main IPv6 functionsViacheslav Mitrofanov1-0/+362
Functions that were exposed in "net: ipv6: Add IPv6 basic primitives" had only empty implementations and were exposed as API for futher patches. This patch add implementation of these functions. Main functions are: net_ip6_handler() - IPv6 packet handler for incoming packets; net_send_udp_packet6() - make up and send an UDP packet; csum_ipv6_magic() - compute checksum of IPv6 "psuedo-header" per RFC2460 section 8.1; ip6_addr_in_subnet() - check if an address is in our subnet. Other functions are auxiliary. Series-changes: 3 - Added comments - Fixed style problems - Fixed return codes instead of -1 Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: ipv6: Add ip6addr, gatewayip6, serverip6 variables callbacksViacheslav Mitrofanov1-0/+48
Implement actions on ip6addr, gatewayip6, serverip6 varaibles. on_ip6addr - convert IPv6 string addr to struct ip6_addr on_gatewayip6 - convert IPv6 string addr to struct ip6_addr on_serverip6 - convert IPv6 string addr to struct ip6_addr Series-changes: 3 - Removed memory allocation - Substituted -1 for error code Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: ipv6: Add Neighbor Discovery Protocol (NDP)Viacheslav Mitrofanov2-0/+290
Implement basic of NDP. It doesn't include such things as Router Solicitation, Router Advertisement and Redirect. It just has Neighbor Solicitation and Neighbor Advertisement. Only these two features are used in u-boot IPv6. Implementation of some NDP functions uses API that was exposed in "net: ipv6: Add IPv6 basic primitives". Also this patch inlcudes update in Makefile to build NDP. Series-changes: 3 - Added structures and functions descriptions - Fixed style problems Series-changes: 4 - Fixed structures and functions description style Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: ipv6: Add IPv6 build optionsViacheslav Mitrofanov2-0/+11
Add options to Makefile and Kconfig file to build IPv6 Series-changes: 3 - Added help for IPv6 support Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05net: ipv6: Add IPv6 basic primitivesViacheslav Mitrofanov1-0/+31
This patch is a collection of basic primitives that are prerequisite for further IPv6 implementation. There are structures definition such as IPv6 header, UDP header (for TFTP), ICMPv6 header. There are auxiliary defines such as protocol codes, padding, struct size and etc. Also here are functions prototypes and its empty implementation that will be used as API for further patches. Here are variables declaration such as IPv6 address of our host, gateway, ipv6 server. Series-changes: 3 - Added functions and structures descriptions - Removed enums ND_OPT_*. It will be moved into further patches - Substituted -1 for error codes Series-changes: 4 - Changed functions and structures description style Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-02net: CONFIG_NET_DEVICES in dhcp_handler()Heinrich Schuchardt1-1/+1
The symbol CONFIG_NET_DEVICES does not exist. The correct name is CONFIG_NETDEVICES. Fixes: 77b5c4a5b1dc ("efi_loader: Let networking support depend on NETDEVICES") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>