summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/test-dhcp-client.c
AgeCommit message (Collapse)Author
2014-02-15sd-dhcp: network - don't hardcode portsTom Gundersen
We want to reuse these functions for the server library too.
2014-01-21libsystemd-dhcp: revert merge into libsystemdTom Gundersen
Unlike the other merged libs, the rest of libsystemd will never depend on sd-dhcp-client, so there is no reason not to keep it separate.
2014-01-13libsystemd-dhcp: merge into libsystemdTom Gundersen
2013-12-31dhcp: fix creation of req_opts arrayZbigniew Jędrzejewski-Szmek
GREEDY_REALLOC needs to have two size variables: one for the allocated size, and a second one for the used size. Using the allocated size only lead to leaving some elements unitialized and assigning some more than once.
2013-12-22libsystemd-dhcp: Add functions for sending unicast UDP messagesPatrik Flykt
Create a helper functions setting up an unicast DHCP UDP socket and sending data. Add function stubs for the test program. [tomegun: initialize structs when allocating, and drop unneccesary 'err']
2013-12-22libsystemd-dhcp: Check test result without casting valuePatrik Flykt
2013-12-22libsystemd-dhcp: Fix checksum computation for buffer with odd sizePatrik Flykt
Fix off-by-one error and notice that summing may need more than one round for the result to be in the lower 16 bits.
2013-12-12dhcp: Handle received DHCP Offer messagePatrik Flykt
Create a function for handling the full IP, UDP and DHCP packet and tie it to the main loop. Verify IP and UDP headers and checksum. Creat a new lease structure with using the values supplied in the DHCP message. Free the lease structure when client is stopped. Split out socket handling into a creation and a sending part. As a result modify the test code.
2013-12-12dhcp: Add timeout and main loop supportPatrik Flykt
Require a main loop to be set when creating a DHCP client. Set up a timer to resend DHCP Discover messages and add a 0-2 second delay to the timeout value. Move to state Selecting after successful sending of a Discover message.
2013-12-12dhcp: Add test for discover DHCP packet creationPatrik Flykt
Set a fake MAC address and emulate raw packet sending. When the buffer containing the Discover message is received, check selected IP and UDP headers and compute IP header and UDP message checksums. Also send the DHCP message for option parsing and expect a successful outcome.
2013-12-12dhcp: Add test function for computing checksumPatrik Flykt
2013-12-12dhcp: Add test for DHCP client initialization and parameter settingPatrik Flykt