Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 26dd252

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Removed almost duplicate mle entry discover for ll64
1 parent 7a0aaa5 commit 26dd252

File tree

7 files changed

+1
-83
lines changed

7 files changed

+1
-83
lines changed

source/MLE/mle.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ bool mle_class_get_entry_index(int8_t interface_id, addrtype_t addr_type, const
409409
return true;
410410
}
411411

412-
413412
mle_neigh_table_entry_t *mle_class_get_entry_by_ll64(int8_t interface_id, const uint8_t *ipv6Address, bool allocateNew, bool *new_entry_allocated)
414413
{
415414

@@ -430,26 +429,6 @@ mle_neigh_table_entry_t *mle_class_get_entry_by_ll64(int8_t interface_id, const
430429
return mle_class_get_entry_by_mac64(interface_id, temporary_mac64, allocateNew, new_entry_allocated);
431430
}
432431

433-
mle_neigh_table_entry_t *mle_class_discover_entry_by_ll64(int8_t interface_id, const uint8_t *ipv6Address)
434-
{
435-
436-
// Check it really is LL64 (not LL16)
437-
438-
if (memcmp(ipv6Address, ADDR_LINK_LOCAL_PREFIX , 8) != 0) {
439-
return NULL; //Mot Link Local Address
440-
}
441-
442-
if (memcmp((ipv6Address + 8), ADDR_SHORT_ADR_SUFFIC , 6) == 0) {
443-
return NULL;
444-
}
445-
// map
446-
uint8_t temporary_mac64[8];
447-
memcpy(temporary_mac64, (ipv6Address + 8), 8);
448-
temporary_mac64[0] ^= 2;
449-
450-
return mle_class_get_by_link_address(interface_id, temporary_mac64, ADDR_802_15_4_LONG);
451-
}
452-
453432

454433
mle_neigh_table_entry_t *mle_class_get_entry_by_mac64(int8_t interface_id, const uint8_t *mac64, bool allocateNew, bool *new_entry_allocated)
455434
{

source/MLE/mle.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ bool mle_class_get_entry_index(int8_t interface_id, addrtype_t addr_type, const
201201

202202
mle_neigh_table_entry_t *mle_class_get_entry_by_ll64(int8_t interface_id, const uint8_t *ipv6Address, bool allocateNew, bool *new_entry_allocated);
203203

204-
mle_neigh_table_entry_t *mle_class_discover_entry_by_ll64(int8_t interface_id, const uint8_t *ipv6Address);
205-
206204
mle_neigh_table_entry_t *mle_class_get_entry_by_mac64(int8_t interface_id, const uint8_t *mac64, bool allocateNew, bool *new_entry_allocated);
207205

208206
mle_neigh_table_entry_t *mle_class_get_by_link_address(int8_t interface_id, const uint8_t *address, addrtype_t type);

source/Service_Libs/mle_service/mle_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ static int mle_service_build_packet_send(service_instance_t *srv_ptr, mle_securi
657657

658658
static mle_neighbor_security_counter_info_t *mle_service_get_neighbour_info(int8_t interface_id, uint8_t *ll64)
659659
{
660-
mle_neigh_table_entry_t *neighbour = mle_class_discover_entry_by_ll64(interface_id,ll64);
660+
mle_neigh_table_entry_t *neighbour = mle_class_get_entry_by_ll64(interface_id,ll64, false, NULL);
661661
if (!neighbour) {
662662
return NULL;
663663
}

test/nanostack/unittest/mle/mle/mle_test.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ TEST(mle, test_mle_class_get_entry_by_ll64)
5252
CHECK(test_mle_class_get_entry_by_ll64());
5353
}
5454

55-
TEST(mle, test_mle_class_discover_entry_by_ll64)
56-
{
57-
CHECK(test_mle_class_discover_entry_by_ll64());
58-
}
59-
60-
61-
6255
TEST(mle, test_mle_class_get_by_link_address)
6356
{
6457
CHECK(test_mle_class_get_by_link_address());

test/nanostack/unittest/mle/mle/test_mle.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -313,52 +313,6 @@ bool test_mle_class_get_entry_by_ll64()
313313
return true;
314314
}
315315

316-
bool test_mle_class_discover_entry_by_ll64()
317-
{
318-
uint8_t ll64[16];
319-
memset(ll64, 0, 16);
320-
mle_neigh_table_entry_t *mle_entry;
321-
mle_entry = mle_class_discover_entry_by_ll64(0,ll64);
322-
if (mle_entry) {
323-
return false;
324-
}
325-
memset(ll64, 0, 16);
326-
ll64[0] = 0xfe;
327-
ll64[1] = 0x80;
328-
memcpy(&ll64[8], ADDR_SHORT_ADR_SUFFIC, 6);
329-
mle_entry = mle_class_discover_entry_by_ll64(0,ll64);
330-
if (mle_entry) {
331-
return false;
332-
}
333-
memset(&ll64[8], 0, 6);
334-
ll64[8] = 0x02;
335-
mle_entry = mle_class_discover_entry_by_ll64(0,ll64);
336-
if (mle_entry) {
337-
return false;
338-
}
339-
event_stub.int8_value = 0;
340-
nsdynmemlib_stub.returnCounter = 2;
341-
mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active);
342-
343-
mle_entry = mle_class_discover_entry_by_ll64(0,ll64);
344-
if (mle_entry) {
345-
return false;
346-
}
347-
//add address
348-
mle_entry = mle_class_get_entry_by_ll64(0,ll64 ,true, NULL);
349-
350-
uint8_t test_tribute = mle_entry->attribute_index;
351-
mle_entry = mle_class_discover_entry_by_ll64(0,ll64);
352-
if (!mle_entry || test_tribute != mle_entry->attribute_index) {
353-
return false;
354-
}
355-
356-
mle_class_deallocate(0);
357-
return true;
358-
}
359-
360-
361-
362316
bool test_mle_class_get_by_link_address()
363317
{
364318
uint8_t mac64[8];

test/nanostack/unittest/mle/mle/test_mle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ bool test_mle_class_mode_set();
3030
bool test_mle_class_list_clean();
3131

3232
bool test_mle_class_get_entry_by_ll64();
33-
bool test_mle_class_discover_entry_by_ll64();
3433
bool test_mle_class_get_by_link_address();
3534
bool test_mle_class_get_by_device_attribute_id();
3635
bool test_mle_class_remove_entry();

test/nanostack/unittest/stub/mle_stub.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,6 @@ bool mle_class_exists_for_interface(int8_t interface_id)
353353
return mle_stub.bool_value;
354354
}
355355

356-
mle_neigh_table_entry_t *mle_class_discover_entry_by_ll64(int8_t interface_id, const uint8_t *ipv6Address)
357-
{
358-
return NULL;
359-
}
360-
361356
int16_t mle_class_sleepy_entry_count_get(int8_t interface_id)
362357
{
363358
return 0;

0 commit comments

Comments
 (0)