weixin_39882589
weixin_39882589
2020-12-28 14:46

Introduce UIP_DS6_NBR_MULTI_IPV6_ADDRS

Summary

This PR enables for more than one IPv6 addresses to be associated with a single link-layer address in the neighbor cache table. By default, this feature is disabled.

Configuration Parameters

  • UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS: set 1 to enable this feature
  • UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES: the maximum number of neighbor caches a mote can have. The default value is the same as NBR_TABLE_MAX_NEIGHBORS

Examples

tests/09-ipv6/11-ping-lla-ula-csma-wo-rpl.csc and tests/09-ipv6/12-ping-lla-ula-tsch-wo-rpl.csc use this feature.

You'll have the following results by ip-nbr shell command with one of the tests:

shell
#0001.0001.0001.0001> Node IPv6 neighbors:
-- fe80::202:2:2:2  0002.0002.0002.0002, router 128, state Reachable
-- fd00::202:2:2:2  0002.0002.0002.0002, router 128, state Reachable

This demonstrates that two IPv6 address, fe80::202:2:2:2 and fd00:202:2:2:2, are associated with the same link-layer address, 0002.0002.0002.0002.

Dependencies

PR #385

This branch will be rebased once PR #385 is merged.

Note

ds6_neighbors is not a global variable any more

The definition of ds6_neighbors has been changed for this work:

diff
diff --git a/os/net/ipv6/uip-ds6-nbr.c b/os/net/ipv6/uip-ds6-nbr.c
index f937986b5..619e9c347 100644
--- a/os/net/ipv6/uip-ds6-nbr.c
+++ b/os/net/ipv6/uip-ds6-nbr.c
@@ -60,7 +60,7 @@
 #define LOG_MODULE "IPv6 Nbr"
 #define LOG_LEVEL LOG_LEVEL_IPV6

-NBR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors);
+NBR_TABLE(uip_ds6_nbr_t, ds6_neighbors);

 /*---------------------------------------------------------------------------*/
 void

Issues

Closes #250.

Original Work

This is a simple and clean version of https://github.com/contiki-os/contiki/pull/2098.

该提问来源于开源项目:contiki-ng/contiki-ng

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

8条回答

  • weixin_39882589 weixin_39882589 4月前

    Thank you for your review.

    I think having two neighbor cache entries per neighbor at most is enough for most cases. That is, one is for a link-local address and the other is for a global scope address. I'll think how to implement that.

    Regarding documents and comments, I totally agree. I'll add texts there.

    点赞 评论 复制链接分享
  • weixin_39590566 weixin_39590566 4月前

    Then having just N per entry instead of a separate memb might be an option :)

    点赞 评论 复制链接分享
  • weixin_39882589 weixin_39882589 4月前

    Yes; I'm trying to find out which is easier to manage used/unused neighbor cache entries, with memb or having static entries per neighbor. Although using memb and linked list seems a primary option to me, I'll think it over.

    点赞 评论 复制链接分享
  • weixin_39590566 weixin_39590566 4月前

    A good thing with static allocation is that it makes it possible to dimension the system. You know at compile time that you can handle X neighbors with N addresses each. But obviously the drawback is that it is more wasteful.

    点赞 评论 复制链接分享
  • weixin_39882589 weixin_39882589 4月前

    I've updated the PR: * rebased * add doxygen comments * limit the number of IPv6 addresses associated with a single link-layer address * add a test (tests/10-ipv6-nbr) for this new feature * address the following comment by

    Wouldn't it make sense to check if there is free space in this memb before doing the nbr_table_add? This would avoid involving the nbr_table pruning to add an entry that will be removed straight away.

    点赞 评论 复制链接分享
  • weixin_39590566 weixin_39590566 4月前

    Oops I had totally forgotten about that PR. It looks awesome. Big thanks for the dull doxygenation of uip-ds6 btw. There is a conflict now -- but this is ready to get in otherwise. Maybe right after 4.2 feature-freeze.

    点赞 评论 复制链接分享
  • weixin_39590566 weixin_39590566 4月前

    could you also rebase this one for immediate merge?

    点赞 评论 复制链接分享
  • weixin_39882589 weixin_39882589 4月前

    Yes. Rebased this.

    点赞 评论 复制链接分享

相关推荐