tests/lwip_sock: Take lock before calling etharp#17145
Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom Nov 6, 2021
Merged
Conversation
miri64
requested changes
Nov 6, 2021
Member
|
(as explanation why I want to keep the tests as is: Dual stack support is not the same |
Member
|
I ran all the for test in tests/lwip_sock_{ip,tcp,udp}/; do
for ipv6 in 0 1; do
for ipv4 in 0 1; do
if [ $((ipv4 + ipv6)) -eq 0 ]; then
continue
fi
LWIP_IPV4=${ipv4} LWIP_IPV6=${ipv6} make -C ${test} flash -j test || break
done
done
doneThey succeeded. I also tested DetailsTerminal 1 (DHCPv4 server)sudo dist/tools/tapsetup/tapsetup
sudo dnsmasq --no-daemon --log-queries --dhcp-range=10.1.194.2,10.1.194.128,1h -i tapbr0Terminal 2 (tap0)$ QUIETER=1 LWIP_IPV4=1 LWIP_IPV6=1 make -C tests/lwip --no-print-directory -j flash term
Building application "tests_lwip" for "native" with MCU "native".
/usr/bin/ld: /home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/cpu/tramp.o: warning: relocation against `_native_saved_eip' in read-only section `.text'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
text data bss dec hex filename
287450 1312 101900 390662 5f606 /home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/tests_lwip.elf
/home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/tests_lwip.elf tap0
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: 2022.01-devel-392-g91be3-HEAD)
RIOT lwip test application
> tcp connect 10.1.194.45:1337
tcp connect 10.1.194.45:1337
> tcp send abcdef1234567890
tcp send abcdef1234567890
Success: send 8 byte over TCP to server
> udp send 10.1.194.45:1337 1234567890abcdef0987654321
udp send 10.1.194.45:1337 1234567890abcdef0987654321
Success: send 13 byte over UDP to 10.1.194.45:1337
> ip send 10.1.194.45 255 601234714567321
ip send 10.1.194.45 255 601234714567321
Success: send 8 byte over IPv4 to 10.1.194.45 (next header: 255)
> ^C
native: exiting
$ QUIETER=1 LWIP_IPV4=1 LWIP_IPV6=0 make -C tests/lwip --no-print-directory -j flash term
Building application "tests_lwip" for "native" with MCU "native".
/usr/bin/ld: /home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/cpu/tramp.o: warning: relocation against `_native_saved_eip' in read-only section `.text'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
text data bss dec hex filename
231035 1228 100396 332659 51373 /home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/tests_lwip.elf
/home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/tests_lwip.elf tap0
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: 2022.01-devel-392-g91be3-HEAD)
RIOT lwip test application
> tcp connect 10.1.194.45:1337
tcp connect 10.1.194.45:1337
> tcp send 0987654321fedcba
tcp send 0987654321fedcba
Success: send 8 byte over TCP to server
> tcp disconnect
tcp disconnect
> udp send 10.1.194.45:1337 0987654321123456790abcdef
udp send 10.1.194.45:1337 0987654321123456790abcdef
Success: send 13 byte over UDP to 10.1.194.45:1337
> ip send 10.1.194.45 255 abcdef0987654321
ip send 10.1.194.45 255 abcdef0987654321
Success: send 8 byte over IPv4 to 10.1.194.45 (next header: 255)
> ^C
native: exiting
Terminal 3 (tap1)$ PORT=tap1 make -C tests/lwip term
make: Entering directory '/home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip'
/home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/tests_lwip.elf tap1
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: 2022.01-devel-392-g91be3-HEAD)
RIOT lwip test application
> ifconfig
ifconfig
Iface ET0 HWaddr: da:27:1d:a8:64:24 Link: up State: up
Link type: wired
inet addr: 10.1.194.45 mask: 255.255.255.0 gw: 10.1.194.1
inet6 addr: fe80:0:0:0:d827:1dff:fea8:6424 scope: link
> tcp server start 1337
tcp server start 1337
Success: started TCP server on port 1337
> udp server start 1337
udp server start 1337
Success: started UDP server on port 1337
> ip server start 255
ip server start 255
Success: started IP server on protocol 255
> TCP client [a01:c24d::]:49153 connected
Received TCP data from client [a01:c24d::]:49153
00000000 AB CD EF 12 34 56 78 90
Received UDP data from [a01:c24d::]:49153
00000000 12 34 56 78 90 AB CD EF 09 87 65 43 21
Received IP data from [10.1.194.77]:
00000000 60 12 34 71 45 67 32 10
^C
native: exiting
$ PORT=tap1 make -C tests/lwip term
make: Entering directory '/home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip'
/home/mlenders/Repositories/RIOT-OS/RIOT/tests/lwip/bin/native/tests_lwip.elf tap1
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: 2022.01-devel-392-g91be3-HEAD)
RIOT lwip test application
> ifconfig
ifconfig
Iface ET0 HWaddr: da:27:1d:a8:64:24 Link: up State: up
Link type: wired
inet addr: 10.1.194.45 mask: 255.255.255.0 gw: 10.1.194.1
> tcp server start 1337
tcp server start 1337
Success: started TCP server on port 1337
> udp server start 1337
udp server start 1337
Success: started UDP server on port 1337
> ip server start 255
ip server start 255
Success: started IP server on protocol 255
> TCP client [10.1.194.77]:49153 connected
Received TCP data from client [10.1.194.77]:49153
00000000 09 87 65 43 21 FE DC BA
TCP connection to [10.1.194.77]:49153 reset
Received UDP data from [10.1.194.77]:49153
00000000 09 87 65 43 21 12 34 56 79 0A BC DE F0
Received IP data from [10.1.194.77]:
00000000 AB CD EF 09 87 65 43 21
^C
native: exiting
They both work! |
miri64
approved these changes
Nov 6, 2021
Contributor
|
Thanks for the quick reaction @yarrick! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Lock lwIP before adding static entry to etharp (fixing assert)
Testing procedure
BOARD=native LWIP_IPV6=0 LWIP_IPV4=1 make -C tests/lwip_sock_ip/ clean flash test -jBOARD=native LWIP_IPV6=0 LWIP_IPV4=1 make -C tests/lwip_sock_udp/ clean flash test -jIssues/PRs references
Fixes #17144