zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.44k stars 6.4k forks source link

sample mbedtls_sslclient fails to connect to ssl server #3246

Closed zephyrbot closed 7 years ago

zephyrbot commented 7 years ago

Reported by ethan gao:

Try to run sample mbedtls_sslclient on quark_se board with Ethernet enc28j60, start the SSL server via: $ sudo ifconfig eth0 192.168.1.1 $ ./programs/ssl/ssl_server2 psk=000102030405060708090a0b0c0d0e0f

. Seeding the random number generator... ok . Bind on tcp://*:4433/ ... ok . Setting up the SSL/TLS structure... ok . Waiting for a remote connection ...

and then build to flash sample with "make BOARD=arduino_101 flash", but the connection failed from the following serial console output: . Seeding the random number generator... ok . Setting up the SSL/TLS structure... ok . Connecting to tcp 192.168.1.1:4433...Cannot get network context for IPv4 TCP (-45) failed ! tcp_init returned -0xfffffffa

(Imported from Jira ZEP-1798)

zephyrbot commented 7 years ago

by ethan gao:

The host server is listening on target port 4433, as follows: ethan@devlbox:~/Myspace/codebase/mbedtls-2.3.0$ netstat -at Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:mysql : LISTEN
tcp 0 0 :netbios-ssn : LISTEN
tcp 0 0
:4433 : LISTEN
tcp 0 0 192.168.122.1:domain : LISTEN
tcp 0 0 devlbox:domain : LISTEN
tcp 0 0 :ssh : LISTEN
tcp 0 0
:microsoft-ds : LISTEN
tcp 1 0 10.239.12.27:42336 10.240.252.20:911 CLOSE_WAIT tcp 0 0 devlbox:netbios-ssn localhost:57296 ESTABLISHED tcp 12 0 localhost:57296 devlbox:netbios-ssn ESTABLISHED tcp6 0 0 [::]:netbios-ssn [::]: LISTEN
tcp6 0 0 [::]:http [::]:
LISTEN
tcp6 0 0 [::]:ssh [::]: LISTEN
tcp6 0 0 [::]:microsoft-ds [::]:
LISTEN
tcp6 0 0 [::]:12865 [::]:* LISTEN

zephyrbot commented 7 years ago

by Sharron LIU:

Kuo-Lang Tseng , could you have someone look at this? Thanks.

zephyrbot commented 7 years ago

by Kuo-Lang Tseng:

This issue could be related to GH-2659. Added Juan Manuel Cruz Alcaraz to the watcher list.

@Sergio, can you verify on QEMU first?

zephyrbot commented 7 years ago

by Kuo-Lang Tseng:

ethan gao , can you try out Juan Manuel Cruz Alcaraz 's patch from GH-2659 (i.e. https://gerrit.zephyrproject.org/r/#/c/11757/) to see if makes difference or same root cause?

zephyrbot commented 7 years ago

by ethan gao:

Kuo-Lang Tseng I checked out the net branch and enable that patch, unfortunately, the same error persists. :(

zephyrbot commented 7 years ago

by Mark Linkmeyer:

Juan Manuel Cruz Alcaraz and Kuo-Lang Tseng , any update on this bug?

zephyrbot commented 7 years ago

by Juan Manuel Cruz Alcaraz:

Mark Linkmeyer There is a patch cooking for this.

zephyrbot commented 7 years ago

by Mark Linkmeyer:

Juan Manuel Cruz Alcaraz , cool, thanks! I'm just trying to understand where we have medium-priority bugs close to being fixed to drive the bug count down in order to meet SWQRC. Thanks for the quick reply!

zephyrbot commented 7 years ago

by ethan gao:

I had a check with the patch on arduino 101 with v1.7-branch, now the TCP connection is ok, but the SSL handshake still fails, as follows: . Seeding the random number generator... ok . Setting up the SSL/TLS structure... ok . Connecting to tcp 192.0.2.2... ok . Performing the SSL/TLS handshake...net_context_recv failed with code:-60 failed ! mbedtls_ssl_handshake returned -0xfffffff8

BTW. the server cmd ran in host is: ./programs/ssl/ssl_server2 psk=000102030405060708090a0b0c0d0e0f

zephyrbot commented 7 years ago

by ethan gao:

It's moved to fix in 1.8 and I revert its status to "IN PROGRESS".

zephyrbot commented 7 years ago

by Mark Linkmeyer:

Since this bug isn't actively being worked on I'm moving its status back to To Do.

zephyrbot commented 7 years ago

by Mark Linkmeyer:

manoj subbarao , who on your team should own this? It was previously owned by Juan. Please assign it to the correct owner. Thx.

zephyrbot commented 7 years ago

by Jukka Rissanen:

I would say this bug needs to be replicated in frdm-k64f or qemu as arduino 101 is not really a reference platform for IP stack networking issues. Thus I am closing this atm.

zephyrbot commented 7 years ago

Related to GH-2659