Skip to content

Commit

Permalink
tests: net: ipv6: Drop pkt for org scope mcast addresses
Browse files Browse the repository at this point in the history
Test that we drop the received packet if the destination
address is organisation scope (ff08::) multicast address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information
jukkar committed Nov 2, 2018
1 parent 4b7d8fb commit 0a3b5f2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/net/ipv6/src/main.c
Expand Up @@ -1327,6 +1327,19 @@ static void test_dst_site_scope_mcast_recv_ok(void)
net_context_put(ctx);
}

static void test_dst_org_scope_mcast_recv(void)
{
struct in6_addr mcast_org = { { { 0xff, 0x08, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 } } };
struct in6_addr addr = { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x1 } } };
enum net_verdict verdict;

verdict = recv_msg(&addr, &mcast_org);
zassert_equal(verdict, NET_DROP,
"Organisation scope multicast packet was not dropped");
}

void test_main(void)
{
ztest_test_suite(test_ipv6_fn,
Expand All @@ -1353,7 +1366,8 @@ void test_main(void)
ztest_unit_test(test_dst_iface_scope_mcast_recv),
ztest_unit_test(test_dst_zero_scope_mcast_recv),
ztest_unit_test(test_dst_site_scope_mcast_recv_drop),
ztest_unit_test(test_dst_site_scope_mcast_recv_ok)
ztest_unit_test(test_dst_site_scope_mcast_recv_ok),
ztest_unit_test(test_dst_org_scope_mcast_recv)
);
ztest_run_test_suite(test_ipv6_fn);
}

0 comments on commit 0a3b5f2

Please sign in to comment.