summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* net: retire global NetRxPackets arraysAhmad Fatoum2024-03-131-3/+0
| | | | | | | | | Now that no in-tree user of NetRxPackets remain, no one will miss this remnant of simpler times. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240313110704.1095554-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add net_alloc_packets helperAhmad Fatoum2024-03-131-3/+24
| | | | | | | | | | | We have a number of drivers that call net_alloc_packet in a loop and will gain some more in the quest to drop NetRxPackets. Let's provide a helper that can be used for this and a function to free the packets as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240313110704.1095554-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: drop unused rarp.hAntony Pavlov2024-02-291-23/+0
| | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Link: https://lore.barebox.org/20240227073923.148943-1-antonynpavlov@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eth: replace ethaddr_to_string() with %pMSascha Hauer2024-02-053-21/+7
| | | | | | | | Now that we can print MAC addresses using the %pM format specifier we can get rid of ethaddr_to_string(). Do this treewide. Link: https://lore.barebox.org/20240202151147.226876-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add generic MAC address derivation from machine IDAhmad Fatoum2023-11-223-5/+76
| | | | | | | | | | | | | | | Especially during development, devices often lack a MAC address. While a MAC address can be easily added to the environment: nv dev.eth0.ethaddr="aa:bb:cc:dd:ee:ff" It's easily lost when flashing complete new images, e.g. from CI. Make the development experience neater by deriving a stable MAC address if possible. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122094747.340825-3-uwe@kleine-koenig.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-08-231-13/+21
|\
| * net: ifup: don't redo ifup -a1 if we have a gatewayAhmad Fatoum2023-07-261-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ifup -a -1 is an optimization for switches that have only one port connected: ifup will poll link on all ports in parallel and early exit once any port got an IP address. This doesn't work when global.net.server is set, as the first port to get link up is not necessary one that is in a network that can resolve global.net.server. This is needlessly restrictive: Even if global.net.server is set, it's only a problem if no gateway was set. If there's a gateway, barebox already knows how to resolve global.net.server, so there's no need to try to bring up all interfaces when -1 is supplied. This fixes the delay when using ifup -a1 multiple times in a row. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230721110744.3699054-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: ifup: check for ctrl+c during ifupAhmad Fatoum2023-07-261-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | When global.net.server is set, barebox will attempt to bring up all interfaces on ifup -a1 to see which interface can resolve it. That can take a while and there's no way to abort that, so stick in a ctrlc(), so user can change their mind (and e.g. remove global.net.server, so ifup -a1 takes first interface that has link up). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230721110744.3699054-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Convert License Identifiers to SPDX 3.0 for files originating from LiMonRoland Hieber2023-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The respective U-Boot commit was ported to Barebox in commit 0b5d36d77b6022bd1f40 (2023-07-27, Sascha Hauer: "Add SPDX License identifier for files originating from LiMon"), but the U-Boot change was already made in 2014, and the SPDX specification was updated since then and deprecated the "GPL-2.0" identifier in favour of "GPL-2.0-only". Update the license identifiers to SPDX 3.0 specification, which we also use everywhere else in the Barebox code. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20230804094650.2094025-1-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net.c: Don't forget about the first fragment.Christian Melki2023-07-281-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible to request very large messages using the current code base. F.ex. UDP datagrams with the tftp client. The tftp servers will happily reply with fragmented IP frames. All these frame parts need to be dropped as BB currently doesn't do fragment reassembly. The current check was for fragment offsets only (0x1fff). But the first frame has fragment offset 0 and would slip through this check. That could result in a seemingly OK frame for the tftp client, but with broken data. Add check for the MF (More Fragments) flag. Should cover the first packet too. Signed-off-by: Christian Melki <christian.melki@t2data.com> Link: https://lore.barebox.org/20230704175535.1183448-1-christian.melki@t2data.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add SPDX License identifier for files originating from LiMonSascha Hauer2023-07-281-6/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The header of some LiMon imported files reference a License file which does not exist in barebox. These files were originally licensed under GPLv2 as can be seen in this U-Boot commit: | commit 2ea9103924048637d28baf0f7b1dd410f6704c32 | Author: Wolfgang Denk <wd@denx.de> | Date: Tue Sep 30 10:44:01 2014 +0200 | | SPDX License cleanup for LiMon imported files | | A number of network related files were imported from the LiMon | project; these contain a somewhat unclear license statement: | | Copyright 1994 - 2000 Neil Russell. | (See License) | | I analyzed the source code of LiMon v1.4.2 which was used for this | import. It does not contain any "License" file, but the top level | directory contains a file "COPYING", which turns out to be GPL v2 | of June 1991. So it is legitimate to conclude that the LiMon derived | files are also to be released under GPLv2. Mark them as such. Based on this commit add the correct SPDX License identifier. While at it drop the reference to the non-existing License file and also remove the long unmaintained file history. Reported-by: Oliver Fendt <ofendt@googlemail.com> Link: https://lore.barebox.org/20230727101008.3350548-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ifup: pass hostname and linuxdevname to linux with DHCPMichael Olbrich2023-05-021-2/+6
| | | | | | | | | | | | | Barebox always uses the hostname in the DHCP request. To configure kernel networking, use the long ip= syntax for DHCP and set the hostname as well. This way, Barebox and Linux use the same hostname in the DHCP request. Also set the device if linuxdevname is configured. This is already done for static configurations. Do the same for DHCP. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Link: https://lore.barebox.org/20230426084659.4002852-1-m.olbrich@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ifup: have ifup -a1 stop at first DHCP-set global.net.serverAhmad Fatoum2023-02-032-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | The normal use case for ifup -a is to get *some* interface working and not really wait for all interfaces to come up and then timeout waiting for those without link up to never get a DHCP lease. When using automounts with a previously empty $global.net.server, we know this to be the case, because the first DHCP interface will set the variable and all remaining ones won't affect this. Therefore, let's add a ifup -a1 option, which would stop after $global.net.server was set via DHCP. This is a special case of a possible future ifup -ar, which would check after each ifup if $global.net.server was either newly set or became resolvable, but that would be a bigger change, so we skip that for now. Times after eth_open_all has brought up CPU Ethernet and 4 DSA ports: barebox$ time ifup -a time: 10002ms barebox$ time ifup -a1 time: 1072ms Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230130072057.34349-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ifup: have ifup -a poll for link up in parallelAhmad Fatoum2023-02-032-29/+102
| | | | | | | | | | | | | | | | | DHCP is usually fairly quick, but link up check timeout is 10 seconds, which adds up, especially on systems with bigger DSA switches. The workaround is to set ethX.mode=disabled for other ports, but let's improve the default a bit and have barebox poll link ups in parallel, so instead of (number_of_ports_wihout_link * 10s), we just wait 10s at most. For setups where this is a problem, users may revert to ifup in sequence by doing ifup -a -s. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230130072057.34349-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: skip opening disabled interfaces when going interactiveAhmad Fatoum2023-01-201-1/+4
| | | | | | | | | | Ethernet device global mode (ethX.mode) may be set to disabled when ports should not be used. This setting is already respect in ifup, so do likewise for eth_open_all(), which is called when going interactive. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230117094934.3770899-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-101-9/+11
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add promiscuous mode configuration supportOleksij Rempel2022-11-081-0/+8
| | | | | | | | | | This configuration is mostly needed for controllers attached to switches with different MAC address configurations or for debugging networking issues. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20221108061009.4168735-1-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Bring up all interfaces when going interactiveSascha Hauer2022-09-221-13/+21
| | | | | | | | | | | | | | So far we only bring up network interfaces when we actually need them. This means we could be idling in the shell for long and once the user decides to do networking he has to wait for the link to be established. We can do better: Before going interactive bring up all known network interfaces which makes the links established when the user needs them. To implement this we have to rework carrier checking a bit, because otherwise barebox would wait for the links to be established before continuing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fastboot: keep error message initialized at all timesAhmad Fatoum2022-09-121-0/+2
| | | | | | | | | | Static analyzer points out that an unfortunate sequence of fastboot commands can have us end up with an uninitialized error_msg, so initialize it in that case, so we have something in there at all times. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905095557.596891-33-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ping: propagate failureAhmad Fatoum2022-09-121-1/+1
| | | | | | | | We populate ret, but don't do anything with it. Pass it along instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905095557.596891-32-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dns: Return error when nameserver not givenSascha Hauer2022-06-151-1/+1
| | | | | | | When no nameserver is given then return an error instead of returning successfully with 0.0.0.0 as return IP. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Remove duplicate incudesAlexander Shiyan2022-06-102-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning fwterated by checkincludes.pl: ./net/nfs.c: libgen.h is included more than once. ./net/ifup.c: globalvar.h is included more than once. ./crypto/rsa.c: asm/types.h is included more than once. ./lib/decompress_unlz4.c: linux/decompress/mm.h is included more than once. ./scripts/stb_image.h: stdio.h is included more than once. ./scripts/kwbimage.c: unistd.h is included more than once. ./scripts/common.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/mman.h is included more than once. ./fs/pstore/ram_core.c: linux/rslib.h is included more than once. ./fs/pstore/fs.c: fs.h is included more than once. ./fs/pstore/fs.c: linux/pstore.h is included more than once. ./fs/nfs.c: fs.h is included more than once. ./fs/uimagefs.c: fs.h is included more than once. ./fs/fs.c: command.h is included more than once. ./arch/sandbox/board/hostfile.c: linux/err.h is included more than once. ./arch/sandbox/board/devices.c: mach/linux.h is included more than once. ./arch/sandbox/os/common.c: signal.h is included more than once. ./arch/arm/boards/zii-imx51-rdu1/board.c: envfs.h is included more than once. ./arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c: generated/mach-types.h is ./arch/arm/mach-stm32mp/ddrctrl.c: mach/stm32.h is included more than once. ./arch/arm/mach-imx/cpu_init.c: common.h is included more than once. ./arch/arm/mach-imx/imx8m.c: mach/imx8m-ccm-regs.h is included more than once. ./common/efi/payload/init.c: efi.h is included more than once. ./common/state/backend_format_raw.c: common.h is included more than once. ./common/state/backend_format_raw.c: crc.h is included more than once. ./common/hush.c: libbb.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/clk.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/err.h is included more than once. ./drivers/net/virtio.c: net.h is included more than once. ./drivers/net/phy/phy.c: linux/phy.h is included more than once. ./drivers/net/cpsw.c: net.h is included more than once. ./drivers/virtio/virtio_pci_common.h: linux/list.h is included more than once. ./drivers/usb/host/ohci-hcd.c: dma.h is included more than once. ./drivers/usb/gadget/fsl_udc.c: dma.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: spi/spi.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: of.h is included more than once. ./drivers/video/imx-ipu-v3/imx-ldb.c: linux/clk.h is included more than once. ./drivers/video/imx-ipu-v3/imx-hdmi.c: linux/clk.h is included more than once. ./drivers/video/omap.c: common.h is included more than once. ./drivers/mtd/nand/nand_s3c24xx.c: asm/sections.h is included more than once. ./drivers/clk/imx/clk-imx6sx.c: linux/clk.h is included more than once. ./drivers/clk/imx/clk-imx6sl.c: linux/clk.h is included more than once. ./commands/bootm.c: of.h is included more than once. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220607051957.2497-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dns: Generate and verify transaction IDJules Maselbas2022-05-161-1/+11
| | | | | | | | | | | | | The transaction ID wasn't verified on received DNS responses, plus the ID needs to be difficult to predict in order to avoid MitM (man in the middle) being able to easily forge responses. The ID is generated from the time of the request, probably not strongly unpredictable, this what musl does and it is considered to be enough. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20220512143726.21614-1-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add ethlog commandOleksij Rempel2022-04-192-2/+5
| | | | | | | | | | It is kind of tcpdump or tshark for barebox. Instead of starting application it will let barebox dump everything to the console by still allowing to use other application. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20220413082205.429509-15-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add of_find_eth_device_by_node() functionOleksij Rempel2022-04-141-0/+16
| | | | | | | | | For DSA support we need to find MAC node by phandle from the switch port node. So, provide of_find_eth_device_by_node() to solve this task. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20220413082205.429509-3-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add RX preprocessor supportOleksij Rempel2022-04-141-0/+11
| | | | | | | | | Add callback for optional rx_preprocessor. This is needed to add DSA switch support and demultiplex traffic received from different switch ports. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20220413082205.429509-2-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add SPDX-License-Identifier for files without explicit licenseAhmad Fatoum2022-01-052-0/+4
| | | | | | | | | Record GPL-2.0-only as license for all files lacking an explicit license statement. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add SPDX-License-Identifier for Kbuild/KconfigAhmad Fatoum2022-01-052-0/+4
| | | | | | | | | | | | | | | To verify only Kconfig/Makefile is touched: git show --numstat --format=oneline HEAD | grep -v 'Kconfig\|Makefile' will print only arch/powerpc/Kbuild. To verify nothing unexpected is added: git show -U0 | grep '^-[^-]\|^+[^+]' | sort -u Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dhcp: set default DHCP vendor ID to "barebox"Oleksij Rempel2021-10-051-0/+2
| | | | | | | | | To make debugging of DHCP related issues easier, set DHCP vendor ID to "barebox" by default. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20210914064853.2808775-1-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dhcp: send current hostname as part of the DHCP requestOleksij Rempel2021-10-051-0/+8
| | | | | | | | | | | | To be able to use more advanced DHCP server configurations, for example host name pattern matching, barebox should send some name. With this patch, barebox will send barebox_hostname, if dhcp.hostname is not configured. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20210914063001.2803749-1-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fastboot net: add setter for global.fastboot.net.autostartMarco Felsch2021-08-231-6/+13
| | | | | | | | | | | | | | Without this change the only possible way to start the fastboot.net.autostart mechanism is by using the nv storage. Split fastboot_on_boot() into two functions: - a globalvar setter fastboot_net_autostart_set() and - a the globalvar init function fastboot_net_init_globalvar(). This allows init scripts to start the autostart mechanism as well. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210813083221.31763-1-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: consult device tree for ethernet address in NVMEM as fall-backAhmad Fatoum2021-06-221-0/+24
| | | | | | | | | | | | | | | | | | | | | While barebox fixes up the mac-address into the device tree, it doesn't care much for extracting a mac address _from_ the device tree, whether it be from local-mac-address property or from a mac-address nvmem cell. Fix the latter by calling of_get_mac_addr_nvmem for each Ethernet adapter. We do this in a very late initcall, because we don't want to enforce a probe a probe order between nvmem providers and network devices. We can't do it at randomization time, because we need to fixup Ethernet mac addresses, even when barebox itself doesn't ifup the netdev. of_get_mac_addr_nvmem could be replaced by of_get_mac_address to also parse local-mac-address and brethern, but justifying this change is left as a future exercise. Cc: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dns: use correct nameserver var name in error messageAntony Pavlov2021-05-251-1/+1
| | | | | | | | | | The commit d5d342d26368c1 ("net: Make domainname and nameserver globalvars") changes net.nameserver variable name to global.net.nameserver. This commit changes the variable name in the error message too. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Link: https://lore.barebox.org/20210525062133.5458-1-antonynpavlov@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-gadget'Sascha Hauer2021-05-172-4/+1
|\
| * fastboot/dfu: use system partitions as fall backAhmad Fatoum2021-05-121-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the new system partitions infrastructure to have fastboot and DFU fall back to using the same partitions if the global.usbgadget.dfu_function and global.fastboot_partitions are not set, respectively. No functional change intended for configurations that have SYSTEM_PARTITIONS disabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common: make FILE_LIST feature unconditionalAhmad Fatoum2021-05-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | CONFIG_FILE_LIST controls whether the file_list_* family of functions are compiled. common/file-list.o does not register any initcalls and there is no code that is dependent on it being available: it's selected as required. This means linker GC can completely get rid of it if required, so drop the symbol. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210503114901.13095-16-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Removed Unreachable code: net/net.c: net_handle_arp()Neeraj Pal2021-05-121-2/+0
|/ | | | | | Signed-off-by: Neeraj Pal <neerajpal09@gmail.com> Link: https://lore.barebox.org/20210508193654.81389-1-neerajpal09@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: of_fixup_node: Use reproducible node name for fixupStefan Riedmueller2021-03-301-6/+10
| | | | | | | | | To be able to fixup older devicetrees, prior to v4.15 where leading zeros of the unit addresses were removed, use the reproducible name to find the corresponding nodes. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: include <linux/math64.h> wrapper instead of <asm-generic/div64.h>Ahmad Fatoum2021-02-191-1/+1
| | | | | | | | | | | <asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the <linux/math64.h> instead. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: introduce unsetenv() to prepare for changing setenv(var, "") behaviorAhmad Fatoum2020-11-231-1/+1
| | | | | | | | | | | | | | | | | Currently, we treat setenv(var, "") and setenv(var, NULL) the same and delete var, which is surprising and leads to subtle quirks: - setenv(var, "") is specified by POSIX to set var to an empty string, but barebox uses it to delete variables - nv.user= calls nv_set with NULL parameter, but nv user="" doesn't Make the API more POSIX-like by providing unsetenv with the expected semantics. Most user code can then use unsetenv without worrying about whether "" or NULL is the magic deletion value. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Replace license and copyright boilerplate by SPDX identfiersUwe Kleine-König2020-11-028-113/+30
| | | | | | | | | Converts the files that licensecheck can determine to be licensed under GPL-2.0-only or GPL-2.0-or-later and also convert the copyright statements to SPDX. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* magicvar: Replace BAREBOX_MAGICVAR_NAMED with BAREBOX_MAGICVARSascha Hauer2020-10-024-19/+17
| | | | | | | | BAREBOX_MAGICVAR now generates a unique identifier automatically, so we can convert users of BAREBOX_MAGICVAR_NAMED to the simpler BAREBOX_MAGICVAR macro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fastboot net: implement fastboot over UDPEdmund Henniges2020-08-193-0/+594
| | | | | | | | | | | | | | This implements the UDP variant of the fastboot protocol. The only way to start the service for now is to compile with CONFIG_FASTBOOT_NET_ON_BOOT. The service will bind to the network interface that provides the IPv4 gateway. Sending an OKAY packet before performing a restart is necessary since contrary to USB the host will not notice when a UDP server disappears. Signed-off-by: Edmund Henniges <eh@emlix.com> Signed-off-by: Daniel Glöckner <dg@emlix.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: reply to ping requestsSascha Hauer2020-08-191-2/+44
| | | | | | | Now that we have the network receive function running in a poller we can reasonably well answer to ping requests. Implement this feature. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Call net_poll() in a pollerSascha Hauer2020-08-193-5/+60
| | | | | | | | | | | | | | | This adds calling of net_poll() in a poller. With this we can react to incoming packets like ping requests or fastboot requests. We could change to call net_poll() from a poller exclusively, but this would significantly slow down USB network controllers. As described in the patch these take a long time in the packet receive path. To work around this we keep the networking users call net_poll() at a high rate when they are waiting for incoming packets and only every 10ms we call net_poll() from a poller to get incoming traffic when no networking protocol is actively calling net_poll(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Add a slice to struct eth_deviceSascha Hauer2020-08-191-2/+72
| | | | | | Add ethernet code safe for being called from a poller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: eth: rename __eth_rx()Sascha Hauer2020-08-191-4/+4
| | | | | | | | | __eth_rx() not only receives packets but also checks the carrier. In the next steps it will also send the queued packets, so rename the function to eth_do_work(). Also return void as the only caller can't do anything with the return value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: Fix out of bounds readSascha Hauer2020-06-031-1/+3
| | | | | | | | | nfs_read_reply() interprets the fields of an incoming packet directly as a field length without checking the boundaries. Clamp the maximum length to the packet length to avoid reading out of bounds. Reported-by: Jai Verma <jai2.verma@outlook.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove references to CREDITSUwe Kleine-König2020-04-276-18/+0
| | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>