From 70447c3e35426be19fb1885aaa85e645f2ee144d Mon Sep 17 00:00:00 2001 From: Tero Heinonen Date: Wed, 17 Aug 2016 14:30:36 +0300 Subject: [PATCH] Set link layer security when opening socket. (#30) --- source/coap_connection_handler.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/coap_connection_handler.c b/source/coap_connection_handler.c index 4bbe7d08564..96baa165ea9 100644 --- a/source/coap_connection_handler.c +++ b/source/coap_connection_handler.c @@ -226,6 +226,11 @@ static internal_socket_t *int_socket_create(uint16_t listen_port, bool use_ephem ns_dyn_mem_free(this); return NULL; } + + socket_setsockopt(this->listen_socket, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, &(const int8_t) { + bypassSec ? 0 : 1 + }, sizeof(int8_t)); + // XXX API for this? May want to get clever to do recommended first query = 1 hop, retries = whole PAN socket_setsockopt(this->listen_socket, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_MULTICAST_HOPS, &(const int16_t) { 16