diff --git a/radvd-endianess.patch b/radvd-endianess.patch index 9893eea..b159b06 100644 --- a/radvd-endianess.patch +++ b/radvd-endianess.patch @@ -1,17 +1,3 @@ -From 05f06df832f1a9da671d431c19191c47ec48e722 Mon Sep 17 00:00:00 2001 -From: Sergei Trofimovich -Date: Fri, 17 Nov 2017 23:40:20 +0000 -Subject: [PATCH] nd_opt_6co: use uint8_t as a bitfield to be - endianness-agnostic - -Bug: https://github.com/reubenhwk/radvd/issues/77 -Signed-off-by: Sergei Trofimovich ---- - radvd.h | 4 +--- - send.c | 4 ++-- - test/send.c | 3 +-- - 3 files changed, 4 insertions(+), 7 deletions(-) - diff --git a/radvd.h b/radvd.h index 89a5b9e..f520f24 100644 --- a/radvd.h @@ -28,22 +14,37 @@ index 89a5b9e..f520f24 100644 uint16_t nd_opt_6co_valid_lifetime; struct in6_addr nd_opt_6co_con_prefix; diff --git a/send.c b/send.c -index 8bc16a8..d44f85c 100644 +index 8bc16a8..0a4951a 100644 --- a/send.c +++ b/send.c -@@ -619,8 +619,8 @@ static void add_ra_option_lowpanco(struct safe_buffer *sb, struct AdvLowpanCo co +@@ -619,9 +619,9 @@ static void add_ra_option_lowpanco(struct safe_buffer *sb, struct AdvLowpanCo co co.nd_opt_6co_type = ND_OPT_6CO; co.nd_opt_6co_len = 3; co.nd_opt_6co_context_len = lowpanco->ContextLength; - co.nd_opt_6co_c = lowpanco->ContextCompressionFlag; - co.nd_opt_6co_cid = lowpanco->AdvContextID; +- co.nd_opt_6co_valid_lifetime = lowpanco->AdvLifeTime; + co.nd_opt_6co_res_c_cid = ((lowpanco->ContextCompressionFlag ? 1 : 0) << 4) + | (lowpanco->AdvContextID & 0x0F); - co.nd_opt_6co_valid_lifetime = lowpanco->AdvLifeTime; ++ co.nd_opt_6co_valid_lifetime = htons(lowpanco->AdvLifeTime); co.nd_opt_6co_con_prefix = lowpanco->AdvContextPrefix; + safe_buffer_append(sb, &co, sizeof(co)); +@@ -635,9 +635,9 @@ static void add_ra_option_abro(struct safe_buffer *sb, struct AdvAbro const *abr + + abro.nd_opt_abro_type = ND_OPT_ABRO; + abro.nd_opt_abro_len = 3; +- abro.nd_opt_abro_ver_low = abroo->Version[1]; +- abro.nd_opt_abro_ver_high = abroo->Version[0]; +- abro.nd_opt_abro_valid_lifetime = abroo->ValidLifeTime; ++ abro.nd_opt_abro_ver_low = htons(abroo->Version[1]); ++ abro.nd_opt_abro_ver_high = htons(abroo->Version[0]); ++ abro.nd_opt_abro_valid_lifetime = htons(abroo->ValidLifeTime); + abro.nd_opt_abro_6lbr_address = abroo->LBRaddress; + + safe_buffer_append(sb, &abro, sizeof(abro)); diff --git a/test/send.c b/test/send.c -index 92fe45b..4124986 100644 +index 92fe45b..b194449 100644 --- a/test/send.c +++ b/test/send.c @@ -309,10 +309,9 @@ START_TEST(test_add_ra_option_lowpanco) @@ -51,27 +52,14 @@ index 92fe45b..4124986 100644 #else unsigned char expected[] = { - 0x22, 0x03, 0x32, 0x48, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, -+ 0x22, 0x03, 0x32, 0x14, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, ++ 0x22, 0x03, 0x32, 0x14, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - ck_assert_int_eq(sb.used, sizeof(expected)); ck_assert_int_eq(0, memcmp(expected, sb.buffer, sizeof(expected))); #endif -diff --git a/test/send.c b/test/send.c -index 4124986..b194449 100644 ---- a/test/send.c -+++ b/test/send.c -@@ -309,7 +309,7 @@ START_TEST(test_add_ra_option_lowpanco) - ck_assert_msg(0, "\n%s", &buf); - #else - unsigned char expected[] = { -- 0x22, 0x03, 0x32, 0x14, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, -+ 0x22, 0x03, 0x32, 0x14, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; - ck_assert_int_eq(sb.used, sizeof(expected)); -@@ -333,7 +333,7 @@ START_TEST(test_add_ra_option_abro) +@@ -334,7 +333,7 @@ START_TEST(test_add_ra_option_abro) ck_assert_msg(0, "\n%s", &buf); #else unsigned char expected[] = { diff --git a/radvd.spec b/radvd.spec index d3edb08..33d5cf3 100644 --- a/radvd.spec +++ b/radvd.spec @@ -1,7 +1,7 @@ Summary: A Router Advertisement daemon Name: radvd Version: 2.17 -Release: 13%{?dist} +Release: 14%{?dist} # The code includes the advertising clause, so it's GPL-incompatible License: BSD with advertising Group: System Environment/Daemons @@ -73,8 +73,7 @@ install -p -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/radvd.conf install -m 644 %{SOURCE2} %{buildroot}%{_unitdir} %check -## Tests still don't work on little endian -##make check +make check %postun %systemd_postun_with_restart radvd.service @@ -105,9 +104,10 @@ exit 0 %{_sbindir}/radvdump %changelog -* Wed Jun 13 2018 Pavel Zhukov - 2.17-13 +* Wed Jun 13 2018 Pavel Zhukov - 2.17-14 - Log to stderr in non-daemon mode - Add nodaemon option into manpage +- Re-enable test again * Mon Jun 04 2018 Pavel Zhukov - 2.17-12 - Enable tests and fix them on big endian arches