diff options
author | Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> | 2022-09-08 14:59:04 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-11-28 09:54:43 -0500 |
commit | bb097fc43b85c49dd504c7b31917beb936bd0864 (patch) | |
tree | 25d5f2606cfc9746faa22060d34eb512189efce2 | |
parent | ab2e007a645c37272b87667afb10b371c00e0b5d (diff) | |
download | u-boot-bb097fc43b85c49dd504c7b31917beb936bd0864.zip u-boot-bb097fc43b85c49dd504c7b31917beb936bd0864.tar.gz u-boot-bb097fc43b85c49dd504c7b31917beb936bd0864.tar.bz2 |
test: dm: eth: Add ip6_make_lladdr test
Add a test that checks generated Link Local Address. Use in sandbox
Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | test/dm/eth.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c index 81528ed..fc4caf8 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -150,6 +150,24 @@ static int dm_test_ip6_make_snma(struct unit_test_state *uts) } DM_TEST(dm_test_ip6_make_snma, 0); +static int dm_test_ip6_make_lladdr(struct unit_test_state *uts) +{ + struct in6_addr generated_lladdr = {0}; + struct in6_addr correct_lladdr = { + .s6_addr32[0] = 0x000080fe, + .s6_addr32[1] = 0x00000000, + .s6_addr32[2] = 0xffabf33a, + .s6_addr32[3] = 0xfbb352fe}; + const unsigned char mac[6] = {0x38, 0xf3, 0xab, 0x52, 0xb3, 0xfb}; + + ip6_make_lladdr(&generated_lladdr, mac); + ut_asserteq_mem(&generated_lladdr, &correct_lladdr, + sizeof(struct in6_addr)); + + return 0; +} +DM_TEST(dm_test_ip6_make_lladdr, UT_TESTF_SCAN_FDT); + static int dm_test_eth(struct unit_test_state *uts) { net_ping_ip = string_to_ip("1.1.2.2"); |