summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* 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-153-7/+7
| | | | | | | | | | 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>
* Merge branch 'for-next/rtc'Sascha Hauer2016-01-113-0/+176
|\
| * net: Add SNTP supportSascha Hauer2016-01-073-0/+176
| | | | | | | | | | | | | | | | This adds support for retrieving the time via Simple Network Time Protocol (SNTP). No fancy features are supported, only plainly getting the current time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: resolv: Make argument constSascha Hauer2015-12-141-2/+2
| | | | | | | | | | | | resolv() is not allowed to change the hostname argument, make it const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: dhcp: make unmodified variable constSascha Hauer2015-12-141-3/+3
| | | | | | | | | | | | | | 'str' in dhcp_set_string_options is never modified, so make it const. With this we no longer have to cast away the const returned from getenv. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: dhcp: simplify dhcp_options_processSascha Hauer2015-12-141-9/+6
| | | | | | | | | | | | | | | | | | | | dhcp_options_handle returns the index into the dhcp_options array. This is only to be able in the caller to print a debug message when the index returned from dhcp_options_handle is out of bounds. Simplify this by printing the debug message in dhcp_options_handle and not in the caller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: dhcp: unify options and paramsSascha Hauer2015-12-141-77/+57
|/ | | | | | | | | The dhcp code distinguishes between options and params. If sent to the server they are params, if received from the server they are options. Unify them all to be options. If it has a handle_param callback it's a param, if it has a handle callback it's an option. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: Remove ethaddr_paramJan Remmet2015-11-201-2/+2
| | | | | | | | commit d00db554 introduce ethaddr_param. But it is not initialized, so devinfo fails to show the mac. Remove it and use edev->ethaddr. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: Fixup OF tree with registered MAC addresses tooTrent Piepho2015-10-221-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | The eth code registers an OF tree fixup that looks for any nodes in the Linux oftree that match eth devices loaded in barebox and sets the mac-address property in those nodes. The purpose is to pass MAC addresses to the Linux kernel for drivers that expect the MAC address to be in the device tree. If barebox does not have a driver for the network device, either because it has been disabled or because one does not exist, then the OF tree will not be fixed up to include a MAC address. The eth code also has a list of MAC addresses which board code has registered, usually done when it reads the address from an EEPROM or on-chip memory. If an eth device is created later in the boot, it will look here for an address. The registered MAC address list is not used for the OF tree fix up, and this patch changes that. This way barebox can place a MAC address in the device-tree without needing a driver for the network device. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: Refactor OF tree fixup of one node into new functionTrent Piepho2015-10-221-28/+34
| | | | | | | | Code that fixes up one node with a new MAC address is refactored into a new function that eth_of_fixup() calls in a loop. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dhcp: Fix CONFIG variable nameWadim Egorov2015-09-291-1/+1
| | | | | Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2015-08-061-0/+8
|\
| * net: make eth_register_ethaddr work on registered network devicesSascha Hauer2015-07-281-0/+8
| | | | | | | | | | | | | | 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>
* | net: eth_send: Allow to use multiple network interfaces at onceAntony Pavlov2015-07-231-1/+1
|/ | | | | | | | | | | | | | | | | | | | The commit commit be0404c21f22da2d736168b2e56a9ae583cc3e95 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Wed May 14 16:08:04 2014 +0200 net: Allow to use multiple network interfaces at once changes the eth_send() function: - return eth_current->send(eth_current, packet, length); + return edev->send(eth_current, packet, length); But we have to change the both eth_current occurrences to edev here! Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2015-07-031-4/+9
|\
| * dns: handle incoming packets in the separate dns_recv() functionAntony Pavlov2015-07-011-4/+9
| | | | | | | | | | | | | | | | The separation of incoming packets handling makes it much easier to run barebox dns client on top of picotcp network stack in the future. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: fix 'new blank line at EOF' formatting errorAntony Pavlov2015-07-022-2/+0
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: Move library functions to net/lib.cSascha Hauer2015-07-023-78/+110
| | | | | | | | | | | | | | Some network related functions are also needed when networking is disabled. Move these to a separate file which is always compiled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: eth: Do not rely on CONFIG_PARAMETER to be enabledSascha Hauer2015-06-262-9/+20
|/ | | | | | | | | register_preset_mac_address only works when CONFIG_PARAMETER is enabled because otherwise dev_set_param is a no-op. Add a function to set the MAC address explicitly without the need of CONFIG_PARAMETER and use it where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/am33xx'Sascha Hauer2015-06-093-102/+69
|\
| * net: dhcp: Split dhcp funcionality & add dhcp commandWadim Egorov2015-06-053-102/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | dhcp/bootp was bound to the command functionality. This patch splits the dhcp command. We are now able to use bootp without a shell. This patch adds also a check for environment variables and globalvar. So only when ENVIRONMENT_VARIABLES and GLOBALVAR is set, all received dhcp data will be stored. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | eth: halt active ethernet device on unregisterSascha Hauer2015-04-281-0/+3
|/ | | | | | | When an active ethernet device is unregistered it should be halted to quiesce the device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ping: return an error exit code when connection failsMirko Damiani2015-04-031-3/+3
| | | | | | | | | 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>
* Merge branch 'for-next/net'Sascha Hauer2015-02-041-6/+3
|\
| * dhcp: fix request packet's seconds elapsedEric Bénard2015-01-291-2/+1
| | | | | | | | | | | | | | 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>
| * dhcp: fix request packetEric Bénard2015-01-291-3/+1
| | | | | | | | | | | | | | 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>
| * dhcp: fix request packet's requested IP optionEric Bénard2015-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | console: allow to specify the device idJean-Christophe PLAGNIOL-VILLARD2015-01-131-0/+1
|/ | | | | | | 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>
* netconsole: activate in set_active callbackSascha Hauer2014-12-171-21/+34
| | | | | | | | | 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>
* net: Call edev->recv with correct eth_deviceSascha Hauer2014-09-171-1/+1
| | | | | | | | 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>
* netconsole: rename console to "netconsole"Sascha Hauer2014-07-111-0/+1
| | | | | | So that it can be used without guessing the name first. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Do not use macros in command helpSascha Hauer2014-07-081-1/+1
| | | | | | | 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>
* Documentation: remove doxygen documentationSascha Hauer2014-06-261-28/+0
| | | | | | | 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>
* 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-043-40/+54
|\ | | | | | | | | Conflicts: drivers/net/dm9k.c
| * net: take eth id from devicetree aliasSascha Hauer2014-05-151-2/+11
| | | | | | | | | | | | | | If the devicetree has an alias for the ethernet device, then use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: Allow to use multiple network interfaces at onceSascha Hauer2014-05-152-37/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * net: Pass eth_device to net_receiveSascha Hauer2014-05-151-1/+1
| | | | | | | | | | | | | | So that barebox has the information which interface a packet came from. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * 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>
* | net: show enetaddr in lowercaseHolger Schurig2014-06-021-1/+1
| | | | | | | | | | | | | | | | | | "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>
* | commands: move CMD_IFUP to commands/KconfigHolger Schurig2014-05-141-7/+0
| | | | | | | | | | | | | | | | | | * 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>
* | commands: NET_DHCP -> CMD_DHCPHolger Schurig2014-05-142-5/+1
| | | | | | | | | | | | | | | | | | | | | | * 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>
* | commands: NET_PING -> CMD_PINGHolger Schurig2014-05-142-5/+1
| | | | | | | | | | | | | | | | | | | | | | * 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>
* | commands: introduce CMD_HOSTHolger Schurig2014-05-141-1/+2
| | | | | | | | | | | | | | | | ... 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>
* | commands: harmonize in-barebox documentationHolger Schurig2014-05-145-38/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-145-0/+5
|/ | | | | | | | | | | | | | | | | | | 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>