Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6/nc: doc fix and unittest for unmanaged nc entries #4721

Merged
merged 2 commits into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions sys/include/net/gnrc/ipv6/nc.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ extern "C" {
#define GNRC_IPV6_NC_IS_ROUTER (0x08) /**< The neighbor is a router */

#define GNRC_IPV6_NC_TYPE_MASK (0x30) /**< Mask for neighbor cache state */
#define GNRC_IPV6_NC_TYPE_POS (4) /**< Shift of neighbor cache state */

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused code. Or is that also intended as a reminder? (:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay… probably legacy code from the beginning of the API. Can be removed indeed.

/**
* @{
Expand Down Expand Up @@ -232,7 +231,7 @@ gnrc_ipv6_nc_t *gnrc_ipv6_nc_get_next(gnrc_ipv6_nc_t *prev);
gnrc_ipv6_nc_t *gnrc_ipv6_nc_get_next_router(gnrc_ipv6_nc_t *prev);

/**
* @brief Returns the state of a neigbor cache entry.
* @brief Returns the state of a neighbor cache entry.
*
* @param[in] entry A neighbor cache entry
*
Expand All @@ -244,7 +243,7 @@ static inline uint8_t gnrc_ipv6_nc_get_state(const gnrc_ipv6_nc_t *entry)
}

/**
* @brief Returns the type of a neigbor cache entry.
* @brief Returns the type of a neighbor cache entry.
*
* @param[in] entry A neighbor cache entry
*
Expand Down
13 changes: 13 additions & 0 deletions tests/unittests/tests-ipv6_nc/tests-ipv6_nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,18 @@ static void test_ipv6_nc_is_reachable__reachable(void)
TEST_ASSERT(gnrc_ipv6_nc_is_reachable(entry));
}

static void test_ipv6_nc_is_reachable__unmanaged(void)
{
ipv6_addr_t addr = DEFAULT_TEST_IPV6_ADDR;
gnrc_ipv6_nc_t *entry = NULL;

test_ipv6_nc_add__success(); /* adds DEFAULT_TEST_IPV6_ADDR to DEFAULT_TEST_NETIF */

TEST_ASSERT_NOT_NULL((entry = gnrc_ipv6_nc_get(DEFAULT_TEST_NETIF, &addr)));
entry->flags = (GNRC_IPV6_NC_STATE_UNMANAGED << GNRC_IPV6_NC_STATE_POS);
TEST_ASSERT(gnrc_ipv6_nc_is_reachable(entry));
}

static void test_ipv6_nc_still_reachable__incomplete(void)
{
ipv6_addr_t addr = DEFAULT_TEST_IPV6_ADDR;
Expand Down Expand Up @@ -449,6 +461,7 @@ Test *tests_ipv6_nc_tests(void)
new_TestFixture(test_ipv6_nc_get_next_router__second_entry),
new_TestFixture(test_ipv6_nc_is_reachable__incomplete),
new_TestFixture(test_ipv6_nc_is_reachable__reachable),
new_TestFixture(test_ipv6_nc_is_reachable__unmanaged),
new_TestFixture(test_ipv6_nc_still_reachable__incomplete),
new_TestFixture(test_ipv6_nc_still_reachable__success),
new_TestFixture(test_ipv6_nc_get_l2_addr__NULL_entry),
Expand Down