chiark / gitweb /
sd-dhcp6-lease: Add helper function to compute remaining expiry time
[elogind.git] / src / libsystemd-network / test-dhcp-client.c
index e7787fa0f110a622bfdc014df9c4d32813259c42..450b6d4d3c9bfc199b4297e5d768574009ee7cd6 100644 (file)
@@ -79,7 +79,9 @@ static void test_request_basic(sd_event *e)
 
         assert_se(sd_dhcp_client_set_index(client, 15) == 0);
         assert_se(sd_dhcp_client_set_index(client, -42) == -EINVAL);
-        assert_se(sd_dhcp_client_set_index(client, -1) == 0);
+        assert_se(sd_dhcp_client_set_index(client, -1) == -EINVAL);
+        assert_se(sd_dhcp_client_set_index(client, 0) == -EINVAL);
+        assert_se(sd_dhcp_client_set_index(client, 1) == 0);
 
         assert_se(sd_dhcp_client_set_request_option(client,
                                         DHCP_OPTION_SUBNET_MASK) == -EEXIST);
@@ -126,7 +128,7 @@ static void test_checksum(void)
         if (verbose)
                 printf("* %s\n", __FUNCTION__);
 
-        assert_se(dhcp_packet_checksum(&buf, 20) == be16toh(0x78ae));
+        assert_se(dhcp_packet_checksum((uint8_t*)&buf, 20) == be16toh(0x78ae));
 }
 
 static int check_options(uint8_t code, uint8_t len, const uint8_t *option,
@@ -173,13 +175,13 @@ int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link,
         discover->ip.ttl = 0;
         discover->ip.check = discover->udp.len;
 
-        udp_check = ~dhcp_packet_checksum(&discover->ip.ttl, len - 8);
+        udp_check = ~dhcp_packet_checksum((uint8_t*)&discover->ip.ttl, len - 8);
         assert_se(udp_check == 0xffff);
 
         discover->ip.ttl = IPDEFTTL;
         discover->ip.check = ip_check;
 
-        ip_check = ~dhcp_packet_checksum(&discover->ip, sizeof(discover->ip));
+        ip_check = ~dhcp_packet_checksum((uint8_t*)&discover->ip, sizeof(discover->ip));
         assert_se(ip_check == 0xffff);
 
         assert_se(discover->dhcp.xid);
@@ -202,7 +204,7 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link, uint32_t
         return test_fd[0];
 }
 
-int dhcp_network_bind_udp_socket(int index, be32_t address, uint16_t port)
+int dhcp_network_bind_udp_socket(be32_t address, uint16_t port)
 {
         return 0;
 }