summaryrefslogtreecommitdiff
path: root/net/tftp.c
AgeCommit message (Collapse)Author
2016-05-27efi_loader: Add network access supportAlexander Graf
We can now successfully boot EFI applications from disk, but users may want to also run them from a PXE setup. This patch implements rudimentary network support, allowing a payload to send and receive network packets. With this patch, I was able to successfully run grub2 with network access inside of QEMU's -M xlnx-ep108. Signed-off-by: Alexander Graf <agraf@suse.de>
2015-10-28net: TFTP: variables cleanup and additionAlbert ARIBAUD \(3ADEV\)
TFTP source and destination port variable names are 'tftpsrcp' and 'tftpdstp' in the code, but 'tftpsrcport' and 'tftpdstport' in the README file. Fix the README. Add environment variable 'tftptimeoutcountmax'. As per the comments about the global variable tftp_timeout_count_max, make sure tftptimeoutcountmax is nonnegative. Introduce configuration option CONFIG_NET_TFTP_VARS, which controls whether environment variables tftpblocksize, tftptimeout, and tftptimoueoutcountmax are read by the TFTP client code. CONFIG_NET_TFTP_VARS defaults to y but can be set to n by targets with to tight size contraints. Make bf527-ezkit set CONFIG_NET_TFTP_VARS to n to keep the target size below limit.
2015-09-09net: Revert "tftp: adjust settings to be suitable for 100Mbit ethernet"Bin Meng
Commit 620776d "tftp: adjust settings to be suitable for 100Mbit ethernet" causes the following error message when trying to load a file using 'tftp' command via a tftp server. TFTP error: 'Unsupported option(s) requested' (8) This is due to with commit 620776d changes, the tftp option 'timeout' value is now set to zero which is an invalid value as per RFC2349 [1]. Valid values range between "1" and "255" seconds, inclusive. With some tftp servers that strictly implement the RFC requirement, it reports such an error message. Revert commit 620776d for RFC compliance. [1] https://www.ietf.org/rfc/rfc2349.txt Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-09-07net: tftp: Move tftp.h file from ./net to ./include/netLukasz Majewski
This change gives the ability to reuse the <tftp.h> header file by other subsystems (like e.g. dfu). Without this change compilation error emerges for the legacy update.c file. Signed-off-by: Lukasz Majewski <l.majewski@majess.pl> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-08-21tftp: adjust settings to be suitable for 100Mbit ethernetPavel Machek
Adjust timouts and retry counts to be suitable for loaded ethernet network. With 5 seconds timeout, 10 retries maximum, tftp is impossible even on local network with single full-speed TCP connection. 100msec timeout should be suitable for most networks tftp is used on, that is local ethernets. Timeout count really needs to be way higher, as lost packets are normal when TCP is running over the same network. Enforce 10msec minimum. Signed-off-by: Pavel Machek <pavel@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-08-12tftp.c: fix CONFIG_TFTP_TSIZE for small filesMax Krummenacher
CONFIG_TFTP_TSIZE should limit a tftp downloads progress to 50 '#' chars. Make this work also for small files. If the file size is small, i.e. smaller than 2 tftp block sizes the number of '#' can get much larger. i.e. with a 1 byte file 65000 characters are printed, with a 512 byte file around 500. When using CONFIG TFTP BLOCKSIZE together with CONFIG_IP_DEFRAG the issue is more notable. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18net: cosmetic: Fix checkpatch.pl failures in net.cJoe Hershberger
Finish eliminating CamelCase from net.c and other failures Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Clean up TFTP variables and functionsJoe Hershberger
Make a thorough pass through all variables and function names contained within tftp and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Cleanup internal packet buffer namesJoe Hershberger
This patch cleans up the names of internal packet buffer names that are used within the network stack and the functions that use them. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18net: cosmetic: Name ethaddr variables consistentlyJoe Hershberger
Use "_ethaddr" at the end of variables and drop CamelCase. Make constant values actually 'const'. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Fixup var names related to boot fileJoe Hershberger
The variables around the bootfile were inconsistent and used CamelCase. Update them to make the code more readable. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Change IPaddr_t to struct in_addrJoe Hershberger
This patch is simply clean-up to make the IPv4 type that is used match what Linux uses. It also attempts to move all variables that are IP addresses use good naming instead of CamelCase. No functional change. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: Access mapped physmem in net functionsJoe Hershberger
Previously the net functions would access memory assuming physmem did not need to be mapped. In sandbox, that's not the case. Now we map the physmem specified by the user in loadaddr to the buffer that represents that space. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2014-10-22net: Display the size when tftpboot finishesSimon Glass
If we know the file size, display it after loading the file. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-11-22net: tftpsrv: Get correct client MAC addressAndrew Ruder
NetServerEther was not being cleared in the tftp server code, so the destination MAC address would be whatever the last destination MAC address was. Scenario: U-Boot: dhcp tftpsrv Host: Send device WRQ Device: Responds with ACK to dhcp server mac address with host ip address By clearing NetServerEther, we force a lookup of the host MAC address to go with the associated host IP. Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
2013-11-22net: tftp: Make sure timeout will not effect wrap offsetrockly
When the block 0 store to the memory of client and timeout at this moment. Because of no ACK packet, the server will send block 0 again, if this client reconnect to the server at this time, TftpBlockWrapOffset will become larger than it should be. Signed-off-by: Rockly <rocklygnome@gmail.com> Patch: 264417
2013-06-24net/tftp: sparse fixesKim Phillips
tftp.c:464:17: warning: cast to restricted __be16 tftp.c:552:29: warning: cast to restricted __be16 tftp.c:640:33: warning: cast to restricted __be16 tftp.c:642:25: warning: cast to restricted __be16 Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Cc: Joe Hershberger <joe.hershberger@gmail.com>
2012-12-15net: Add tftp speed indicationSimon Glass
This prints a tftp speed indication after the download completes. This is the 3.6 MiB/s indicator below. Tegra2 (SeaBoard) # tftp ... Using asx0 device TFTP from server 172.22.72.144; our IP address is 172.22.73.81 Filename '/tftpboot/uImage-user-seaboard-1'. Load address: 0x408000 Loading: ################################################# 3.6 MiB/s done Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
2012-07-11net: tftp: fix type of block arg to store_blockJayachandran Chandrasekharan Nair
The block argument for store_block can be -1 when the tftp sequence number rolls over (i.e TftpBlock == 0), so the first argument to store_block has to be of type 'int' instead of 'unsigned'. In our environment (gcc 4.4.5 mips toolchain), this causes incorrect 'offset' to be generated for storing the block, and the tftp block with number 0 will be written elsewhere, resulting in a bad block in the downloaded file and a memory corruption. Signed-off-by: Jayachandran Chandrasekharan Nair <jayachandranc@netlogicmicro.com>
2012-05-23net: Refactor to separate the UDP handler from the ARP handlerJoe Hershberger
Call a built-in dummy if none is registered... don't require protocols to register a handler (eliminating dummies) NetConsole now uses the ARP handler when waiting on arp (instead of needing a #define hack in arp.c) Clear handlers at the end of net loop Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Refactor to protect access to the NetState variableJoe Hershberger
Changes to NetState now go through an accessor function called net_set_state() Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Un-typedef IP_tJoe Hershberger
Rename IP header related things to IP_UDP. The existing definition of IP_t includes UDP header, so name it to accurately describe the structure. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-15net: cosmetic: tftp.* checkpatch complianceJoe Hershberger
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-15net: Remove volatile from net APIJoe Hershberger
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2011-12-06net: Make sure IPaddr_t is 32 bits in sizeMatthias Weisser
When building u-boot as 64 bit application (e.g. sandbox) ulong might be 64 bits in size. This breaks network code as IPaddr_t is 64 bytes in size then and an IPv4 address is 32 bits in size. This patch makes sure that IPaddr_t is always 32 bits in size. Also some warnings introduced by this patch are fixed. Signed-off-by: Matthias Weisser <weisserm@arcor.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-10-27net: Add more #ifdefs for tftpput to reduce code sizeSimon Glass
If CONFIG_CMD_TFTPPUT is not enabled, we want minimal code size impact on the tftp code. This introduces a few more #ifdefs. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-10-27net: Make net_transfer() a static functionSimon Glass
This should be a static function so it can be inlined. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-10-27net: Hide more code behind CONFIG_CMD_TFTPPUTSimon Glass
This commit reduces code size a little by making the ICMP handler only available to tftpput. This is reasonable since it is the only user at present (ping just uses the normal handler). Signed-off-by: Simon Glass <sjg@chromium.org>
2011-10-26net: tftpput: implement tftp logicSimon Glass
This adds logic to tftp.c to implement the tftp 'put' command, and updates the README. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-10-26net: tftpput: Support selecting get/put for tftpSimon Glass
TftpStart should support starting either a get or a put. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-10-26net: tftpput: Factor out start, restart and next block functionsSimon Glass
This code is required for tftpput, so move it into separate functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-10-26net: tftpput: move common code into separate functionsSimon Glass
We want to show block markers on completion of get and put, so move this common code into separate functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-10-05net: drop !NET_MULTI codeMike Frysinger
This is long over due. All but two net drivers have been converted, but those have now been dropped. The only thing left to do is actually delete all references to NET_MULTI and code that is compiled when that is not defined. So here we scrub the core code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-19net/tftp.c: fix typoLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19TFTP: net/tftp.c: add server mode receiveLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19TFTP: rename STATE_RRQ to STATE_SEND_RRQLuca Ceresoli
With the upcoming TFTP server implementation, requests can be either outgoing or incoming, so avoid ambiguities. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19TFTP: replace "server" with "remote" in local variable namesLuca Ceresoli
With the upcoming TFTP server implementation, the remote node can be either a client or a server, so avoid ambiguities. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19net/tftp.c: cosmetic: do not initialise statics to 0 or NULLLuca Ceresoli
This removes the following checkpatch issue: - ERROR: do not initialise statics to 0 or NULL Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: fix indentationLuca Ceresoli
This removes the following checkpatch issue: - WARNING: suspect code indent for conditional statements Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: trailing statements should be on next lineLuca Ceresoli
This removes the following checkpatch issue: - ERROR: trailing statements should be on next line Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: fix brace issuesLuca Ceresoli
This removes the following checkpatch issues: - WARNING: braces {} are not necessary for single statement blocks - WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: do not use assignment in if conditionLuca Ceresoli
This removes the following checkpatch issue: - ERROR: do not use assignment in if condition. There is one such error left: ERROR: do not use assignment in if condition #239: FILE: tftp.c:239: + if (!ProhibitMcast + && (Bitmap = malloc(Mapsize)) + && eth_get_dev()->mcast) { which would require an additional nested if to be fixed, resulting in longer and less readable code. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: fix pointer syntax issuesLuca Ceresoli
This removes the following checkpatch issues: - ERROR: "foo * bar" should be "foo *bar" - ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: fix whitespace issuesLuca Ceresoli
This removes the following checkpatch issues: - ERROR: space prohibited before that close parenthesis ')' - ERROR: space required after that ';' (ctx:BxV) - ERROR: space required after that ',' (ctx:VxV) - ERROR: space required after that ';' (ctx:VxV) - ERROR: spaces required around that '<<=' (ctx:VxV) - ERROR: spaces required around that '<' (ctx:VxV) - ERROR: spaces required around that '=' (ctx:VxV) - ERROR: spaces required around that '+=' (ctx:VxV) - ERROR: spaces required around that '=' (ctx:VxW) - WARNING: please, no spaces at the start of a line - WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-19net/tftp.c: cosmetic: fix lines over 80 charactersLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-12NET: pass source IP address to packet handlersLuca Ceresoli
This is needed for the upcoming TFTP server implementation. This also simplifies PingHandler() and fixes rxhand_f documentation. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2010-03-21TFTP: allow for adjustable retransmission timoutWolfgang Denk
So far, TFTP negotiated a fixed retransmission timeout of 5 seconds. In some cases (busy networks, slow TFTP servers) this caused very slow transfers. A new environment variable "tftptimeout" allows to set this timeout. Lowering this value may make downloads succeed faster in networks with high packet loss rates or with unreliable TFTP servers. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-12-13Add error codes/handling for TFTP-serverRemy Bohmer
Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-12-13net: pull CONFIG checks out of source and into makefileMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-08-25Add Transfer Size Option to tftpRobin Getz
Optionally add RFC 2349 "Transfer Size Option", so we can minimize the time spent sending data over the UART (now print a single line during a tftp transfer). - If turned on (CONFIG_TFTP_TSIZE), U-Boot asks for the size of the file. - if receives the file size, a single line (50 chars) are printed. one hash mark == 2% of the file downloaded. - if it doesn't receive the file size (the server doesn't support RFC 2349, prints standard hash marks (one mark for each UDP frame). Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>