diff options
author | Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> | 2022-12-02 12:18:12 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-12-05 12:47:17 -0500 |
commit | 789a2c7d37ed81e369a570afd939fcd8f7729d31 (patch) | |
tree | ad0072f4d11a0e7b7a86ae3b57171c75b420c497 /test | |
parent | 8576dcdf0036be116a3424505984a9b2de7c9bf8 (diff) | |
download | u-boot-789a2c7d37ed81e369a570afd939fcd8f7729d31.zip u-boot-789a2c7d37ed81e369a570afd939fcd8f7729d31.tar.gz u-boot-789a2c7d37ed81e369a570afd939fcd8f7729d31.tar.bz2 |
test: dm: eth: Add ip6_make_snma test
Add a test that checks generated Solicited Node Multicast Address from our
ipv6 address. Use in sandbox
Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/eth.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c index 4c50258..a3ee231 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -129,6 +129,26 @@ static int dm_test_ip6_addr_in_subnet(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ip6_addr_in_subnet, 0); + +static int dm_test_ip6_make_snma(struct unit_test_state *uts) +{ + struct in6_addr mult = {0}; + struct in6_addr correct_addr = { + .s6_addr32[0] = 0x000002ff, + .s6_addr32[1] = 0x00000000, + .s6_addr32[2] = 0x01000000, + .s6_addr32[3] = 0xe8f66dff}; + struct in6_addr addr = { .s6_addr32[0] = 0x000080fe, + .s6_addr32[1] = 0x00000000, + .s6_addr32[2] = 0xffe9f242, + .s6_addr32[3] = 0xe8f66dfe}; + + ip6_make_snma(&mult, &addr); + ut_asserteq_mem(&mult, &correct_addr, sizeof(struct in6_addr)); + + return 0; +} +DM_TEST(dm_test_ip6_make_snma, 0); #endif static int dm_test_eth(struct unit_test_state *uts) |