[PATCH v2] commands: Add `ip` command for listing interfaces, addresses, and routes

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 17 02:07:17 PDT 2025


On Sat, Mar 15, 2025 at 02:52:45PM +0100, Oleksij Rempel wrote:
> This patch introduces the `ip` command, providing functionality similar
> to Linux’s `ip` tool, catering to users with strong Linux muscle memory.
> It supports:
> 
> - `ip l` / `ip link`   - Show network interfaces (state, MAC address)
> - `ip a` / `ip addr`   - Show assigned IP addresses and netmasks
> - `ip r` / `ip route`  - Show routing table, including default gateway,
>                          interface-specific routes, DNS, and server IP.
> 
> Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
> ---
> changes v2:
> - add SPDX
> - fix help in Kconfig
> - add support for range of commands
> - use COMMAND_ERROR_USAGE
> ---
>  commands/Kconfig  |   9 +++
>  commands/Makefile |   1 +
>  commands/ip.c     | 159 ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 169 insertions(+)
>  create mode 100644 commands/ip.c
> 
> diff --git a/commands/Kconfig b/commands/Kconfig
> index fe459fa862f5..466afa7fa479 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -1397,6 +1397,15 @@ config CMD_TFTP
>  	  Options:
>  		  -p	push to TFTP server
>  
> +config CMD_IP
> +	tristate
> +	prompt "ip"
> +	default y

Dropped the default y while applying.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list