amazon-freertos icon indicating copy to clipboard operation
amazon-freertos copied to clipboard

[BUG] ALPN implementation issue

Open vvelciu opened this issue 3 years ago • 1 comments

Describe the bug SOCKETS_SetSockOpt with SOCKETS_SO_ALPN_PROTOCOLS option expects ALPN protocols to be provided as an array of char pointers. However, this is misused in the transport_secure_sockets.c file in the tlsSetup() implementation: image Also, the mqtt_demo_mutual_auth, greengrass_discovery, ota demos configure the pAlpnProtos field as NULL (AWS_IOT_MQTT_ALPN and AWS_IOT_MQTT_ALPN_LENGTH macros are defined but left unused) and it would be nice to be properly set when the MQTT broker port is configured as 443.

System information

  • Project/Demo: mqtt_demo_mutual_auth

Expected behavior Proper usage of SOCKETS_SetSockOpt, e.g.: image

Screenshots or console output The result of using pAlpnProtos similar to mqtt_demo_helpers.c implementation: image

Steps to reproduce bug

  1. mqtt_demo_mutual_auth demo with port 443 configured as MQTT broker port
  2. Update prvConnectToServerWithBackoffRetries in mqtt_demo_mutual_auth.c file to configure pAlpnProtos (similar to mqtt_demo_helpers.c implementation): image

vvelciu avatar Jul 27 '22 09:07 vvelciu

Hi @vvelciu

Thanks for catching this. Certainly a bug. I'd think SocketsConfig_t needs a change so that it has a char ** ppcAlpnProtos instead -- with corresponding demo changes. I'm preparing a PR for the matter.

dachalco avatar Jul 28 '22 21:07 dachalco