nuttx-apps/nshlib
Zhe Weng 9abc82c792 nshlib/ifconfig: Generate default IPv4 gateway with netmask
Generate default gateway using configured netmask instead of fixed
255.255.255.0, which may be more flexible under certain situations.
e.g. A subnet like 10.0.23.16/28 may not contain the .1 address.

Before:

ifconfig eth0 10.0.23.22 netmask 255.255.255.252 => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.255.240 => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.255.0   => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.0.0     => DRaddr:10.0.23.1

ifconfig eth0 10.0.23.22 => Mask:255.255.255.0      DRaddr:10.0.23.1

After:

ifconfig eth0 10.0.23.22 netmask 255.255.255.252 => DRaddr:10.0.23.21
ifconfig eth0 10.0.23.22 netmask 255.255.255.240 => DRaddr:10.0.23.17
ifconfig eth0 10.0.23.22 netmask 255.255.255.0   => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.0.0     => DRaddr:10.0.0.1

ifconfig eth0 10.0.23.22 => Mask:255.255.255.0      DRaddr:10.0.23.1

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-07 07:16:43 -08:00
..
CMakeLists.txt
Kconfig
Make.defs
Makefile
nsh_alias.c
nsh_altconsole.c
nsh_builtin.c
nsh_codeccmd.c
nsh_command.c
nsh_console.c
nsh_console.h
nsh_consolemain.c
nsh_dbgcmds.c
nsh_ddcmd.c
nsh_envcmds.c
nsh_fileapps.c
nsh_fscmds.c
nsh_fsutils.c
nsh_init.c
nsh_login.c
nsh_mmcmds.c
nsh_mntcmds.c
nsh_modcmds.c
nsh_netcmds.c nshlib/ifconfig: Generate default IPv4 gateway with netmask 2023-12-07 07:16:43 -08:00
nsh_parse.c
nsh_passwdcmds.c
nsh_printf.c
nsh_proccmds.c
nsh_romfsetc.c
nsh_romfsimg.h
nsh_routecmds.c
nsh_script.c
nsh_session.c
nsh_syscmds.c
nsh_system.c
nsh_telnetd.c
nsh_telnetlogin.c
nsh_test.c
nsh_timcmds.c
nsh_usbconsole.c
nsh_usbtrace.c
nsh_vars.c
nsh.h
rc.sysinit.template
rcS.template