Commit Graph

132 Commits

Author SHA1 Message Date
Zhe Weng
93b4dc2692 ifconfig: Support ifconfig interface and update arg limit
From comment in cmd_ifconfig, it seems that we support `ifconfig [interface]`, but actually not considering the interface param now. After this commit, we only print the information of interface specified in param, just like linux.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-02-01 11:12:24 +08:00
Zhe Weng
2ad05e3062 ifconfig: Support prefixlen/CIDR for IPv6
Linux:
ifconfig eth0 [inet6] add 2022::2/96

FreeBSD:
ifconfig eth0 inet6 2022::2/96
ifconfig eth0 inet6 2022::2 prefixlen 96

NuttX newly supported:
ifconfig eth0 inet6 [add] 2022::2/96
ifconfig eth0 inet6 [add] 2022::2 prefixlen 96

Ref:
https://man7.org/linux/man-pages/man8/ifconfig.8.html
https://www.freebsd.org/cgi/man.cgi?ifconfig

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-12-29 17:33:59 +08:00
Zhe Weng
8f10dde6ad ifconfig: Allow hostip on first non-option place after inet/inet6
NuttX previous:

ifconfig eth0 10.0.0.1 [inet]
ifconfig eth0 2022::2 inet6

Try to be compatible with other systems:

Linux:
ifconfig eth0 [inet] 10.0.0.1
ifconfig eth0 [inet6] add 2022::2

FreeBSD:
ifconfig eth0 inet 10.0.0.1
ifconfig eth0 inet6 2022::2

NuttX newly supported:
ifconfig eth0 [inet] 10.0.0.1
ifconfig eth0 inet6 [add] 2022::2

Ref:
https://man7.org/linux/man-pages/man8/ifconfig.8.html
https://www.freebsd.org/cgi/man.cgi?ifconfig

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-12-29 17:33:59 +08:00
Xiang Xiao
cfc005a460 arp: Remove the unnecessary inclusion of nuttx/net/arp
and change the remain inclusion to netinet/arp.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 22:11:10 +02:00
zhanghongyu
c7e8ade590 arp: change arptable get struct from arp_entry_s to arpreq
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-12-14 21:19:37 +08:00
zhanghongyu
df3121213e cmd_arp: add device input for arp interface
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-12-14 21:19:37 +08:00
Junbo Zheng
79e770b0c6 apps/nshlib: add the missing FAR macro for all source files
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2022-09-22 14:22:13 +08:00
chao an
e6e4661131 nshlib/netcmd: add sanity check for netdev
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-06 23:01:18 +08:00
Fotis Panagiotopoulos
0cdb2cfa48 Fixed compiler warnings. 2022-08-23 01:39:59 +08:00
Peter van der Perk
dcd60a2abe Use thread-safe ntoa functions
NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

API fixes and NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Use thread-safe ntoa functions

NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

API fixes and NXStyle fixes

Apply suggestions from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-08-04 23:18:06 +08:00
liyi
c5102fe504 ifconfig support set IPv6 DNS server
Signed-off-by: liyi <liyi25@xiaomi.com>
2022-08-04 19:47:15 +08:00
Xiang Xiao
c252ec1481 Add printflike to all printf like functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-18 14:09:10 +03:00
Jiuzhu Dong
b3a5b56ff3 apps/nshlib: fix warning by tool converity report
uninit_use_in_call addr before call netlib_set_ipv4addr at line 780

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-05-07 10:30:47 +08:00
Jiuzhu Dong
234e297cd9 apps/nshlib: fix warning by tools converity report
uninit_use_in_call inaddr.sin_zero before call
netlib_set_arpmapping

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-05-07 10:30:47 +08:00
Petro Karashchenko
566be8c7b1 definitions: unify MAX and MIN macro definitions
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-16 23:20:17 +08:00
Norman Rasmussen
41ce7d40f6 Fix incorrect argument count error message
The `too many arguments` and `missing required argument(s)` messages
should be switched in order for the correct message to be shown to the
user.
2021-12-31 20:54:05 +08:00
Alin Jerpelea
4f3f62c8fc nshlib: update licenses to Apache
Gregory Nutt is has submitted the SGA

Uros Platise has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-11 02:42:05 -05:00
Xiang Xiao
1ee948e0c8 Include assert.h for DEBUGASSERT caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:34:37 +09:00
Subhra Sankha Sarkar
23ec80fa30 Addressed review comments from @v01d and @xiaoxiang781216 2020-10-28 05:57:47 -07:00
YAMAMOTO Takashi
aa0aa73250 nsh_netcmds.c: Adapt to the new webclient api
As a bonus, check and report errors from write().

tested as: "nsh> wget http://example.com/"
2020-10-01 15:32:25 +08:00
Masayuki Ishikawa
bd47c468c5 nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-18 20:00:28 -06:00
Xiang Xiao
8fd8aad5c4 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-13 08:32:42 -06:00
Xiang Xiao
5720d72b71 apps: Fix the nightly build warning
src/cwindowfactory.cxx: In member function 'void Twm4Nx::CWindowFactory::redrawIcons(const nxgl_rect_s*)':
src/cwindowfactory.cxx:461:38: warning: 'iconPos.nxgl_point_s::y' may be used uninitialized in this function [-Wmaybe-uninitialized]
  461 |           iconBounds.pt2.y = iconPos.y + iconSize.h - 1;
      |                              ~~~~~~~~^
src/cwindowfactory.cxx:460:38: warning: 'iconPos.nxgl_point_s::x' may be used uninitialized in this function [-Wmaybe-uninitialized]
  460 |           iconBounds.pt2.x = iconPos.x + iconSize.w - 1;
      |                              ~~~~~~~~^

nsh_netcmds.c:424:20: warning: 'nsh_addrconv' defined but not used [-Wunused-function]
 static inline bool nsh_addrconv(FAR const char *hwstr,
                    ^
nsh_netcmds.c:446:20: warning: 'nsh_sethwaddr' defined but not used [-Wunused-function]
 static inline void nsh_sethwaddr(FAR const char *ifname,
                    ^

nsh_envcmds.c:94:21: warning: 'nsh_getdirpath' defined but not used [-Wunused-function]
 static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
                     ^

In file included from bas.c:84:0:
bas.c: In function 'bas_interpreter':
bas_error.h:110:37: warning: left-hand operand of comma expression has no effect [-Wunused-value]
 #define NOSUCHLINE         STATIC+40, _("No such line")
                                     ^
bas.c:2425:52: note: in expansion of macro 'NOSUCHLINE'
                           FS_putChars(STDCHANNEL, (NOSUCHLINE));
                                                    ^~~~~~~~~~
bas_fs.c:107:22: warning: 'g_vt100_colormap' defined but not used [-Wunused-const-variable=]
 static const uint8_t g_vt100_colormap[8] =
                      ^~~~~~~~~~~~~~~~
<stdout>:4048:16: warning: 'input' defined but not used [-Wunused-function]

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I62610b4c90e67637250cbd0107c2935c8abc542f
2020-04-13 08:32:42 -06:00
Xiang Xiao
b92a10ad74 nshlib/nsh_netcmds.c: fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-03-30 09:43:49 -06:00
Xiang Xiao
8da81578b0 nsh: Call getaddrinfo in cmd_nslookup to support the dual stack host
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iac7a9a6b871d473e4720db1d6cbfeea3dc9796a0
2020-03-30 09:43:49 -06:00
Xiang Xiao
41d88f06e7 Run codespell -w with the latest dictonary again 2020-02-23 07:10:14 -06:00
Xiang Xiao
e0dcfa0c55 Remove extra whitespace from files (#43)
* Remove multiple newlines at the end of file
* Remove the white space from the end of line
2020-01-31 08:29:24 -06:00
Xiang Xiao
857158451b Unify the void cast usage
1.Remove void cast for function because many place ignore the returned value witout cast
2.Replace void cast for variable with UNUSED macro

Change-Id: Ie644129a563244a6397036789c4c3ea83c4e9b09
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-02 23:21:01 +08:00
Gregory Nutt
eca2171ab5 apps/nshlib/nsh_netcmds.c: Fix some alignment in output of 'arp -t' command. 2019-11-03 20:10:56 -06:00
Gregory Nutt
400995dec6 nshlib/nsh_netcmds.c: Add a -t option to the arp command which will enable printing the entire ARP table. 2019-11-03 16:19:14 -06:00
Gregory Nutt
94a0d92b54 This commit removes the private network initialization logic from NSH and puts in a common location at apps/netutils/netinit. Now that netork initialization logic can be used by applications that do not include NSH.
Squashed commit of the following:

    apps/nshlib:  Remove NSH initialization.  Now uses the common apps/netutils/netinit logic (which was cloned from nshlib to begin with).

    apps/netutils/netinit:  Clone network initialization logic from NSH to this directory so that it can be available for general use.
2019-04-29 10:22:56 -06:00
Gregory Nutt
fe41f72a95 Fix typo found in building testing. There will probably be a few more. 2019-02-11 13:25:48 -06:00
Gregory Nutt
9db029e318 The file system can no longer be disabled. Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS==0 2019-02-11 13:10:10 -06:00
GregoryN
3bf4b6d245 Merged altconsole into master 2018-12-08 18:53:54 -06:00
Gregory Nutt
36d6348368 apps/nslib: Try to eliminate and uninitialized variable warning. 2018-06-17 15:37:42 -06:00
Gregory Nutt
467a7980f0 apps/nshlib/: In netcommds.c, the UNUSED() macro may be applied to an undefined symbol when IPv6 is enabled but IPv4 is not. 2018-03-31 09:27:52 -06:00
DL
bf209bcf1d Fixed misprint in cmd_wget 2017-11-01 06:18:40 +03:00
Anthony Merlino
a8bf5718f5 apps/nshlib: ifconfig improvements 2017-10-24 17:26:17 -06:00
Gregory Nutt
749ea9e881 This commit removes the ping6 command from NSH and replaces it with the apps/system/ping6 built-in command. The NSH ping6 command had to be removed because it violated the portable POSIX OS interface. The apps/system/ping6 command uses the sem-standard IPPROTO_ICMP6 socket interface.
Squashed commit of the following:

    apps/system ping and ping6:  Fix a backward test.
    apps/system/ping6: ping6 logic now builds without error.
    apps/system/ping and ping6:  Minor clean-up to configuration settings.
    apps/system/ping6:  Minor clean-up to be able to configure CONFIG_SYSTEM_PING6
    apps/nshlib:  Remove support for ping6 from NSH.
    apps/system/ping6:  Add IPPROTO_ICMPv6 ping6.  Initial commit is simply a clone of the IPPROTO_ICMP ping logic.
    Rename CONFIG_NET_ICMPv6_PING to CONFIG_NET_ICMPv6_SOCKET.
2017-10-24 11:19:41 -06:00
Gregory Nutt
bccf0092a4 nshlib: Remove some dangling IPv4 ping logic. system/ping: Add DNS hostname support. 2017-10-23 09:59:03 -06:00
Gregory Nutt
c1ec7db8a9 This commite eliminates the ping command from NSH and replaces it with a ping 'built-in' at apps/system/ping. The original NSH version of ping violated the portable POSIX interface and, hence, had to be removed. The new system/ping command uses the new IPPROTO_ICMP AF_INET datagram sockets to implement ping.
Squashed commit of the following:

    apps/system/ping:  Fix some timing issues.
    apps/system/ping:  A few timing related corrections.
    apps/nshlib:  Remove support for the NSH 'ping' command.  The implementation of that command violated the portable POSIX interface and has been replaced with a ping 'built-in' command at apps/system/ping.
    apps/system/ping:  Add larger payload.  Verify content of echoed payload.
    apps/system/ping:  Various fixes for a clean compile
    system/ping: Add new build structure for system ping command.
2017-10-23 08:50:01 -06:00
Gregory Nutt
976ce0550c NSH: eliminate a warning 2017-09-27 12:05:19 -06:00
Masayuki Ishikawa
4822878990 nshlib/nsh_netcmds.c: Fix a compilation error when IPv4/IPv6 dual stack is enabled 2017-09-26 11:28:40 +09:00
Bruno Herrera
3fe720d1e2 Fixes for problems found by Coverity in the apps/ repository:
nshlib/nsh_parse.c: Avoid truncating the strcmp result into a unsigned char variable.

    nshlib/nsh_netcmds.c: Check for valid hostip before using it.

    nshlib/nsh_ddcmd.c: Fix resouce leak when 'if=' or 'of=' params are repeated in the command line.  For example:

       dd if=/dev/null if=/dev/zero of=/dev/null or
       dd if=/dev/zero of=/dev/zero of=/dev/null
2017-09-25 07:34:34 -06:00
Gregory Nutt
3b8c97747d netutils/netlib: Fix netlib_nodaddrconv() so that its return type is the same as other address conversion functions. NSH: Correct parsing of ifconfig so that you can specify the HW address without specifying the IP address. 2017-08-02 14:30:34 -06:00
Gregory Nutt
d6050d70a2 NSH library: Extend ifconfig command so that it can set variable length packet radio addresss. 2017-08-02 13:13:19 -06:00
Gregory Nutt
c343fc618e apps/netutils/netlib: Add support for PktRadio IOCTL commands. 2017-08-02 12:40:50 -06:00
Gregory Nutt
7d0037b08a NSH: Misc changes needed for PktRadio support. 2017-07-30 16:03:56 -06:00
Gregory Nutt
7441c5422f Socket I/F: Cleanup for good CONFIG_NET_PKT build. 2017-07-14 13:43:04 -06:00
Gregory Nutt
d81d9c419b Eliminat a warning when both Ethernet and 6LoWPAN are enabled; improve some naming. 2017-07-02 11:28:12 -06:00