9
0
Fork 0
Commit Graph

411 Commits

Author SHA1 Message Date
Sascha Hauer 111a6aa4a9 net: make eth_register_ethaddr work on registered network devices
When eth_register_ethaddr is called after the device has been registered
it should work aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-05 15:42:37 +02:00
Holger Hans Peter Freyther f6c5d9045a net: Initial frame to be able to send LLDP frames from barebox
Fixes: SYS#488
2015-06-14 12:17:08 +02:00
Sascha Hauer acd1d67ea2 eth: halt active ethernet device on unregister
When an active ethernet device is unregistered it should
be halted to quiesce the device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 12:41:45 +02:00
Mirko Damiani e44c9b04c4 net: ping: return an error exit code when connection fails
ping command does not always returns 1 as exit code when connection to
host fails. In particular it returns the exit code of the previous run.
This patch fixes this issue.

Signed-off-by: Mirko Damiani <mirko@develer.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-03 08:03:08 +02:00
Sascha Hauer 37052f6c9b Merge branch 'for-next/net' 2015-02-04 19:09:15 +01:00
Eric Bénard 223adf761b dhcp: fix request packet's seconds elapsed
it's done in the discover packet so let's do it also in the request packet.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 08:39:04 +01:00
Eric Bénard ea0a3b7da8 dhcp: fix request packet
we are not supposed to fill ciaddr, yiaddr and siaddr in the request packet.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 08:39:03 +01:00
Eric Bénard 1f9cf67ab0 dhcp: fix request packet's requested IP option
In the request packet, we are supposed to copy the IP that the DHCP server
provided in the offer packet so that dhcp_extended can fill the option 50.
There is actually an error in barebox as the pointer to the packet currently
built is used as the source instead of the pointer to the offer packet.
With this patch, barebox now sends a request packet which includes the right
requested IP in option 50.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-29 08:39:03 +01:00
Jean-Christophe PLAGNIOL-VILLARD a1a582f4e0 console: allow to specify the device id
so we can use dynamic number id with specific devname

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-13 08:48:59 +01:00
Sascha Hauer 0ef2e3e315 netconsole: activate in set_active callback
Activate the netconsole in the set_active callback. Add proper
checks there for port and ip address, print an error when the network
hasn't been configured and finally print when the netconsole has
been enabled successfully. This makes using of the netconsole easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-17 15:09:35 +01:00
Sascha Hauer 5c0bd50319 net: Call edev->recv with correct eth_device
edev->recv has to be called with edev as argument, not eth_current.
This fixes networking when multiple network devices are used and the
current one is switched during runtime.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-17 12:27:42 +02:00
Sascha Hauer 8eacfa71ab netconsole: rename console to "netconsole"
So that it can be used without guessing the name first.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-11 09:58:47 +02:00
Sascha Hauer deef1e80f3 Do not use macros in command help
The help texts are parsed by sphinx which cannot handle macros, so
replace them with their values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-08 07:52:36 +02:00
Sascha Hauer 98360be0fe Documentation: remove doxygen documentation
The doxygen documentation is long outdated. Remove it. It will
be replaced with sphinx based documentation later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-26 10:09:52 +02:00
Sascha Hauer 40d89c4977 ifup: Add comment why xxx-discover files have to be skipped
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-23 10:05:40 +02:00
Sascha Hauer 096e5c856b net: ifup: skip *-discover files for ifup -a
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-23 09:14:31 +02:00
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 0cf4630cd2 net: take eth id from devicetree alias
If the devicetree has an alias for the ethernet device, then use
it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 10:04:51 +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 75482a0663 net: ifup: Set current ethernet device when doing ifup
When doing an ifup set the current interface to the one just
brought up so that it is actually used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 08:15:13 +02:00
Holger Schurig fc0f7eec82 commands: move CMD_IFUP to commands/Kconfig
* this places the command into the "Network commands"
  section of Kconfig
* while at it, improve Kconfig documention

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:49 +02:00
Holger Schurig c524f74d5b commands: NET_DHCP -> CMD_DHCP
* this compile option actually turns on a command, so name it
  accordingly
* also move the Kconfig definition into commands/Kconfig, thus
  placing getopt into the "Network commands" section
* while at it, improve Kconfig documention

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:49 +02:00
Holger Schurig 5bd055b660 commands: NET_PING -> CMD_PING
* this compile option actually turns on a command, so name it
  accordingly
* also move the Kconfig definition into commands/Kconfig, thus
  placing getopt into the "Network commands" section
* while at it, improve Kconfig documention

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:48 +02:00
Holger Schurig 86dda115a7 commands: introduce CMD_HOST
... because NET_RESOLV can be used alone to turn on the functionality
of resolv().

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:48 +02:00
Holger Schurig f1f532084a commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:

* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
  options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
  is listed by character in this (short) option string (the long
  description is in the long help text, as before)
* help texts have been reworked, to make them
  - sometimes smaller
  - sometimes describe the options better
  - more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
  macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
  all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
  is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
  errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
  compiled long help texts
* 'help -v' gives a list of commands with their short description, this
  is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:43 +02:00
Holger Schurig ab23d0bb3f commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.

The old output format (plus grouping) is now available with 'help -v'.

Example:

   Information commands:
     ?, devinfo, help, iomem, meminfo, version
   Boot commands:
     boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
   ...

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 07:59:55 +02:00
Juergen Borleis 3018f13670 net/ifup.c: avoid setting the MAC twice
The command always sets the MAC address of the interface in the code path.
For the static network configuration case it sets it again, due to the
environment variable keyword ("ethaddr") is listed again in the table.
Remove this keyword from the table, because the MAC is already set.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-24 09:03:31 +02:00
Juergen Borleis 4428de2aad net/ifup.c: don't fail silently
Since commit a162dfe503 the ifup command is
implemented in C and runs up to two external scripts.
If one of these scripts return with an error code, the command terminates
silently. This can confuse a user because there is no hint about the reason
why it fails. Add error messages to avoid this case.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-24 09:03:31 +02:00
Sascha Hauer 245bc10ca5 Merge branch 'for-next/misc' 2014-04-04 10:06:22 +02:00
Sascha Hauer 1273cc2d47 param: Add dev_add_param_mac
This adds a convenience function to register a MAC address device
parameter. The only current user is converted to use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-04 09:04:31 +02:00
Sascha Hauer 33987e9600 netconsole: bail out when no connection is opened
When no connection is opened we should not call into
the networking stack. Otherwise it can happen that we
delay further execution until the network stack detected
a link (or timed out bringing the link up).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-31 09:19:35 +02:00
Sascha Hauer 81b4c03a2b ifup: set serverip to provided value when doing dhcp
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-14 11:09:48 +01:00
Sascha Hauer 144358e0aa Merge branch 'for-next/nfs'
Conflicts:
	defaultenv/defaultenv-2-base/bin/ifup
2014-03-07 09:25:44 +01:00
Sascha Hauer e358922a74 Merge branch 'for-next/mtd'
Conflicts:
	drivers/mtd/core.c
	net/eth.c
2014-03-07 09:25:18 +01:00
Sascha Hauer a162dfe503 net: Add ifup support
The defaultenv-2 has ifup support as a shell script. This patch
replaces it with a command which is more robust, can be called
from C and now can also bring up all configured interfaces.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:36 +01:00
Sascha Hauer 72dfc499c8 net: constify eth_get_byname argument
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:31 +01:00
Sascha Hauer d23af7a0a0 device: remove parameters when unregistering a device
Otherwise we loose memory on each device_unregister. The ethernet
code used to do this before calling unregister_device. This can
now be removed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-13 19:39:11 +01:00
Lucas Stach aa6694b542 remove redundant NULL check on free
free() already checks the pointer to be non
NULL. No need to do it again.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01: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
Sascha Hauer b67b2671c2 treewide: Add missing includes
A lot of files rely on include/driver.h including include/of.h (and
this including include/errno.h. include the files explicitly so we can
eventually get rid of including of.h from driver.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:42:04 +01:00
Sascha Hauer d7c1612d65 of: Add a context pointer to fixup functions
If drivers want to fixup their specific instance they need some context
to know which instance they have to fixup.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 10:24:46 +01:00
Sascha Hauer 574947ef76 Merge branch 'for-next/console' 2013-10-07 07:59:18 +02:00
Sascha Hauer d28c9bb55d dhcp: replace dhcp_getenv_int with getenv_uint
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-07 07:59:00 +02:00
Jean-Christophe PLAGNIOL-VILLARD e62d425517 console: drop f_caps and check the function pointer getc/putc instead
None of the driver make the difference between STDOUT and STDERR.
So we just need to check if putc or getc are filled in the console_device

save 32 bytes on versatilepb

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-21 09:59:16 +02:00
Sascha Hauer 91a68050e1 Merge branch 'for-next/powerpc' 2013-09-05 13:59:31 +02:00
Sascha Hauer 1729b1798e Merge branch 'for-next/boardinfo'
Conflicts:
	arch/mips/boards/qemu-malta/init.c
	commands/bootm.c
	drivers/of/base.c
2013-09-05 10:39:22 +02:00
Renaud Barbier a78431c7fc net, of: fixup MAC address by alias
If a network device has not been registered from the devicetree, we may
still find it by its alias in the devicetree. This way also platform based
network devices can obtain a valid MAC address in the devicetree.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-05 10:28:04 +02:00