summaryrefslogtreecommitdiffstats
path: root/net/ifup.c
Commit message (Collapse)AuthorAgeFilesLines
* net: on ifup -a only detect devices when necessarySascha Hauer2018-04-091-1/+20
| | | | | | | | | | | | | | | | For network boot we once used to hardcode eth0, but in latest changes this was changed to work with different network devices and the 'ifup eth0' was replaced with 'ifup -a' which lead to the result that we now detect all devices in order to eventually also bring up USB network adapters. In most of the cases this is not desired. When a board has internal network support this is likely to be used. With this patch we only detect all devices when we do not have a network device already. For the unusual case in which a USB network adapter shall be used even when an internal network interface is present we introduce the global variable "global.net.ifup_force_detect" which can be used to force detection of devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Add linuxdevname propertySascha Hauer2017-12-151-3/+11
| | | | | | | | | | | | | | | | | When you have a static network environment but more than one network device on your machine it is necessary to provide the <device> parameter to the ip parameter at kernel cmd line. The device name assigned by Linux cannot in general be predicted as it depends on driver bind order. This patch introduces a new property linux.devname to eth devices. The value is added to bootargs per interface and can be changed in env/network/INTF Based on patch by Gavin Schenk <g.schenk@eckelmann.de>. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Provide new way to configure network devicesSascha Hauer2017-12-141-88/+168
| | | | | | | | | | | | | | | | | | | This provides a new way to configure network interfaces based on nvvars. A network interface can now be configured with variables in the nv.dev.<ethname>.* namespace. There is a new network device parameter "mode" which specifies the mode used to obtain IP settings. The mode can be "dhcp", "static" or "disabled": nv.dev.eth0.mode=dhcp (ipaddr, netmask are ignored in this setting) nv.dev.eth0.mode=static nv.dev.eth0.ipaddr=192.168.0.17 nv.dev.eth0.netmask=255.255.0.0 nv.dev.eth0.mode=disabled Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ifup: Use dhcp C API rather than running commandSascha Hauer2017-12-141-4/+2
| | | | | | DHCP has a C API, so use it instead of running as command. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ifup: Factor out a eth_discover functionSascha Hauer2017-12-141-12/+26
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: remove "current" network deviceSascha Hauer2017-12-141-2/+0
| | | | | | | Now that we can do routing we no longer need a "current" network device. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dhcp: Allow to specify network deviceSascha Hauer2017-12-141-1/+4
| | | | | | | | | Instead of allowing to DHCP only on the "current" network device, allow to specify the desired network device. This is a first step to get rid of the concept of a "current" network device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Use a single gatewaySascha Hauer2017-12-011-1/+3
| | | | | | | | | | | | | | There is not much point in having a network device specific gateway. If barebox really is part of such a complicated network in which it needs multiple gateways, then we probably need a real routing table. Until this happens, a single gateway should be enough. This introduces global.net.gateway which holds the gateway ip. The previously used device specific <ethx>.gateway variables still exist, but are only aliases for the single gateway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dhcp: Do not overwrite serverip if it is validSascha Hauer2017-12-011-3/+6
| | | | | | | | | | | | | Some DHCP servers provide the wrong serverip in which case it is desired to specify it manually and won't let the dhcp command overwrite it. This has previously been done by setting the serverip again to the desired value after dhcp has been executed. With this patch we do not overwrite it in the first place if it is valid already. This is necessary when the serverip is not set via /env/network/eth* but via nv.net.server. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: introduce global.net.serverSascha Hauer2017-12-011-1/+6
| | | | | | | | | | | | The server to use is independent of the network device, there is not much point to make the server specific to a network device. This introduces global.net.server as the serverip which is used as standard NFS/tftp server. The previously used eth device specific parameters still exist, but are only aliases for the global single variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add linux.bootarg parameter from ifup callEnrico Jorns2016-09-221-0/+9
| | | | | | | | | | | | | This sets a `ip=dhcp` or `ip=<clientip>:<serverip>:<gatewayip>:<netmaskip>::<iface>:` bootarg for the network device upon execution of 'ifup'. This is the only point where we can distinguish between a static ip and a dhcp-based network setup and thus set a valid bootarg options as it will be required for nfs boot, for example. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ifup: fix handling when ip env is not givenAlexander Aring2016-06-151-0/+3
| | | | | | | | This patch handles the ip env to "" if no ip env is given. Otherwise we get a NULL pointer derefence. Signed-off-by: Alexander Aring <aar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-2/+2
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ifup: Add comment why xxx-discover files have to be skippedSascha Hauer2014-06-231-0/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ifup: skip *-discover files for ifup -aSascha Hauer2014-06-231-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2014-06-041-0/+2
|\ | | | | | | | | Conflicts: drivers/net/dm9k.c
| * net: ifup: Set current ethernet device when doing ifupSascha Hauer2014-05-151-0/+2
| | | | | | | | | | | | | | 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>
* | commands: harmonize in-barebox documentationHolger Schurig2014-05-141-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | commands: group 'help' outputHolger Schurig2014-05-141-0/+1
|/ | | | | | | | | | | | | | | | | | | 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>
* net/ifup.c: avoid setting the MAC twiceJuergen Borleis2014-04-241-1/+0
| | | | | | | | | | 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>
* net/ifup.c: don't fail silentlyJuergen Borleis2014-04-241-2/+6
| | | | | | | | | | | Since commit a162dfe50345d3461010759f8a0e79f7e388c140 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>
* ifup: set serverip to provided value when doing dhcpSascha Hauer2014-03-141-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Add ifup supportSascha Hauer2014-03-071-0/+179
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>