test-dhcp-client.c revision 8fc8e3ab98104db40f5674984dd3edb54e62267f
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering This file is part of systemd.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Copyright (C) 2013 Intel Corporation. All rights reserved.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is free software; you can redistribute it and/or modify it
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering under the terms of the GNU Lesser General Public License as published by
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering (at your option) any later version.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is distributed in the hope that it will be useful, but
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Lesser General Public License for more details.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering You should have received a copy of the GNU Lesser General Public License
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering .ether_addr_octet = {'A', 'B', 'C', '1', '2', '3'}
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringtypedef int (*test_callback_recv_t)(size_t size, DHCPMessage *dhcp);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic bool verbose = false;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic test_callback_recv_t callback_recv;
d3e84ddb885e9d5f0ae9930eb905910e3a81f157Lennart Poetteringstatic int test_dhcp_hangcheck(sd_event_source *s, uint64_t usec,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_not_reached("Test case should have completed in 2 seconds");
a658cafa98ab55ea948c29bc87eb3945d515fb41Lennart Poetteringstatic void test_request_basic(sd_event *e)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering r = sd_dhcp_client_attach_event(client, e, 0);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(NULL, 0) == -EINVAL);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_address(NULL, NULL) == -EINVAL);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_index(NULL, 0) == -EINVAL);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_index(client, 15) == 0);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(sd_dhcp_client_set_index(client, -42) == -EINVAL);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(sd_dhcp_client_set_index(client, -1) == 0);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client, 33) == 0);
b87633c4b20e3221748d6c98336cf6c85123cd66Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client, 33) == -EEXIST);
b87633c4b20e3221748d6c98336cf6c85123cd66Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client, 44) == 0);
b87633c4b20e3221748d6c98336cf6c85123cd66Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client, 33) == -EEXIST);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic void test_checksum(void)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x45, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x40, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(dhcp_packet_checksum(&buf, 20) == be16toh(0x78ae));
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic int check_options(uint8_t code, uint8_t len, const uint8_t *option,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dhcp_network_send_raw_socket(int s, const union sockaddr_union *link,
19befb2d5fc087f96e40ddc432b2cc9385666209Lennart Poettering assert_se(discover->ip.protocol == IPPROTO_UDP);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(discover->ip.saddr == INADDR_ANY);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(discover->ip.daddr == INADDR_BROADCAST);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(discover->udp.source == be16toh(DHCP_PORT_CLIENT));
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(discover->udp.dest == be16toh(DHCP_PORT_SERVER));
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering udp_check = ~dhcp_packet_checksum(&discover->ip.ttl, len - 8);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering ip_check = ~dhcp_packet_checksum(&discover->ip, sizeof(discover->ip));
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size = len - sizeof(struct iphdr) - sizeof(struct udphdr);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringint dhcp_network_bind_raw_socket(int index, union sockaddr_union *link)
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering if (socketpair(AF_UNIX, SOCK_STREAM, 0, test_fd) < 0)
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringint dhcp_network_bind_udp_socket(int index, be32_t address, uint16_t port)
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringint dhcp_network_send_udp_socket(int s, be32_t address, uint16_t port,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic int test_discover_message_verify(size_t size, struct DHCPMessage *dhcp)
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering res = dhcp_option_parse(dhcp, size, check_options, NULL);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering printf(" recv DHCP Discover 0x%08x\n", be32toh(dhcp->xid));
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringstatic void test_discover_message(sd_event *e)
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering r = sd_dhcp_client_attach_event(client, e, 0);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_set_index(client, 42) >= 0);
5bb658a1784a0fd4f0f32adb4b1fb636ff503f7dKay Sievers assert_se(sd_dhcp_client_set_mac(client, &mac_addr) >= 0);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(sd_dhcp_client_set_request_option(client, 248) >= 0);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering callback_recv = test_discover_message_verify;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering assert_se(res == 0 || res == -EINPROGRESS);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x45, 0x10, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x80, 0x11, 0xb3, 0x84, 0xc0, 0xa8, 0x02, 0x01,
a658cafa98ab55ea948c29bc87eb3945d515fb41Lennart Poettering 0xc0, 0xa8, 0x02, 0xbf, 0x00, 0x43, 0x00, 0x44,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x01, 0x34, 0x00, 0x00, 0x02, 0x01, 0x06, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x6f, 0x95, 0x2f, 0x30, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x02, 0xbf,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0xc0, 0xa8, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x63, 0x82, 0x53, 0x63, 0x35, 0x01, 0x02, 0x36,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x04, 0xc0, 0xa8, 0x02, 0x01, 0x33, 0x04, 0x00,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x00, 0x02, 0x58, 0x01, 0x04, 0xff, 0xff, 0xff,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x2a, 0x04, 0xc0, 0xa8, 0x02, 0x01, 0x0f,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x09, 0x6c, 0x61, 0x62, 0x2e, 0x69, 0x6e, 0x74,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x72, 0x61, 0x03, 0x04, 0xc0, 0xa8, 0x02, 0x01,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x45, 0x10, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x80, 0x11, 0xb3, 0x84, 0xc0, 0xa8, 0x02, 0x01,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0xc0, 0xa8, 0x02, 0xbf, 0x00, 0x43, 0x00, 0x44,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x01, 0x34, 0x00, 0x00, 0x02, 0x01, 0x06, 0x00,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x02, 0xbf,
d9e34bfda3d34dcde00a876cb052e7de0655e1cbLennart Poettering 0xc0, 0xa8, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x63, 0x82, 0x53, 0x63, 0x35, 0x01, 0x05, 0x36,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x04, 0xc0, 0xa8, 0x02, 0x01, 0x33, 0x04, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x02, 0x58, 0x01, 0x04, 0xff, 0xff, 0xff,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x2a, 0x04, 0xc0, 0xa8, 0x02, 0x01, 0x0f,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x09, 0x6c, 0x61, 0x62, 0x2e, 0x69, 0x6e, 0x74,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x72, 0x61, 0x03, 0x04, 0xc0, 0xa8, 0x02, 0x01,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic void test_addr_acq_acquired(sd_dhcp_client *client, int event,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(event == DHCP_EVENT_IP_ACQUIRE);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_client_get_lease(client, &lease) >= 0);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_lease_get_address(lease, &addr) >= 0);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(memcmp(&addr.s_addr, &test_addr_acq_ack[44],
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(sd_dhcp_lease_get_netmask(lease, &addr) >= 0);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering assert_se(memcmp(&addr.s_addr, &test_addr_acq_ack[285],
if (verbose)
sd_event_exit(e, 0);
int res;
if (verbose)
sizeof(test_addr_acq_ack));
if (verbose)
int res;
if (verbose)
sizeof(test_addr_acq_offer));
if (verbose)
int res, r;
if (verbose)
assert_se(r >= 0);
assert_se(r >= 0);
sd_event_loop(e);
xid = 0;
sd_event *e;
test_addr_acq(e);