eziya / STM32F4_HAL_ETH_MQTT_CLIENT_MBEDTLS

STM32F4 + MQTT + mbedTLS testing
8 stars 2 forks source link

Hostname resolving #1

Open 44simon opened 2 years ago

44simon commented 2 years ago

안녕하세요, 동료 친구에게 인사드립니다!

I have tried to adapt your code to my project on f407vet, I have got past the certificate parsing, but it's stuck in the function:

err = netconn_gethostbyname_addrtype(nodename, &addr, type);

  cberr = tcpip_send_msg_wait_sem(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg), API_EXPR_REF(API_VAR_REF(msg).sem));
#if !LWIP_NETCONN_SEM_PER_THREAD
  sys_sem_free(API_EXPR_REF(API_VAR_REF(msg).sem));

could you please help me? Have you ever faced similar issue?

My broker is on 192.168.1.2:`

define SERVER_NAME "192.168.1.2"`

친애하는, Simon

eziya commented 2 years ago

안녕하세요, 동료 친구에게 인사드립니다!

I have tried to adapt your code to my project on f407vet, I have got past the certificate parsing, but it's stuck in the function:

err = netconn_gethostbyname_addrtype(nodename, &addr, type);

  cberr = tcpip_send_msg_wait_sem(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg), API_EXPR_REF(API_VAR_REF(msg).sem));
#if !LWIP_NETCONN_SEM_PER_THREAD
  sys_sem_free(API_EXPR_REF(API_VAR_REF(msg).sem));

could you please help me? Have you ever faced similar issue?

My broker is on 192.168.1.2:#define SERVER_NAME "192.168.1.2"

친애하는, Simon

Hello Simon, It looks like DNS problem. check DNS initialization first. and in my experience, my example doesn't work without compiler optimization option.

Best regards, Jihoon

44simon commented 2 years ago

Hello Jihoon, thanks for the reply. Interesting that in my case, this was heap memory allocation issue... I've fixed this somehow, but now I'm getting this output in the mosquitto broker:

1636821322: OpenSSL Error[0]: error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher
1636821322: Client <unknown> disconnected: protocol error.

I have tried both my OpenSSL generated keys and yours from the example.

Somehow it's failing the handshake, although I'm able to connect to Broker with MQTT Explorer for example.

Best regards, Simon

EDIT: Maybe it's the issue with the server name on the certificate, because on creating it there was a name provided, here I'm using the IP address. UPDATE: I have remade the certificate with the common name of "192.168.1.2", but the outcome is still the same.