Commit graph

10 commits

Author SHA1 Message Date
Tom Gundersen 06b44be71d sd-dhcp: equally verify udp and raw dhcp messages
Also be more explicit about why packages are ignored.
2014-02-23 16:16:09 +01:00
Tom Gundersen ee57a737a5 sd-dhcp: add very basic debug logging 2014-02-22 21:24:36 +01:00
Tom Gundersen 080ab27621 sd-dhcp: network - don't hardcode ports
We want to reuse these functions for the server library too.
2014-02-15 12:14:45 +01:00
Tom Gundersen cf597f650a sd-dhcp: split out packet handling from client 2014-02-11 16:24:23 +01:00
Tom Gundersen c61be55d23 libsystemd-dhcp: revert merge into libsystemd
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-21 00:04:53 +01:00
Tom Gundersen c813ca40c8 libsystemd-dhcp: merge into libsystemd 2014-01-13 21:06:08 +01:00
Patrik Flykt 234fc2dfce libsystemd-dhcp: Add functions for sending unicast UDP messages
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-22 14:37:49 +01:00
Patrik Flykt 8c00042c93 dhcp: Handle received DHCP Offer message
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-12 11:43:34 -05:00
Patrik Flykt 8b4a96932d dhcp: Add function for sending a raw packet
Open a packet socket, create a link level header, send packet and
close socket. Adding it to a separate file makes testing of the
DHCP sending much easier, as the test program can supply any socket
to the DHCP client code.
2013-12-12 11:43:34 -05:00
Patrik Flykt 524cf45894 dhcp: Add option appending and parsing
Add functions to append and parse DHCP options. Not all options
are passed to the callback function, the ones not exposed are
pad, end, message type and overload. If indicated by the overload
option, file and sname fields will be examined for more options.

The option functions are internal to DHCP, add a new header files
for interal function prototypes.
2013-12-12 11:43:33 -05:00