tests: net: rpl: Fix unicast NS sending
If we send unicast NS, then the destination IPv6 address needs to be in the neighbor cache, otherwise we have a NS sending loop. Change-Id: I11e8f5d5740248024a0becc77055786cd2e32199 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
6b069f1589
commit
3c95a56c2a
1 changed files with 17 additions and 1 deletions
|
@ -428,9 +428,25 @@ static bool test_dao_sending_fail(void)
|
||||||
|
|
||||||
static bool net_test_send_ns(void)
|
static bool net_test_send_ns(void)
|
||||||
{
|
{
|
||||||
|
struct net_if *iface = net_if_get_default();
|
||||||
|
struct net_nbr *nbr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = net_ipv6_send_ns(net_if_get_default(),
|
/* As we are sending a node reachability NS (RFC 4861 ch 4.3),
|
||||||
|
* we need to add the neighbor to the cache, otherwise we cannot
|
||||||
|
* send a NS with unicast destination address.
|
||||||
|
*/
|
||||||
|
nbr = net_ipv6_nbr_add(iface,
|
||||||
|
&in6addr_my,
|
||||||
|
&iface->link_addr,
|
||||||
|
false,
|
||||||
|
NET_NBR_REACHABLE);
|
||||||
|
if (!nbr) {
|
||||||
|
TC_ERROR("Cannot add to neighbor cache\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = net_ipv6_send_ns(iface,
|
||||||
NULL,
|
NULL,
|
||||||
&peer_addr,
|
&peer_addr,
|
||||||
&in6addr_my,
|
&in6addr_my,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue