Petro Karashchenko
1b0baa8337
nuttx: use lib_free for memory de-allocation after strdup or asprintf
...
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Xiang Xiao
c6d210289f
procfs: remove procfs_ from procfs_operations variables
...
to aglin the naming style with other implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
149cafe450
procfs: Add g_ prefix to all procfs_operations
...
to conform the coding style
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
chao an
3a0fdb019d
nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
chao an
98724477e7
net/procfs: fix runtime error AddressSanitizer(global-buffer-overflow)
...
NuttShell (NSH) NuttX-10.3.0
ap> ifconfig
=================================================================
Program received signal SIGSEGV, Segmentation fault.
==3920365==ERROR: AddressSanitizer: global-buffer-overflow on address 0x57fb4f2a at pc 0x57177067 bp 0xf1ffebb8 sp 0xf1ffeba8
READ of size 1 at 0x57fb4f2a thread T0
...................
| #10 0xf7ac4339 in __asan::__asan_report_load1 (addr=1476087594) at ../../../../../src/libsanitizer/asan/asan_rtl.cpp:117
| #11 0x57177067 in strncmp (cs=0x57fb4f2a "", ct=0x582d36e0 "stat", nb=4) at string/lib_strncmp.c:40
| #12 0x57f3b467 in netprocfs_opendir (relpath=0x57fb4f26 "net", dir=0xf1ffed80) at procfs/net_procfs.c:398
| #13 0x572b3ae1 in procfs_opendir (mountpt=0xf4602c20, relpath=0x57fb4f26 "net", dir=0xf1ffed80) at procfs/fs_procfs.c:625
| #14 0x572879ff in open_mountpoint (inode=0xf4602c20, relpath=0x57fb4f26 "net", dir=0xf1ffed80) at vfs/fs_dir.c:127
...................
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-27 09:41:55 +08:00
chao an
f286012c0d
net/procfs: disable tcp/udp proc node if no stack available
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-19 15:45:19 +08:00
chao an
d10cd8d585
net/procfs: add udp profs support
...
add proc node /proc/net/udp to show the active udp connections from procfs
nuttx style:
server> cat /proc/net/udp
UDP sl local_address remote_address flg txsz rxsz (IPv4)
1: 0.0.0.0: 5285 192.168.31.22: 7779 9 0 1041
2: 0.0.0.0: 5286 192.168.31.22: 7779 9 0 1041
3: 0.0.0.0: 5287 192.168.31.22: 7779 9 0 1041
linux kernel:
https://www.kernel.org/doc/Documentation/networking/proc_net_tcp.txt
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-09 19:33:46 +08:00
chao an
7190e56a14
net/procfs: add tcp profs support
...
add proc node /proc/net/tcp to show the active tcp connections from procfs
nuttx style:
server> cat /proc/net/tcp
TCP sl st flg ref tmr uack nrt rxsz local_address remote_address
1: 04 61 1 12 0 0 1024 0.0.0.0:4855 192.168.31.22:5001
2: 04 61 1 12 0 0 1024 0.0.0.0:4856 192.168.31.22:5001
3: 04 61 1 9 0 0 0 :::4853 fe80::b27b:25ff:fe28:4011:8789
4: 04 61 1 3 3 0 0 :::4854 fe80::b27b:25ff:fe28:4011:8789
linux kernel:
https://www.kernel.org/doc/Documentation/networking/proc_net_tcp.txt
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-09 19:33:46 +08:00
chao an
b6e76966b9
net/procfs: interface index should begin from 1
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-08 18:09:43 +09:00
chao an
4068b2eccc
net/procfs: add entry mapping table
...
add entry mapping table to simplify new component registration
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-08 09:03:34 +08:00
Huang Qi
e4e3208180
Replace all strncpy with strlcpy for safety
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-25 13:38:36 +08:00
Jiuzhu Dong
fe17f747a7
fs/directory: move private directory information to filesystem
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong
90db4daca9
fs/directory: update readdir interface for all filesystem
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Xiang Xiao
a262eebe34
libc: Rename match to fnmatch
...
specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/fnmatch.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 08:23:35 -03:00
Alin Jerpelea
37d5c1b0d9
net: Author Gregory Nutt: update licenses to Apache
...
Gregory Nutt has submitted the SGA and we can migrate the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-20 00:38:18 -08:00
chao.an
dbd6e9be16
net/procfs: handle opendir("/proc/net/") correctly
...
Change-Id: I092bade082ba673b30257add4f869ac5bfa55ca6
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-03 05:56:35 -06:00
Xiang Xiao
2d7f58d165
net/procfs: Support chdir("/proc/net/") correctly
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I47295019c6054c869545e33258ad3460896e851a
2020-08-03 21:00:18 +01:00
Xiang Xiao
9dff16e0e4
fix nxstyle warning
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ieaf325c899d1c349d64dfa15bddcc32afd1fce42
2020-07-10 21:30:02 +01:00
Xiang Xiao
cde88cabcc
Run codespell -w with the latest dictonary again
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Gregory Nutt
3b275fcf4e
net/: Run nxstyle against all C files.
2019-10-25 11:31:42 -06:00
Gregory Nutt
f58e7976df
net/procfs: Add support to provide MLD stats at /proc/net/mld. net/mld: Fix a couple more bugs found in further MLD testing.
2018-11-06 10:42:53 -06:00
Gregory Nutt
88130a996a
net/: Fixes for more coding standard issues detected by nxstyle.
2018-10-29 18:00:30 -06:00
Gregory Nutt
e2c442cdcb
net/procfs: Fix a design REVISIT from the integration the IFINDEX logic and the existing ifconfig/procfs logic.
2018-06-25 17:42:56 -06:00
Gregory Nutt
c439b93627
net/procfs and netdev: Fix some problems with ifconfig introduced with last changes. Also picks up one of Sebastien's changes that did not make it it before. net/udp: Fixes a DEBUGASSERT.
2018-06-25 17:06:11 -06:00
Gregory Nutt
7c1394d814
Squashed commit of the following:
...
net/netdev: Add implementation of if_nametoindex() and if indextoname().
net/pkt: Raw AF_PACKET sockets now depend on CONFIG_NETDEV_IFINDEX.
net/procfs: Tweak to handle traversal of interfaces if CONFIG_NETDEV_IFINDEX is not defined.
net/netdev.h: Update netdev_findbyaddr() to use the assigned device index.
Trivial typo fix
net/netdev: Add support for assigned an interface index to a device when it is regisgtered.
2018-06-25 12:08:10 -06:00
Gregory Nutt
65698da12d
procfs: Add support for routing tables.
2017-08-11 15:33:58 -06:00
Gregory Nutt
a1469a3e95
Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()
2016-06-11 15:50:49 -06:00
Gregory Nutt
fc3540cffe
Replace all occurrences of vdbg with vinfo
2016-06-11 11:59:51 -06:00
Gregory Nutt
eb8668b0f7
net/: Add procfs support for network device status
2015-11-27 16:39:14 -06:00
Gregory Nutt
9d8462aa23
net/: Move net_procfs.c to net/procfs/. Partition logic a little better to make space to support net device procfs as well
2015-11-27 13:53:33 -06:00