Skip to content

Commit

Permalink
Enable external connection for routers
Browse files Browse the repository at this point in the history
This allows routers to connect to external IPv6 addresses.
  • Loading branch information
Antti Yli-Tokola authored and Mika Tervonen committed Mar 8, 2021
1 parent e129a0a commit f5cecd7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions 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");
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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;

Expand Down

0 comments on commit f5cecd7

Please sign in to comment.