Loopback device will consume the d_iob packet in upper layer protocol,
in order to avoid null pointer access, reprepare iob buffer before polling connections
Signed-off-by: chao an <anchao@xiaomi.com>
ubsan/ubsan.c: In function ‘get_signed_val’:
ubsan/ubsan.c:162:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
162 | uint64_t ret = (uint64_t)val & mask;
|
Signed-off-by: chao an <anchao@xiaomi.com>
In file included from sim/sim_netdriver.c:73:
sim/sim_netdriver.c: In function ‘netdriver_ifup’:
sim/sim_netdriver.c:284:32: error: ‘struct net_driver_s’ has no member named ‘d_ipaddr’; did you mean ‘d_ipv6addr’?
284 | sim_netdev_ifup(devidx, dev->d_ipaddr);
| ^~~~~~~~
sim/sim_internal.h:279:67: note: in definition of macro ‘sim_netdev_ifup’
279 | # define sim_netdev_ifup(idx,ifaddr) sim_tapdev_ifup(idx,ifaddr)
|
Signed-off-by: chao an <anchao@xiaomi.com>
l3/l4 stack will decouple the reference of d_buf gradually, Only legacy
devices still retain d_buf support, new net devices will use d_iob
Signed-off-by: chao an <anchao@xiaomi.com>
"The number of characters written if successful or negative value if an error occurred.
If the resulting string gets truncated due to buf_size limit, function returns the total
number of characters (not including the terminating null-byte) which would have been written,
if the limit was not imposed." --- https://en.cppreference.com/w/c/io/vfprintf
Signed-off-by: jihandong <jihandong@xiaomi.com>
In some cases, deleting a folder will return unexpected results. For example, ENOENT should be returned when deleting a non-existent folder, but the result will return ENOTDIR.
Fix icmpv6_reply logic broken by commit 48311cc61f and 391b501639.
- 48311cc61f "Fix unaligned memory access when creating ICMP Port Unreachable messages"
- It removed `htonl` function outside `data`, then the byte order may be wrong, so add `htons` back.
- 391b501639 "net: extract l3 header build code into new functions"
- It mis-removed the `memmove`, and the icmpv6 has no payload copied after this commit.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Set IPv4 flag before processing ipforward, otherwise the ICMP packet responded by ipforward may sometimes be regarded as IPv6.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
The following changes omit the arm version:
| commit d321080351
| Author: chao an <anchao@xiaomi.com>
| Date: Fri Dec 2 02:52:18 2022 +0800
|
| arm/cortex-[a|r]: generating assemble code in ARM states by default
|
| Signed-off-by: chao an <anchao@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
* enable DLFCN.
* bump WAMR to a version which i happened to test.
* enable bulk-memory because it's required by recent versions of
wasi-sdk, which i happened to use to build a test module.
(test.wasm in the log below.)
Lightly tested with a stripped down version of WAMR native-lib example. [1]
```
nsh> mount -t littlefs /dev/esp32flash /mnt
nsh> iwasm --native-lib=/mnt/test_add.o /mnt/test.wasm
Hello World!
10 + 20 = 30
nsh> iwasm /mnt/test.wasm
[00:00:23:000 - 6]: warning: failed to link import function (env, test_add)
Hello World!
Exception: failed to call unlinked import function (env, test_add)
nsh>
```
[1] https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/samples/native-lib
1. rpmsgdev ioctl: should assgin back the client return value to
cookie->result, then this return value can be returned to the
application;
2. rpmsgdev seek: the type "off_t" may be 64bit, so modify the offset
in "struct rpmsgdev_lseek" to int64_t too;
3. rpmsgdev_seek: the rpmsgdev_seek in client should update the
filep->f_pos after the seek operation;
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Fix build break on thumb2 mode:
opus/celt/arm/celt_pitch_xcorr_arm-gnu.S: Assembler messages:
opus/celt/arm/celt_pitch_xcorr_arm-gnu.S:146: Error: thumb conditional instruction should be in IT block -- `movle pc,lr'
Reference:
https://developer.arm.com/documentation/100067/0612/armclang-Command-line-Options/-mimplicit-it
In A32 code, the integrated assembler accepts all conditional instructions
without giving an error or warning. In T32 code, the integrated assembler
outputs an implicit IT block when there is a conditional instruction
without an enclosing IT block. The integrated assembler does not give an
error or warning about this.
Signed-off-by: chao an <anchao@xiaomi.com>
The option '-mthumb' is only valid for C source files and it is not passed to the assembler.
If 'thumb' is not considered in some assembly projects, the system will generate
'undefined instructions' when running incompatible instruction:
arm_undefinedinsn: Undefined instruction at 0x380cfc98
This assembly file should be compiled with .thumb but it doesn't:
380cfc90 <hobot_i8_i32_gemm_nn_m4_n8_neon>:
380cfc90: e92d4ff0 push {r4, r5, r6, r7, r8, r9, sl, fp, lr}
380cfc94: ed2d8b10 vpush {d8-d15}
380cfc98: e59d4064 ldr r4, [sp, #100] ; 0x64 <-- Undefined instruction
380cfc9c: e59d5068 ldr r5, [sp, #104] ; 0x68
380cfca0: e59d606c ldr r6, [sp, #108] ; 0x6c
380cfca4: e59d7070 ldr r7, [sp, #112] ; 0x70
380cfca8: e1a08120 lsr r8, r0, #2
380cfcac: e1a091a1 lsr r9, r1, #3
380cfcb0: e1a0a122 lsr sl, r2, #2
After enable thumb:
.syntax unified
.thumb
or
-Wa,-mthumb
.Lhobot_i8_i32_gemm_nn_m4_n8_neon:
38001100: e92d 4ff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
38001104: ed2d 8b10 vpush {d8-d15}
38001108: 9c19 ldr r4, [sp, #100] ; 0x64
3800110a: 9d1a ldr r5, [sp, #104] ; 0x68
3800110c: 9e1b ldr r6, [sp, #108] ; 0x6c
3800110e: 9f1c ldr r7, [sp, #112] ; 0x70
38001110: ea4f 0890 mov.w r8, r0, lsr #2
38001114: ea4f 09d1 mov.w r9, r1, lsr #3
38001118: ea4f 0a92 mov.w sl, r2, lsr #2
This commit will enable the thumb option of the assembly file by default,
so that when compiling the assembly file, the machine code and the system will be in a consistent state.
----------------------------------------------------------------
https://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/ARM-Options.html
GCC Manual:
-mthumb
Generate code for the Thumb instruction set. The default is to use the 32-bit ARM
instruction set. This option automatically enables either 16-bit Thumb-1 or mixed 16/32-bit
Thumb-2 instructions based on the -mcpu=name and -march=name options.
** This option is not passed to the assembler. **
** If you want to force assembler files to be interpreted as Thumb code,
either add a `.thumb' directive to the source or pass the -mthumb option
directly to the assembler by prefixing it with -Wa. **
Signed-off-by: chao an <anchao@xiaomi.com>
* disable too verbose wamr options.
* enable CONFIG_SCHED_WAITPID. because async execution on nsh prompt
sometimes confuses me.
* enable toywasm. it's sometimes convenient to have another interpreter.
note: wasm3 in nuttx apps doesn't have wasi enabled.
Split out ipv4_nat_in/outbound_internal which returns entry instead of error code, for later ICMP error types, does not change any current logic.
Reason: Outer packet doesn't have information of port, so we need to find entry by inner packet, and apply the entry to outer packet.
| Outer Packet: SRC = Peer IP<No Port>, DST = External IP<No Port> |
| Inner Packet: SRC = External IP:Port, DST = Peer IP:Port |
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is for later ICMP error types processing, and does not change any current logic.
Reason for supporting both side of modification is that an inbound ICMP Error MSG may carry original packet like this:
| IP HDR: SRC = Peer IP, DST = External IP |
| ICMP HDR: ERROR MSG |
| <Origin> IP HDR: SRC = External IP, DST = Peer IP |
| <Origin> L4 HDR: SRC = External Port, DST = Peer Port |
So we need to support inbound translation (External -> Local) on SRC or DST of each header.
And so do the outbound direction.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
devif_loopback needs to be applied on l2 data, and was broken by commit below, now fix it.
| commit 8850dee746
| Author: chao an <anchao@xiaomi.com>
| Date: Sun Nov 27 03:31:07 2022 +0800
|
| net/devif: move preprocess of txpoll into common code
|
| Signed-off-by: chao an <anchao@xiaomi.com>
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Summary:
- I noticed that the nsh prompt can not be shown when disabling
debug features. Actually, the prompt will be shown when a user
input happens.
- This commit fixes this issue by adding uart_xmitchars() as
other serial drivers do.
Impact:
- None
Testing:
- Tested with qemu-armv8a:netnsh on QEMU-7.1
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>