summaryrefslogtreecommitdiffstats
path: root/net/net.c
Commit message (Collapse)AuthorAgeFilesLines
...
* net: Refactor IP, UPD, and ICMP header writing functionsJoe Hershberger2012-05-231-19/+28
| | | | | | | | ICMP (ping) was reimplementing IP header code... it now shares code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: cosmetic: Alphabetize includes in net.cJoe Hershberger2012-05-231-12/+12
| | | | | | Easier to find when alphabetized Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Rename CDPHandler to cdp_receiveJoe Hershberger2012-05-231-1/+1
| | | | | | This is not called as a handler, so don't name it that way Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Rename "x" to "eth_proto"Joe Hershberger2012-05-231-12/+12
| | | | | | | x is a poor variable name Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Add a more explicit comment about 802.2Joe Hershberger2012-05-231-1/+2
| | | | | | | Make the comment more accurate about the header including SNAP Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Rename parameter len to payload_lenJoe Hershberger2012-05-231-7/+8
| | | | | | | | This name more explicitly claims that it does not include the header size Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Un-typedef ICMP_tJoe Hershberger2012-05-231-1/+1
| | | | | | Remove typedef and lower-case name Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Un-typedef VLAN_Ethernet_tJoe Hershberger2012-05-231-2/+4
| | | | | | Eliminate the typedef and remove capital letters Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Un-typedef Ethernet_tJoe Hershberger2012-05-231-5/+6
| | | | | | | Separate the Ethernet header from the 802 header. Base the size constants on the structs. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Split struct ip_udp_hdr into ip_hdrJoe Hershberger2012-05-231-8/+8
| | | | | | | | Add a structure that only contains IP header fields to be used by functions that don't need UDP Rename IP_HDR_SIZE_NO_UDP to IP_HDR_SIZE Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Un-typedef IP_tJoe Hershberger2012-05-231-30/+32
| | | | | | | | 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>
* net: Move RARP receive logic out of net.cJoe Hershberger2012-05-231-26/+1
| | | | | | | | Separate this functionality out of the net.c behemoth Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Move PING out of net.cJoe Hershberger2012-05-231-129/+4
| | | | | | | Separate this functionality out of the net.c behemoth Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Move ARP out of net.cJoe Hershberger2012-05-231-196/+13
| | | | | | | | Separate this functionality out of the net.c behemoth Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Encapsulate CDP packet identificationJoe Hershberger2012-05-231-1/+1
| | | | | | Checking for CDP packets should be encapsulated, not copied code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Move CDP out of net.cJoe Hershberger2012-05-231-365/+1
| | | | | | Separate this functionality out of the net.c behemoth Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: punt bd->bi_ip_addrMike Frysinger2012-05-151-2/+0
| | | | | | | | | This field gets read in one place (by "bdinfo"), and we can replace that with getenv("ipaddr"). After all, the bi_ip_addr field is kept up-to-date implicitly with the value of the ipaddr env var. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: net.c checkpatch complianceJoe Hershberger2012-05-151-14/+8
| | | | | Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Remove volatile from net APIJoe Hershberger2012-05-151-17/+17
| | | | | Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* bootstage: Plumb in bootstage calls for basic operationsSimon Glass2012-03-181-0/+1
| | | | | | | | This inserts bootstage calls into tftp, usb start and bootm. We could go further, but this is a reasonable start to illustrate the concept. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: Make sure IPaddr_t is 32 bits in sizeMatthias Weisser2011-12-061-3/+3
| | | | | | | | | | | 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>
* net/net.c: Fix GCC 4.6 build warningWolfgang Denk2011-11-071-3/+1
| | | | | | | | | Fix: net.c: In function 'CDPHandler': net.c:1083:8: warning: variable 'applid' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de>
* net: Export auto_load, use it in rarpSimon Glass2011-10-271-0/+30
| | | | | | | | | | | The rarp code includes another instance of the auto_load logic, so call what is now net_auto_load() instead. This also fixes an incorrect call to TftpStart() which was never seen since apparently no boards enable rarp. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Change for loop to memset()Simon Glass2011-10-271-6/+2
| | | | | | This is intended purely as a code size reduction. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: Hide more code behind CONFIG_CMD_TFTPPUTSimon Glass2011-10-271-0/+8
| | | | | | | | 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>
* net: tftpput: implement tftp logicSimon Glass2011-10-261-0/+4
| | | | | | | This adds logic to tftp.c to implement the tftp 'put' command, and updates the README. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Rename TFTP to TFTPGETSimon Glass2011-10-261-10/+8
| | | | | | | | This is a better name for this protocol. Also remove the typedef to keep checkpatch happy, and move zeroing of NetBootFileXferSize a little earlier since TFTPPUT will need to change this. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Add support for receiving ICMP packetsSimon Glass2011-10-261-3/+24
| | | | | | | | | | ICMP packets can tell you when there is no server at the other end. It is useful for tftp to figure this out, so that a quick error can be displayed, rather than pointlessly retrying. This adds an ICMP packet handler to the net interface. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Move ICMP code into its own functionSimon Glass2011-10-261-43/+58
| | | | | | | NetReceive() is a very long function with a lot of indent. Before adding code to the ICMP bit, split it out. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: drop !NET_MULTI codeMike Frysinger2011-10-051-30/+0
| | | | | | | | | | | 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>
* net/net.c: Update ipaddr if the environment has changedEnric Balletbo i Serra2011-06-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least on ARM the ipaddr is only set in board_init_r function. The problem is if ipaddr is not defined in environment importing another environment defined don't update the ipaddr value. For example, suppose we've a default environment without net variables defined and we want to import an uEnv.txt environment from SD-card like this: ipaddr=192.168.2.240 netmask=255.255.255.0 gatewayip=192.168.2.1 serverip=192.168.2.114 Then if you try boot from NFS results in: Importing environment from mmc ... Running uenvcmd ... smc911x: detected LAN9221 controller smc911x: phy initialized smc911x: MAC ac:de:48:00:00:00 *** ERROR: `ipaddr' not set The ipaddr at this point is NULL beacause is only set at board_init_r function. This patch updates the ipaddr value if the environment has changed. Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* TFTP: add tftpsrv commandLuca Ceresoli2011-05-191-1/+6
| | | | | | Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* net/net.c: cosmetic: do not use assignment in if conditionLuca Ceresoli2011-05-121-1/+2
| | | | | | | | | This removes the following checkpatch issue: - ERROR: do not use assignment in if condition Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix indentationLuca Ceresoli2011-05-121-42/+41
| | | | | | | | | | | This removes the following checkpatch issues: - ERROR: switch and case should be at the same indent - WARNING: suspect code indent for conditional statements - WARNING: labels should not be indented Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: parentheses not required for returnLuca Ceresoli2011-05-121-15/+15
| | | | | | | | | This removes the following checkpatch issue: - ERROR: return is not a function, parentheses are not required Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix pointer syntax issuesLuca Ceresoli2011-05-121-15/+15
| | | | | | | | | | 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> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix brace issuesLuca Ceresoli2011-05-121-25/+13
| | | | | | | | | | 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> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix whitespace issuesLuca Ceresoli2011-05-121-93/+93
| | | | | | | | | | | | | | | | | | | | | This removes the following checkpatch issues: - ERROR: space prohibited after that open parenthesis '(' - ERROR: space prohibited before that close parenthesis ')' - ERROR: space prohibited after that open square bracket '[' - ERROR: space prohibited after that '&' (ctx:WxW) - ERROR: spaces required around that '=' (ctx:VxW) - ERROR: space required before the open parenthesis '(' - ERROR: space required after that ',' (ctx:VxV) - ERROR: need consistent spacing around '+' (ctx:WxV) - WARNING: unnecessary whitespace before a quoted newline - 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> Cc: Ben Warren <biggerbadderben@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org>
* net/net.c: cosmetic: variable initializationsLuca Ceresoli2011-05-121-22/+18
| | | | | | | | | | | | This removes the following checkpatch errors: - ERROR: do not initialise globals to 0 or NULL - ERROR: spaces required around that '=' (ctx:VxV) - ERROR: that open brace { should be on the previous line Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org>
* net/net.c: cosmetic: fix lines over 80 charactersLuca Ceresoli2011-05-121-77/+155
| | | | | | | | | | | | | | | | | | | | | This removes the following checkpatch warning: - WARNING: line over 80 characters There are three such warnings left. The first is hard to fix with cosmetic-only changes without compromising code readability, so I'm leaving it as it is for now: WARNING: line over 80 characters #1537: FILE: net.c:1537: + [4 tabs] memcpy(((Ethernet_t *)NetArpWaitTxPacket)->et_dest, ... The other two cannot be fixed without splitting string literals, so it is preferred to keep them longer than 80 characters. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org>
* NET: pass source IP address to packet handlersLuca Ceresoli2011-05-121-13/+17
| | | | | | | | | | 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>
* netconsole: remove `serverip' checkSimon Guinot2011-05-121-1/+2
| | | | | | | Netconsole use the environment variable `ncip' to configure the destination IP. `serverip' don't need to be defined. Signed-off-by: Simon Guinot <sguinot@lacie.com>
* NET: Correct potential missing goto label in case statement.Gray Remlin2011-04-281-1/+2
| | | | | | | | If neither CONFIG_CMD_PING or CONFIG_CMD_SNTP are defined but CONFIG_CMD_DNS is, a compile-time error will occur due to the absence of a goto label. Signed-off-by: Gray Remlin <gryrmln@gmail.com>
* string_to_VLAN: constify "var" argMike Frysinger2010-11-281-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* copy_filename: constify "src" argMike Frysinger2010-11-281-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* rarp: Condtionally compile rarp supportPeter Tyser2010-10-111-2/+9
| | | | | | | | Most people don't use the 'rarpboot' command, so only enable it when CONFIG_CMD_RARP is defined. Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* ip/defrag: fix processing of last short fragmentFillod Stephane2010-06-201-1/+2
| | | | | | | | | | | TFTP'ing a file of size 1747851 bytes with CONFIG_IP_DEFRAG and CONFIG_TFTP_BLOCKSIZE set to 4096 fails with a timeout, because the last fragment is not taken into account. This patch fixes IP fragments having less than 8 bytes of payload. Signed-off-by: Stephane Fillod <stephane.fillod@grassvalley.com> Acked-by: Alessandro Rubini <rubini@gnudd.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* ./net/net.c - make Microsoft dns servers happy with random_port() numbersRobin Getz2010-05-031-2/+4
| | | | | | | | | | | | For some reason, (which I can't find any documentation on), if U-Boot gives a port number higher than 17500 to a Microsoft DNS server, the server will reply to port 17500, and U-Boot will ignore things (since that isn't the port it asked the DNS server to reply to). This fixes that by ensuring the random port number is less than 17500. Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Make getenv_IPaddr() globalDirk Behme2010-01-171-26/+0
| | | | | | | | | | | | | | | | | | | There are boards out there that do not have network support in U-Boot (CONFIG_CMD_NET not set), but they do so in Linux. This makes it desirable to be able to port network configuration (like the IP address) to the Linux kernel. We should not make the passing of the IP configuration to Linux dependent on U-Boot features / settings. For this, make getenv_IPaddr() global. This fixes build error u-boot/lib_xxx/board.c:360: undefined reference to `getenv_IPaddr' on various architectures. Signed-off-by: Dirk Behme <dirk.behme@googlemail.com> Acked-by: Ben Warren <biggerbadderben@gmail.com>
* net: pull CONFIG checks out of source and into makefileMike Frysinger2009-12-131-4/+0
| | | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
OpenPOWER on IntegriCloud