Skip to content

Commit 16c57f6

Browse files
M1chanashif
authored andcommitted
samples: mqtt_sn_publisher: fix adding predefined gateway
Apparently, the code was copied from where the broadcast IP is parsed and not adjusted correctly. Both the log message and the source of the IP address were wrong. Signed-off-by: Michael Zimmermann <[email protected]>
1 parent 013ca06 commit 16c57f6

File tree

1 file changed

+3
-3
lines changed
  • samples/net/mqtt_sn_publisher/src

1 file changed

+3
-3
lines changed

samples/net/mqtt_sn_publisher/src/udp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ static void process_thread(void)
149149
LOG_INF("Adding predefined Gateway");
150150
struct sockaddr_in gwaddr = {0};
151151

152-
LOG_DBG("Parsing Broadcast IP %s", SAMPLE_GW_IP);
152+
LOG_DBG("Parsing Gateway IP %s", SAMPLE_GW_IP);
153153
gwaddr.sin_family = AF_INET;
154154
gwaddr.sin_port = htons(CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_PORT);
155155
err = zsock_inet_pton(AF_INET, SAMPLE_GW_IP, &gwaddr.sin_addr);
156156
__ASSERT(err == 1, "inet_pton() failed %d", err);
157-
struct mqtt_sn_data gwaddr_data = {.data = (uint8_t *)&bcaddr,
158-
.size = sizeof(struct sockaddr)};
157+
struct mqtt_sn_data gwaddr_data = {.data = (uint8_t *)&gwaddr,
158+
.size = sizeof(gwaddr)};
159159

160160
err = mqtt_sn_add_gw(&mqtt_client, 0x1f, gwaddr_data);
161161
__ASSERT(err == 0, "mqtt_sn_add_gw() failed %d", err);

0 commit comments

Comments
 (0)