chiark / gitweb /
sd-dhcp-client: improve BPF
[elogind.git] / src / libsystemd-network / test-dhcp-client.c
index ca44cfbdc52b0269665b97226117dfdc7b5cf265..4420436f8a1d2048c9520d0159882b7d4b9c1abb 100644 (file)
@@ -190,7 +190,7 @@ int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link,
         return 575;
 }
 
-int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link)
+int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link, uint32_t id)
 {
         if (socketpair(AF_UNIX, SOCK_STREAM, 0, test_fd) < 0)
                 return -errno;
@@ -253,8 +253,7 @@ static void test_discover_message(sd_event *e)
         sd_dhcp_client_stop(client);
         sd_dhcp_client_free(client);
 
-        close(test_fd[0]);
-        close(test_fd[1]);
+        test_fd[1] = safe_close(test_fd[1]);
 
         callback_recv = NULL;
 }
@@ -467,9 +466,10 @@ static void test_addr_acq(sd_event *e)
 
         callback_recv = test_addr_acq_recv_discover;
 
-        assert_se(sd_event_add_monotonic(e, &test_hangcheck,
-                                         time_now + 2 * USEC_PER_SEC, 0,
-                                         test_dhcp_hangcheck, NULL) >= 0);
+        assert_se(sd_event_add_time(e, &test_hangcheck,
+                                    CLOCK_MONOTONIC,
+                                    time_now + 2 * USEC_PER_SEC, 0,
+                                    test_dhcp_hangcheck, NULL) >= 0);
 
         res = sd_dhcp_client_start(client);
         assert_se(res == 0 || res == -EINPROGRESS);
@@ -482,8 +482,7 @@ static void test_addr_acq(sd_event *e)
         sd_dhcp_client_stop(client);
         sd_dhcp_client_free(client);
 
-        close(test_fd[0]);
-        close(test_fd[1]);
+        test_fd[1] = safe_close(test_fd[1]);
 
         callback_recv = NULL;
         xid = 0;