9
0
Fork 0
Commit Graph

120 Commits

Author SHA1 Message Date
Sascha Hauer a3dfea9af8 Merge branch 'for-next/net'
Conflicts:
	drivers/net/dm9k.c
2014-06-04 21:03:45 +02:00
Holger Schurig 7158ac3f6e net: show enetaddr in lowercase
"ifconfig" and "ip" from normal Linux userspace shows ethernet addresses
normally in lowercase.  And the %pM format specifier in Linux does that,
too. Conform to this custom formatting.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-02 09:07:12 +02:00
Sascha Hauer be0404c21f net: Allow to use multiple network interfaces at once
In barebox network packets always go out at the current ethernet
device and are expected to be received from the current interface.
This has some side effects. When for example an NFS is mounted when
one interface is active and the interface is changed afterwards the
NFS packets leave the new interface, but the NFS server won't be
reachable there.

Instead of changing the whole network traffic to the current ethernet
interface we now initialize a network connection with the current
network interface, but then the connection will continue to use that
interface even when the current interface is changed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 08:16:30 +02:00
Sascha Hauer 22b878d251 net: Pass eth_device to net_receive
So that barebox has the information which interface a packet
came from.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 08:15:21 +02:00
Sascha Hauer 27d4fe7a08 net: Fix error return value for string_to_ethaddr
Return a proper error code instead of -1 which would be -EPERM.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-20 14:13:00 +01:00
Alexander Aring 32a5775125 barebox: remove double semicolons
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-18 10:13:35 +01:00
Baruch Siach b5abbd8074 net: fix checksum verification
Checksum calculation on data including its own checksum (as is the case with
IP headers) should give 0xffff before bit flipping. Current code works well
for the correct checksum case, but fails to identify errors.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-12 07:58:50 +02:00
Sascha Hauer 6d0161d02a net: store ethernet device parameters in device
Rather than storing the parameters globally and trying to keep them
in sync with the device parameters, store the parameters in the ethernet
device directly. Also, update to dev_add_param_ip().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:34 +02:00
Antony Pavlov f23198905c mem: add the swab (swap bytes) option to memory_display()
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-26 11:14:40 +01:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Jean-Christophe PLAGNIOL-VILLARD 0b3c3e7794 net: catch error on eth_send
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-16 20:39:07 +08:00
Johannes Stezenbach 69e07e2afb eth: eth MAC addresses are six bytes
Reduce confusion by making clear six bytes are passed,
not a string.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 13:58:18 +02:00
Sascha Hauer 86b9eb2105 Merge branch 'work/dns' into next 2012-04-16 11:34:41 +02:00
Jean-Christophe PLAGNIOL-VILLARD 065feea9be net: use net_alloc_packet to allocate packet
Was missing in net_init and net_new.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 18:29:53 +02:00
Sascha Hauer 158294a49a net: remove unused getenv_ip_dns
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 16:26:07 +02:00
Sascha Hauer 9058b01ebc net: register a 'net' device to store network specific variables
'nameserver' and 'domainname' should be globally available variables
specific to networking. Register a 'net' device to store these variables.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 16:26:03 +02:00
Sascha Hauer 9d699b790c net: use static string in string_to_ip
Simplify usage of ip_to_string by using a static string.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 15:05:38 +02:00
Wolfram Sang 56f6bfb820 net: arp_request: do not retry endlessly
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-05 08:56:03 +02:00
Jean-Christophe PLAGNIOL-VILLARD 9c29dab5aa net: env: getenv_ip use resolv
Introduce getenv_ip_dns to be able to do not do the resolv when using it in
resolv for the nameserver (Do not loop).

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:29 +08:00
Sascha Hauer 801af0ef12 net: set enetaddr to invalid address when an invalid string is passed
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-14 23:57:12 +01:00
Sascha Hauer fc72640247 remove unused watchdog header
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 11:46:50 +01:00
Wolfram Sang a55147be13 net: getenv_ip: check return value of string_to_ip
Return 0 if we encounter an error.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-26 13:22:25 +02:00
Wolfram Sang a3ccaecb1c net: string_to_ip: add sanity check for > 255
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-26 13:22:25 +02:00
Sascha Hauer c75ab78763 net: add a context to the packet handler
This is not yet used, but with this the different network
commands can get rid of their global data.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Krzysztof Halasa c5baa0edc4 Fix error handling with malloc, memalign etc. Introduce xmemalign().
The idea is to panic() when there is no memory available for normal
operation. Exception: code which can consume arbitrary amount of RAM
(example: files allocated in ramfs) must report error instead of panic().

This patch also fixes code which didn't check for NULL from malloc() etc.

Usage: malloc(), memalign() return NULL when out of RAM.
xmalloc(), xmemalign() always return non-NULL or panic().

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 10:21:22 +01:00
Sascha Hauer 32558d1ae5 LED: Add LED trigger support
This patch allows to associate LEDs with certain triggers, such
as heartbeat or network activity.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-20 09:57:35 +01:00
Sascha Hauer 27e3cad82d net: make locally used functions static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:25 +02:00
Sascha Hauer e7048e1862 net: use a random mac address if the current device does not have a valid address
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-22 15:44:44 +02:00
Sascha Hauer 57e1fc33bd net: remove old network stack
All network commands now use the new stack, so remove the old one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:25 +02:00
Sascha Hauer 97070487fa net: Implement a new network stack
The old network stack has some bad limitations:

- network commands are required to call NetLoop() which only returns when
  the network layer wants to. Instead we now use a net_poll() function which
  returns after handling one packet (or immediately if no packet is
  available).
- There can be only one packet handler which makes it impossible to handle
  multiple connections
- CamelCaseMakesItHardToRead

The new network stack is implemented as a parallel universe. Currently all
commands still use the old stack. They are converted in subsequent patches.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:16 +02:00
Sascha Hauer 994f95c073 net: remove need for eth_halt/eth_open
We used to eth_open/eth_halt the network devices during NetLoopInit
which is called whenever the user enters a network command.
Change this behaviour so that the current network device gets opened
when making it the current one.
With this change it's always possible to send packages and we are able
to implement a new network stack in the next step.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:16 +02:00
Sascha Hauer 42f4ca1c85 put only once used function inline
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:32 +01:00
Sascha Hauer 8f0d0f25ed replace ET_DEBUG with pr_debug
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:32 +01:00
Sascha Hauer 426de4405c remove unused NETCONSOLE stuff
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:31 +01:00
Sascha Hauer a5f301fb7a remove unused variable NetBootFileSize
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-17 08:54:57 +02:00
Sascha Hauer e2c2954654 make locally used funtion static
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-17 08:38:59 +02:00
Sascha Hauer 146f9b6e5b remove sntp support. Has been broken for long enough
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:19:28 +02:00
Sascha Hauer 4ad31ee437 do not abuse the received packet to send back another packet
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer 6289b5a51d net: remove unnecessary if
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer faa61661cf only the ping code is interested in the ping ip
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer 5619409df6 net: remove dead code
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer 4d0670f227 net: cleanup header file
move contents of bootp.h to .c file and remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer a3a5927110 net: remove switch/case in NetLoop()
Instead of having a big switch/case for every protocol, do
the right things in the individual functions before callong
NetLoop().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:57:40 +02:00
Sascha Hauer 8fe37b4e2e bootp: remove unnecessary counter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:57:40 +02:00
Sascha Hauer f787f8fbf7 net: check prerequisites in NetLoopIinit()
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:57:40 +02:00
Sascha Hauer c227c646e3 return is not a function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:54:14 +02:00
Sascha Hauer 9296260a78 net: split NetLoop in NetLoop and NetLoopInit
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:49:21 +02:00
Sascha Hauer 3487f1ee8e net: remove unused state NETLOOP_RESTART
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:48:56 +02:00
Sascha Hauer 5e29712041 net: remove NetStartAgain()
Do not let the network stack restart itself

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:48:32 +02:00