From f5cecd7ca0583464207906317fcde69dfe15ae56 Mon Sep 17 00:00:00 2001 From: Antti Yli-Tokola Date: Tue, 8 Dec 2020 07:49:24 +0200 Subject: [PATCH] Enable external connection for routers This allows routers to connect to external IPv6 addresses. --- source/6LoWPAN/ws/ws_bbr_api.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/6LoWPAN/ws/ws_bbr_api.c b/source/6LoWPAN/ws/ws_bbr_api.c index 7a8681745019..5b1c2883c201 100644 --- a/source/6LoWPAN/ws/ws_bbr_api.c +++ b/source/6LoWPAN/ws/ws_bbr_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,7 +47,7 @@ #include "DHCPv6_client/dhcpv6_client_api.h" #include "libDHCPv6/libDHCPv6_vendordata.h" #include "libNET/src/net_dns_internal.h" - +#include "platform/os_whiteboard.h" #include "ws_bbr_api.h" @@ -450,6 +450,7 @@ static void ws_bbr_dodag_get(uint8_t *local_prefix_ptr, uint8_t *global_prefix_p memcpy(global_prefix_ptr, global_address, 8); return; } + static void wisun_bbr_na_send(int8_t interface_id, const uint8_t target[static 16]) { protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id); @@ -461,6 +462,8 @@ static void wisun_bbr_na_send(int8_t interface_id, const uint8_t target[static 1 return; } + whiteboard_os_modify(target, ADD); + buffer_t *buffer = icmpv6_build_na(cur, false, true, true, target, NULL, ADDR_UNSPECIFIED); protocol_push(buffer); return; @@ -522,6 +525,11 @@ static void ws_bbr_dhcp_server_dns_info_update(protocol_interface_info_entry_t * DHCPv6_server_service_set_vendor_data(cur->id, global_id, ARM_ENTERPRISE_NUMBER, dhcp_vendor_data_ptr, dhcp_vendor_data_len); } +static void wisun_dhcp_address_remove_cb(int8_t interfaceId, uint8_t *targetAddress, void *prefix_info) +{ + whiteboard_os_modify(targetAddress, REMOVE); +} + static void ws_bbr_dhcp_server_start(protocol_interface_info_entry_t *cur, uint8_t *global_id, uint32_t dhcp_address_lifetime) { uint8_t ll[16]; @@ -535,7 +543,7 @@ static void ws_bbr_dhcp_server_start(protocol_interface_info_entry_t *cur, uint8 tr_error("DHCPv6 Server create fail"); return; } - DHCPv6_server_service_callback_set(cur->id, global_id, NULL, wisun_dhcp_address_add_cb); + DHCPv6_server_service_callback_set(cur->id, global_id, wisun_dhcp_address_remove_cb, wisun_dhcp_address_add_cb); //Check for anonymous mode bool anonymous = (configuration & BBR_DHCP_ANONYMOUS) ? true : false;