[systemd-devel] [PATCH 06/11] test-icmp6-rs: Add trivial test case for a MTU that is not present

Patrik Flykt patrik.flykt at linux.intel.com
Tue Jan 13 04:02:16 PST 2015


---
 src/libsystemd-network/test-icmp6-rs.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/libsystemd-network/test-icmp6-rs.c b/src/libsystemd-network/test-icmp6-rs.c
index be64d33..8a42a34 100644
--- a/src/libsystemd-network/test-icmp6-rs.c
+++ b/src/libsystemd-network/test-icmp6-rs.c
@@ -30,7 +30,7 @@ static struct ether_addr mac_addr = {
         .ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}
 };
 
-static bool verbose = false;
+static bool verbose = true;
 static sd_event_source *test_hangcheck;
 static int test_fd[2];
 
@@ -93,6 +93,8 @@ static void test_rs_done(sd_icmp6_nd *nd, int event, void *userdata) {
                 { ND_RA_FLAG_OTHER, ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER },
                 { ND_RA_FLAG_MANAGED, ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED }
         };
+        uint32_t mtu;
+
         assert_se(nd);
 
         assert_se(event == flag_event[idx].event);
@@ -101,10 +103,14 @@ static void test_rs_done(sd_icmp6_nd *nd, int event, void *userdata) {
         if (verbose)
                 printf("  got event %d\n", event);
 
-        if (idx < 3)
+        if (idx < 3) {
                 send_ra(flag_event[idx].flag);
-        else
-                sd_event_exit(e, 0);
+                return;
+        }
+
+        assert_se(sd_icmp6_ra_get_mtu(nd, &mtu) == -ENOMSG);
+
+        sd_event_exit(e, 0);
 }
 
 static void test_rs(sd_event *e) {
-- 
2.1.4



More information about the systemd-devel mailing list