coreMQTT Demo (Mutual Authentication) on Windows not work

@daofx123

I have tested your demo config and was able to run the demo. Please find the logs, :

0 0 [None] FreeRTOS_AddEndPoint: MAC: 11-41 IPv4: 10.10.10.200


The following network interfaces are available:

Interface 1 - rpcap://\Device\NPF_{BE1AF62A-A518-484E-9EB7-7BD7095DCCD0}
              (Network adapter 'Microsoft' on local host)

Interface 2 - rpcap://\Device\NPF_{1F8B9C8C-BE0F-4B12-9E17-DFD972793CF6}
              (Network adapter 'Microsoft' on local host)

Interface 3 - rpcap://\Device\NPF_{3EB30C62-3C4C-427F-BB21-AA53A28E68C1}
              (Network adapter 'Microsoft' on local host)

Interface 4 - rpcap://\Device\NPF_{4BC20A74-15F0-49D0-BE6D-DBA3A76247FF}
              (Network adapter 'Oracle' on local host)

Interface 5 - rpcap://\Device\NPF_{44BB3D52-A65F-45DB-83BC-3022AA9B623D}
              (Network adapter 'Microsoft' on local host)

Interface 6 - rpcap://\Device\NPF_{64BAC72F-15DD-42EF-95AD-832FC91E3D6B}
              (Network adapter 'Realtek USB NIC' on local host)

Interface 7 - rpcap://\Device\NPF_{3919812B-DC0E-4F33-B5F0-A501573E1C6A}
              (Network adapter 'TAP-Windows Adapter V9' on local host)


The interface that will be opened is set by "configNETWORK_INTERFACE_TO_USE", which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 6.
Successfully opened interface number 6.
DHCP-socket[11-41]: DHCP Socket Create
1 1201 [IP-Task] prvCreateDHCPSocket[11-41]: open, user count 1
vDHCP_RATimerReload: 250
2 1203 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:570] ---------STARTING DEMO---------

3 1203 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:576] Waiting for the network link up event...
4 1471 [MAC_ISR] Bounced back by WinPCAP interface: 00:11:11:11:11:41
vDHCPProcess: offer 192.168.0.101 for MAC address 11-41
5 1831 [IP-Task] vDHCPProcess: offer 192.168.0.101 for MAC address 11-41


IP Address: 192.168.0.101
6 1831 [IP-Task] Subnet Mask: 255.255.255.0
Gateway Address: 192.168.0.1
7 1831 [IP-Task] DNS Server Address: 192.168.0.1


prvCloseDHCPSocket[11-41]: closed, user count 0
8 1831 [IP-Task] vDHCP_RATimerReload: 21600000
[INFO] [MqttMutualAuth] [prvConnectToServerWithBackoffRetries:741] 9 2203 [DemoTask] Creating a TLS connection to a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com:8883.

10 2231 [IP-Task] ipARP_REPLY from 192.168.0.1 to 192.168.0.101 end-point 192.168.0.101
DNS_ReadReply returns -11
11 7203 [DemoTask] prvIncreaseDNS4Index: from 0 to 0
DNS[0x4B0F]: The answer to 'a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com' (44.239.31.83) will be stored
12 7291 [DemoTask] FreeRTOS_connect: 43565 to 44.239.31.83:8883
[INFO] [SocketsWrapper] [TCP_Sockets_Connect:189] 13 7491 [DemoTask] Established TCP connection with a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com.
14 9011 [DemoTask] [INFO] [MbedtlsTransport] [tlsHandshake:613] (Network connection 0199FE2C) TLS handshake successful.
15 9011 [DemoTask] [INFO] [MbedtlsTransport] [TLS_FreeRTOS_Connect:784] (Network connection 0199FE2C) Connection to a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com established.
16 9011 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:596] Creating an MQTT connection to a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com.

17 9831 [DemoTask] [INFO] [MqttMutualAuth] [prvCreateMQTTConnectionWithBroker:862] An MQTT connection is established with a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com.
18 9831 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTSubscribeWithBackoffRetries:923] Attempt to subscribe to the MQTT topic fish_iot/example/topic.

19 10371 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTSubscribeWithBackoffRetries:930] SUBSCRIBE sent for topic fish_iot/example/topic to broker.


20 10411 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessResponse:1072] Subscribed to the topic fish_iot/example/topic with maximum QoS 1.

21 12411 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:610] Publish to the MQTT topic fish_iot/example/topic.

22 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:616] Attempt to receive publish message from broker.

23 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessResponse:1053] PUBACK received for packet Id 2.

24 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessIncomingPublish:1108] Incoming QoS : 1

25 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessIncomingPublish:1119]
Incoming Publish Topic Name: fish_iot/example/topic matches subscribed topic.
Incoming Publish Message : Hello World!

This is the commit with which I have run the tests.

I have tested with FreeRTOS 202212.01 as well. Though the TCP connection is succeeding, the TLS handshake was failing, hence used the version that has MbedTLS 3.5.1.

This is strange - you are able to reach the AWS IoT Broker from your host but not from the TCP stack. Just to confirm that it is not something IP4 specific, can you run the following -

Test-Connection -targetname <your_broker_endpoint> -tcpport 8883 -Detailed -ipv4

Do you have the Wireshark capture for the TCP demo? Also, does the Wireshark capture for the MQTT demo still the same (i.e. no SYNACK)?

Okay, thank you very much for the help you’ve provided. I will test using the version of FreeRTOS you mentioned.

The Wireshark capture for the MQTT demo is still same.

I have rerun the demo in the version you mentioned, but the same issue persists. I’d like to know if there are any other settings you’ve made, or could it be a problem with the Windows version? I am running this demo on a Windows 11 system without a actual physical device, are there any additional settings that need to be configured?

Sorry, I misunderstood your question. When I run the command, the output is as follow.

 Target: a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com

  Id Source           Address                      Port Latency Connected  Status  
                                                           (ms)
  -- ------           -------                      ---- ------- ---------  ------
   1 FISH             50.112.218.33                8883     182 True       Success

And the TCP demo I don’t know how to set to confirm if my area able to reach any server. Do you have some suggestions?

@daofx123

Im running it on Windows 10. Built the demo on Microsoft Visual Studio Community 2022 (64-bit) - Version 17.9.5.

I am running this demo on a Windows 11 system without a actual physical device, are there any additional settings that need to be configured?

Other than installing winpcap and having a wired internet connection to the PC, no other changes have been made.

Thank you very much, I have resolved this issue. The reason was simply that there were some problems with the network I was connected to; after rerouting through the router, the connection was successful.

@daofx123 Thanks for reporting back.