summaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Collapse)Author
2012-07-10net: fix typo in arp clean upMike Frysinger
The clean up patch missed an &, so we end up passing an int rather than a pointer to the sprintf function. arp.c: In function 'ArpReceive': arp.c:197: warning: format '%p' expects type 'void *', but argument 3 has type 'int' Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-07-10Minor Coding Style cleanupWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2012-07-08net: make net_rand.h inclusion depend on BOOTP_RANDOM_DELAYKim Phillips
commit "net: use common rand()/srand() functions" introduced the following build warning on the current u-boot-arm tree: $ ./MAKEALL MPC8313ERDB_66 Configuring for MPC8313ERDB_66 - Board: MPC8313ERDB, Options: SYS_66MHZ text data bss dec hex filename 271988 13976 41768 327732 50034 ./u-boot In file included from bootp.c:15:0: net_rand.h: In function 'srand_mac': net_rand.h:40:2: warning: implicit declaration of function 'srand' [-Wimplicit-function-declaration] adding this dependency fixes it. Cc: Michael Walle <michael@walle.cc> Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Acked-by: Michael Walle <michael@walle.cc>
2012-07-07net: add helper to generate random mac addressMichael Walle
Add new function eth_random_enetaddr() to generate a locally administered ethernet address. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Joe Hershberger <joe.hershberger@gmail.com>
2012-07-07net: use common rand()/srand() functionsMichael Walle
Replace rand() with the functions from lib/. The link-local network code stores its own seed, derived from the MAC address. Thus making it independent from calls to srand() in other modules. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Allow filtering on debug traces in the net subsystemJoe Hershberger
Add several levels of DEBUG prints so that you can limit the noise to the severety of your problem. DEBUG_LL_STATE = Link local state machine changes DEBUG_DEV_PKT = Packets or info directed to the device DEBUG_NET_PKT = Packets on info on the network at large DEBUG_INT_STATE = Internal network state changes Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Work-around for brain-damaged Cisco equipment with arp-proxyJoe Hershberger
Cisco's arp-proxy feature fails to ignore the link-local address range This means that a link-local device on a network with this Cisco equipment will reply to ARP requests for our device (in addition to our reply). If we happen to reply first, the requester's ARP table will be populated with our MAC address, and one packet will be sent to us... shortly following this, the requester will get an ARP reply from the Cisco equipment telling the requester to send packets their way instead of to our device from now on. This work-around detects this link-local condition and will delay replying to the ARP request for 5ms so that the first packet is sent to the Cisco equipment and all following packets are sent to our device. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Add link-local addressing supportJoe Hershberger
Code based on networking/zcip.c in busybox commit 8531d76a15890c2c535908ce888b2e2aed35b172 Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Separate ArpRequest() into lower-level funcJoe Hershberger
Link-local support will need to send ARP packets, but needs more fine-grained control over the contents. Split the implementation into 2 parts so link-local can share the code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Don't copy every packet that waits for an ARPJoe Hershberger
Use the NetArpTxPacket for the ARP packet, not to hold what used to be in NetTxPacket. This saves a copy and makes the code easier to understand. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Fix net buffer initializationJoe Hershberger
A new non-static function net_init() will initialize buffers and read from the environment. Only update from the env on each entry to NetLoop(). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Remove unused parameter from NetInitLoop()Joe Hershberger
Noone uses it. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Remove static allocation for MAC address in PingSend()Joe Hershberger
Don't force ARP clients to return the MAC address if they don't care (such as ping) Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23net: Add option CONFIG_BOOTP_MAY_FAILJoe Hershberger
This is useful if you want to look for a DHCP server, but try some other settings if not available. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Fix unused variable compile warningJoe Hershberger
If CONFIG_BOOTP_SERVERIP is not defined, unused variable warning is reported. This was fixed upstream using a compiler feature instead of a simple reorder of the statements. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23net: Add net_update_ether() to handle ARP and Ping repliesJoe Hershberger
When the network is VLAN or SNAP, net_update_ether() will preserve the original Ethernet packet header and simply replace the src and dest MACs and the protocol Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
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: Refactor to use NetSendPacket instead of eth_send directlyJoe Hershberger
Use this entry-point consistently across the net/ code Use a static inline function to preserve code size Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Refactor ping receive handlerJoe Hershberger
There is no need to call through the handler... inline it Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23net: Move debug trace to point of actionJoe Hershberger
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Refactor bootp packet length computationsJoe Hershberger
Eliminate pointer subtraction that recovers values computed earlier Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Refactor packet length computationsJoe Hershberger
Save the length when it is computed instead of forgetting it and subtracting pointers to figure it out again. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23net: Refactor NetSendUDPPacket to share more codeJoe Hershberger
Share more of the code that is common between ARP vs not. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: Refactor IP, UPD, and ICMP header writing functionsJoe Hershberger
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>
2012-05-23net: cosmetic: Replace magic numbers in arp.c with constantsJoe Hershberger
Use field names and sizes when accessing ARP packets Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Rename tmp to reply_ip_addr in arp.cJoe Hershberger
Renamed for clarity Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: cosmetic: Alphabetize includes in net.cJoe Hershberger
Easier to find when alphabetized Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Rename OPT_SIZE to OPT_FIELD_SIZEJoe Hershberger
Clearer constant name. Also remove related BOOTP_SIZE which was unused and doesn't take into account VLAN packets. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Rename CDPHandler to cdp_receiveJoe Hershberger
This is not called as a handler, so don't name it that way Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Rename "x" to "eth_proto"Joe Hershberger
x is a poor variable name Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23net: cosmetic: Add a more explicit comment about 802.2Joe Hershberger
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>
2012-05-23net: cosmetic: Rename parameter len to payload_lenJoe Hershberger
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>
2012-05-23net: cosmetic: Un-typedef ICMP_tJoe Hershberger
Remove typedef and lower-case name Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Un-typedef ARP_tJoe Hershberger
Remove typedef and lower-case letters Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Un-typedef VLAN_Ethernet_tJoe Hershberger
Eliminate the typedef and remove capital letters Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Un-typedef Ethernet_tJoe Hershberger
Separate the Ethernet header from the 802 header. Base the size constants on the structs. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: cosmetic: Split struct ip_udp_hdr into ip_hdrJoe Hershberger
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>
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-23net: Move RARP receive logic out of net.cJoe Hershberger
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>
2012-05-23net: Move PING out of net.cJoe Hershberger
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>
2012-05-23net: Move ARP out of net.cJoe Hershberger
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>
2012-05-23net: Encapsulate CDP packet identificationJoe Hershberger
Checking for CDP packets should be encapsulated, not copied code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Move CDP out of net.cJoe Hershberger
Separate this functionality out of the net.c behemoth Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23net: Move MAC-seeded rand out of bootp.cJoe Hershberger
Make the MAC-seeded random number generator available to /net in general. MAC-seeded rand will be needed by link-local as well, so give it an interface. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-15net: move bootfile init into eth_initializeMike Frysinger
All arches init this the same way, so move the logic into the core net code to avoid duplicating it everywhere else. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-15net: punt bd->bi_ip_addrMike Frysinger
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>
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: cosmetic: sntp.* checkpatch complianceJoe Hershberger
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2012-05-15net: cosmetic: rarp.* checkpatch complianceJoe Hershberger
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>