Skip to content

Commit f179217

Browse files
committed
net: lib: aws_iot: Allow to bind with specific network interface
Allow the aws_iot library to bind with a specific network interface so that the application can control which interface is used for communication in an environment with multiple network interfaces. Signed-off-by: Robert Lubos <[email protected]>
1 parent 8c47474 commit f179217

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

include/net/aws_iot.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ struct aws_iot_config {
272272
* If not set (NULL), CONFIG_AWS_IOT_BROKER_HOST_NAME will be used.
273273
*/
274274
char *host_name;
275+
276+
/** Name of the interface that the AWS library should be bound to.
277+
* Leave as NULL if not specified.
278+
*/
279+
const char *if_name;
275280
};
276281

277282
/** @brief Initialize the library.

subsys/net/lib/aws_iot/src/aws_iot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ int aws_iot_connect(const struct aws_iot_config *const config)
656656
.hostname.size = (config && config->host_name) ? strlen(config->host_name) : 0,
657657
.device_id.ptr = (config && config->client_id) ? config->client_id : NULL,
658658
.device_id.size = (config && config->client_id) ? strlen(config->client_id) : 0,
659+
.if_name = (config && config->if_name) ? config->if_name : NULL,
659660
};
660661

661662
/* Set the hostname to CONFIG_AWS_IOT_BROKER_HOST_NAME if it was not provided

0 commit comments

Comments
 (0)