summaryrefslogtreecommitdiff
path: root/net/wget.c
AgeCommit message (Collapse)Author
2026-02-17treewide: Clean up DECLARE_GLOBAL_DATA_PTR usagePeng Fan
Remove DECLARE_GLOBAL_DATA_PTR from files where gd is not used, and drop the unnecessary inclusion of asm/global_data.h. Headers should be included directly by the files that need them, rather than indirectly via global_data.h. Reviewed-by: Patrice Chotard <[email protected]> #STMicroelectronics boards and STM32MP1 ram test driver Tested-by: Anshul Dalal <[email protected]> #TI boards Acked-by: Yao Zi <[email protected]> #TH1520 Signed-off-by: Peng Fan <[email protected]>
2025-08-18net: introduce CONFIG_DNSJerome Forissier
Introduce the DNS Kconfig symbol so that various network commands may use host names without the dns command (CMD_DNS) being selected. Signed-off-by: Jerome Forissier <[email protected]> CC: E Shattow <[email protected]>
2025-08-01net: wget: Fix comparison of unsigned variableAndrew Goodbody
content_length is an unsigned long and so testing that it is >= 0 will always be true. Instead test that it is != -1 as that is the condition set on error. This issue found by Smatch. Signed-off-by: Andrew Goodbody <[email protected]> Reviewed-by: Jerome Forissier <[email protected]>
2025-05-20net, net-lwip: wget: suppress console output when called by EFIJerome Forissier
Functions called from EFI applications should not do console output. Refactor the wget code to implement this requirement. The wget_http_info struct is used to hold the boolean that signifies whether the output is allowed or not. Signed-off-by: Jerome Forissier <[email protected]> Reported-by: Heinrich Schuchardt <[email protected]>
2025-02-28legacy-net: wget: fix wget_info handling after new tcp legacy stackAdriano Cordova
Check wget_info->buffer_size for overflow and do not clean the wget_info struct on failure, let the owner of the struct handle the error. The latter is necesary , e.g., for when a request fails because the provided buffer was too small. Signed-off-by: Adriano Cordova <[email protected]>
2024-12-28net/tcp: improve tcp framework, use better state machineMikhail Kshevetskiy
Changes: * Fix initial send sequence always zero issue * Use state machine close to RFC 9293. This should make TCP transfers more reliable (now we can upload a huge array of data from the board to external server) * Improve TCP framework a lot. This should make tcp client code much more simple. * rewrite wget with new tcp stack * rewrite fastboot_tcp with new tcp stack It's quite hard to fix the initial send sequence (ISS) issue with the separate patch. A naive attempt to fix an issue inside the tcp_set_tcp_header() function will break tcp packet retransmit logic in wget and other clients. Example: Wget stores tcp_seq_num value before tcp_set_tcp_header() will be called and (on failure) retransmit the packet with the stored tcp_seq_num value. Thus: * the same ISS must allways be used (current case) * or tcp clients needs to generate a proper ISS when required. A proper ISS fix will require a big redesing comparable with a this one. Signed-off-by: Mikhail Kshevetskiy <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-12-28net/tcp: add connection info to tcp_stream structureMikhail Kshevetskiy
Changes: * Avoid use net_server_ip in tcp code, use tcp_stream data instead * Ignore packets from other connections if connection already created. This prevents us from connection break caused by other tcp stream. Signed-off-by: Mikhail Kshevetskiy <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-12-28net/tcp: put connection specific data into a tcp_stream structureMikhail Kshevetskiy
no functional changes Signed-off-by: Mikhail Kshevetskiy <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-12-04efi_loader: net: set EFI bootdevice device path to HTTP when loaded from wgetAdriano Cordova
Set the device path of the efi boot device to an HTTP device path (as formed by efi_dp_from_http) when the next boot stage is loaded using wget (i.e., when wget is used with wget_info.set_bootdev=1). When loaded from HTTP, the device path should account for it so that the next boot stage is aware (e.g. grub only loads its http stack if it itself was loaded from http, and it checks this from its device path). Signed-off-by: Adriano Cordova <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2024-12-04net: wget: let wget_with_dns work with dns disabledAdriano Cordova
This was marked as TODO in the code: - Enable use of wget_with_dns even if CMD_DNS is disabled if the given uri has the ip address for the http server. - Move the check for CMD_DNS inside wget_with_dns. - Rename wget_with_dns to wget_do_request Signed-off-by: Adriano Cordova <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Jerome Forissier <[email protected]>
2024-12-04net: zero terminate string with headers in wget_fill_info()Heinrich Schuchardt
Commit 2dd076a9c1b4 ("net: wget: integrate struct wget_info into legacy wget code") introduced function wget_fill_info() which retrieves the headers from the HTTP server response. As we want to parse the string in later patches we need to ensure that it is NUL terminated. We must further check that wget_info->headers in not NULL. Otherwise a crash occurs. Fixes: 2dd076a9c1b4 ("net: wget: integrate struct wget_info into legacy wget code") Signed-off-by: Adriano Cordova <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2024-11-16net: wget: make wget_with_dns return value compatible with its lwip versionAdriano Cordova
There are two wget_with_dns functions, one in the legacy network stack and one in lwip, but the return values are not compatible. This commit modifies the legacy version of wget_with_dns so that the return values are compatible: 0 on success, otherwise a negative error. This way wget_with_dns can be called in a network stack agnostic way. Signed-off-by: Adriano Cordova <[email protected]>
2024-11-16net: wget: integrate struct wget_info into legacy wget codeAdriano Cordova
Each wget request now fills the struct wget_info. The efi bootdevice is now set conditionally to the set_bootdevice variable in wget_info, and the same holds for lmb memory check. Signed-off-by: Adriano Cordova <[email protected]>
2024-10-15net: correct wget_connected debug messagesHeinrich Schuchardt
* Remove duplicate debug message in wget_connected() * Correct typo 'Connctd' Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Peter Robinson <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-10-15net/wget: set filesizeHeinrich Schuchardt
After downloading a file with wget the file size may be needed in follow up actions, e.g. * write file to device * calculate hash Let wget set the environment variable filesize. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2024-09-24Merge patch series "Miscellaneous fixes"Tom Rini
Jerome Forissier <[email protected]> says: Miscellaneous fixes made when developing the lwIP series [1]. They are posted separately since they make sense on their own. Subsequent versions of the lwIP series will contain a squashed version of this one. [1] http://patchwork.ozlabs.org/project/uboot/list/?series=420712&state=%2A&archive=both
2024-09-24net: wget: allow EFI bootJerome Forissier
wget followed by bootefi currently fails as follows: U-Boot> wget 200000 192.168.0.30:helloworld.efi Waiting for Ethernet connection... done. HTTP/1.0 200 OK Packets received 13, Transfer Successful Bytes transferred = 12720 (31b0 hex) U-Boot> bootefi 200000 No UEFI binary known at 200000 U-Boot> Fix the problem by adding the missing efi_set_bootdev() call. Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Peter Robinson <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-09-24net: wget: removed unused function wget_success()Jerome Forissier
wget_success() is used nowhere so remove it. Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Peter Robinson <[email protected]>
2024-09-20wget: rework the logic to validate the load addressSughosh Ganu
Use the lmb_read_check() function to verify if it is safe to use a region of memory to load data from the wget command. The current logic checks the amount of free memory available, starting from the 'load address'. This call fails if the same region of memory has been used earlier. This used to work earlier as the LMB memory map had a local scope and was not persistent. Fix this issue by using the lmb_read_check() call instead which only returns an error in case the memory region has been marked for not allowing re-use. Signed-off-by: Sughosh Ganu <[email protected]> Tested-by: Vaishnav Achath <[email protected]>
2024-09-03lmb: remove the lmb_init_and_reserve() functionSughosh Ganu
With the changes to make the LMB reservations persistent, the common memory regions are being added during board init. Remove the now superfluous lmb_init_and_reserve() function. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-09-03lmb: allow lmb module to be used in SPLSughosh Ganu
With the introduction of separate config symbols for the SPL phase of U-Boot, the condition checks need to be tweaked so that platforms that enable the LMB module in SPL are also able to call the LMB API's. Use the appropriate condition checks to achieve this. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-09-03lmb: make LMB memory map persistent and globalSughosh Ganu
The current LMB API's for allocating and reserving memory use a per-caller based memory view. Memory allocated by a caller can then be overwritten by another caller. Make these allocations and reservations persistent using the alloced list data structure. Two alloced lists are declared -- one for the available(free) memory, and one for the used memory. Once full, the list can then be extended at runtime. [sjg: Use a stack to store pointer of lmb struct when running lmb tests] Signed-off-by: Sughosh Ganu <[email protected]> Signed-off-by: Simon Glass <[email protected]> [sjg: Optimise the logic to add a region in lmb_add_region_flags()]
2024-08-15sandbox: Enable wget commandYasuharu Shibata
Enable this so that the tests run. Fix a few warnings in the code so that CI passes. Signed-off-by: Simon Glass <[email protected]> Signed-off-by: Yasuharu Shibata <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-06net: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "net/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <[email protected]>
2024-04-16net: wget: fix TCP sequence number wrap around issueYasuharu Shibata
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 <[email protected]> Reviewed-by: Michael Trimarchi <[email protected]> Suggested-by: Michael Trimarchi <[email protected]> Reported-by: Tim Harvey <[email protected]> Tested-by: Fabio Estevam <[email protected]>
2024-04-16net: wget: Support retransmission a dropped packetYasuharu Shibata
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 <[email protected]> Tested-by: Fabio Estevam <[email protected]>
2024-01-03Merge tag 'v2024.01-rc6' into nextTom Rini
Prepare v2024.01-rc6
2023-12-19net: wget: Support non-default HTTP portMarek Vasut
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 <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2023-11-18cmd: efidebug: add uri device pathMasahisa Kojima
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 <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2023-11-18net: wget: add wget with dns utility functionMasahisa Kojima
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 <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Ramon Fried <[email protected]> Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2023-11-18net: wget: prevent overwriting reserved memoryMasahisa Kojima
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 <[email protected]> Acked-by: Ilias Apalodimas <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ramon Fried <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2023-09-22net: wget: Avoid packet queue overflowRichard Weinberger
Make sure to stay within bounds, as a misbehaving HTTP server can trigger a buffer overflow if not properly handled. Cc: Joe Hershberger <[email protected]> Cc: Ramon Fried <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2023-05-05net: support being a TCP server to unblock TCP fastbootDmitrii Merkurev
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 <[email protected]> Cc: Ying-Chun Liu (PaulLiu) <[email protected]> Cc: Simon Glass <[email protected]> Сс: Joe Hershberger <[email protected]> Сс: Ramon Fried <[email protected]> Reviewed-by: Ying-Chun Liu (PaulLiu) <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2022-12-29net: wget: fix implicit declarationMichael Walle
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 <[email protected]>
2022-11-28net: Add wget applicationYing-Chun Liu (PaulLiu)
This commit adds a simple wget command that can download files from http server. The command syntax is wget ${loadaddr} <path of the file from server> Signed-off-by: Duncan Hare <[email protected]> Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Reviewed-by: Simon Glass <[email protected]> Cc: Christian Gmeiner <[email protected]> Cc: Joe Hershberger <[email protected]> Cc: Michal Simek <[email protected]> Cc: Ramon Fried <[email protected]> Reviewed-by: Ramon Fried <[email protected]>