Refactor netlib_check_ipconnectivity() to use gateway/router ping instead
of DNS server ping for network connectivity checks. Add IPv6 support.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Update the column ruler and field labels in route_ipv6_entry comment
to match the actual output: lowercase to uppercase, remove colons.
Consistent with Nuttx definition
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Align with the upstream nuttx change that drops the sclock_t alias now
that clock_t is itself a signed 64-bit type (int64_t). Beyond the pure
sclock_t -> clock_t rename, this commit also removes the
now-unnecessary (time_t)-1 / (time_t)0 / (off_t)-1 casts that were
papering over the previously-unsigned time_t.
Files touched:
- examples/alarm/alarm_main.c: sclock_t -> clock_t
- netutils/dhcpd/dhcpd.c: sclock_t -> clock_t
- netutils/ftpd/ftpd.c: sclock_t -> clock_t
- netutils/thttpd/libhttpd.c,
netutils/thttpd/tdate_parse.c: drop (time_t)-1 / (time_t)0 /
(off_t)-1 sentinel casts
- system/resmonitor/filldisk.c,
system/zmodem/zm_receive.c: sclock_t -> clock_t
- testing/ostest/wdog.c: sclock_t -> clock_t (the bulk
of the rename, 30 sites)
- testing/testsuites/kernel/syscall/cases/{clock_nanosleep_test,
fsync_test,time_test}.c: drop (time_t)-1 casts in the
new signed-time_t world
No behavioural change.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
NuttX always uses a 64-bit system clock now (time_t/clock_t are
always 64-bit). Remove the obsolete CONFIG_SYSTEM_TIME64 #ifdef
branches and Kconfig dependency.
- examples/dronecan: drop SYSTEM_TIME64 dependency
- examples/netlink_route: always use PRIx64
- netutils/netinit: always use the 1-hour LONG_TIME_SEC
- netutils/ptpd: always pack the 48-bit seconds field and apply
the 64-bit overflow guard in timespec_delta_ns()
- testing/ostest/semtimed: always validate tv_sec >= 0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
The matching nuttx commit removes CONFIG_HAVE_LONG_LONG; clean up the
remaining users in nuttx-apps so that "long long" is always assumed:
- examples/noteprintf, examples/nxscope:
unconditionally exercise the %lld / long long branch.
- fsutils/mkfatfs/configfat.c:
drop the 32-bit fall-back paths in mkfatfs_nfatsect12/16/32;
always use uint64_t for the FAT-size arithmetic.
- logging/nxscope/nxscope_chan.c:
drop the CONFIG_HAVE_LONG_LONG guard around the 64-bit
sample helpers.
- netutils/ftpd, netutils/ntpclient:
always emit the 64-bit format strings.
- testing/fs/fstest/fstest_main.c:
drop the parallel 32-bit verification path; keep only the
64-bit (long long) random pattern generator.
- system/zmodem/host/nuttx/compiler.h:
remove the host-side CONFIG_HAVE_LONG_LONG stub macro.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Use the DHCP-learned NTP server list as the default ntpc server source when DHCP option 42 is available.
Fall back to CONFIG_NETUTILS_NTPCLIENT_SERVER only when DHCP does not provide any NTP servers, and restart ntpc when the DHCP-provided server list changes.
Signed-off-by: Jerry Ma <masc2008@gmail.com>
Request DHCP option 42 and store the returned IPv4 NTP server
addresses in struct dhcpc_state for later consumers.
Signed-off-by: Jerry Ma <masc2008@gmail.com>
Replace app-side includes of <debug.h> with <nuttx/debug.h> to use the
header from the NuttX tree explicitly after the header move.
Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
Fix mismatch on apps directory naming when it is cloned under 'nuttx-apps' instead of 'apps'.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
Modified CMakeLists.txt, Kconfig, and Makefile to change the cJSON download URL to include 'refs/tags/' for proper version fetching. This ensures compatibility with GitHub's archive download requirements.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Modified the CMakeLists.txt and Makefile to ensure the correct format for downloading the cJSON tarball from GitHub by including 'refs/tags/' in the URL. This change addresses issues with fetching the correct version of the library.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
removes redundant type casts in ARP-related network library functions.
The casts from req.arp_dev (already a char array) to (FAR char *)
are unnecessary and can be safely removed.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
When using AF_RPMSG (-r option), rexecd was setting the rp_name
to the raw port number, while rexec was using htons(port). This
caused a mismatch where rexec couldn't connect to rexecd.
This commit fixes the issue by applying htons() to REXECD_PORT
when setting rp_name in the AF_RPMSG case, making it consistent
with the rexec client implementation.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Fix cast from pointer to integer of different size to ensure
proper type conversion and avoid compilation warnings.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Add missing header files in netutils and lsan modules to fix
implicit function declarations and improve compilation compatibility.
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
BARE is a simple binary representation for structured application data.
cbare, the BARE implementation ported by this commit, is an I/O agnostic
C implementation of the BARE message encoding.
Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
NNG depends on options that, if not enabled, makes compilation or
runtime crashes. Noting these options in help helps to find out which
are such options.
Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
standardize the implementation of ping6 to better comply with socket
permissions on certain systems.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
tests only supports tests in non-encrypted mode. when we open tests
compilation in other modes, there will be many compilation warning
with mismatched parameter types, and it will not run correctly.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
In some scenarios, dynamic memory allocation is not allowed, so it is modified to a static allocation method.
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
Improve the behavior of the ARP table so that the manually configured
ARP table has the highest priority, can only be manually modified to
other values, otherwise will never change again, and will not time out.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
The ping socket creation method is changed from SOCK_DGRAM to SOCK_RAW,
because SOCK_DGRAM may not have permission in some environments (e.g. Docker).
Also add checksum calculation when send, and perform IP header processing when receive.
Signed-off-by: daichuan <daichuan@xiaomi.com>
Fix dependency issue when signals are partially or fully enabled
Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Add netlib_check_httpconnectivity() to verify HTTP service connectivity by sending GET request and validating status code.
Signed-off-by: meijian <meijian@xiaomi.com>
Fix a issue of vlan pcp config.
`vconfig add eth0 10` will create eth0.10 with VID=10 and no PCP(0)
`vconfig add eth0 10 3` will create eth0.10 with VID=10 and PCP=3
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
Fix various coding style issues including:
- Case statement formatting
- Include placement and ordering
- Whitespace issues
- Long line formatting
- Bracket alignment
Affected modules:
- audioutils, examples, include
- netutils, system
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Before attempting to sample via NTP, network connectivity should be checked to avoid frequent sampling that could cause network error logs to overflow.
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
We add devname in ping_info_s, but not initializeed, cause
data abort as value in stack possible not NULL.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
We possible want to use iperf to test rpmsg socket etc.
Fix error when enable iperf and no IPv4
```
arm-none-eabi-ld: warning: ~/nuttx/nuttx has a LOAD segment with RWX permissions
arm-none-eabi-ld: ~/nuttx/staging/libapps.a(iperf_main.c.~.apps.netutils.iperf_1.o): in function `iperf_main':
~/apps/netutils/iperf/iperf_main.c:248:(.text.iperf_main+0x330): undefined reference to `inet_ntoa_r'
arm-none-eabi-ld: ~/apps/netutils/iperf/iperf_main.c:240:(.text.iperf_main+0x354): undefined reference to `netlib_get_ipv4addr'
arm-none-eabi-ld: ~/nuttx/staging/libapps.a(iperf.c.~.apps.netutils.iperf_1.o): in function `iperf_print_addr':
~/apps/netutils/iperf/iperf.c:226:(.text.iperf_print_addr+0x3c): undefined reference to `inet_ntoa'
```
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
The system checks connectivity with the input IP address; if no IP address is provided, it defaults to checking DNS server connectivity.
Signed-off-by: meijian <meijian@xiaomi.com>
The previous method of terminating the dhcp daemon via a global variable has been removed; instead, the `kill pid` command is used. Also, because the original `dhcp_start` method creates tasks via `task_create`, which is not supported in kernel mode, `dhcp_start` is not compiled in kernel mode. The daemon can be started in kernel mode using `dhcpd xxx &`.
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
The current gPTP stack does not support path delay correction of the Switch.
This patch adds the path delay correction field in the Header.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
fix compile warning when only enable PTPD_CLIENT or PTPD_SERVER
ptpd.c:493:38: error: 'CONFIG_NETUTILS_PTPD_PRIORITY1' undeclared (first
use in this function); did you mean 'CONFIG_NETUTILS_PTPD_CLIENT'?
ptpd.c:494:39: error: 'CONFIG_NETUTILS_PTPD_CLASS' undeclared (first use
in this function); did you mean 'CONFIG_NETUTILS_PTPD_CLIENT'?
ptpd.c:495:39: error: 'CONFIG_NETUTILS_PTPD_ACCURACY' undeclared (first
use in this function); did you mean 'CONFIG_NETUTILS_PTPD_DEBUG'?
ptpd.c:498:38: error: 'CONFIG_NETUTILS_PTPD_PRIORITY2' undeclared (first
use in this function); did you mean 'CONFIG_NETUTILS_PTPD_CLIENT'?
ptpd.c:502:36: error: 'CONFIG_NETUTILS_PTPD_CLOCKSOURCE' undeclared
(first use in this function); did you mean
'CONFIG_NETUTILS_PTPD_STACKSIZE'?
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
The original implementation only checked if each field was less than,
but didn't check for greater than before proceeding to the next field.
This caused incorrect clock selection behavior in the PTP Best Master
Clock Algorithm (BMCA).
The fix expands each comparison to explicitly check both < and >
conditions, returning the appropriate result immediately. This ensures
proper precedence evaluation according to IEEE 1588 specification:
- gm_priority1
- gm_quality (class, accuracy, variance)
- gm_priority2
- gm_identity
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>