Commit graph

31 commits

Author SHA1 Message Date
Torstein Husebø e2acdb6b0f treewide: correct typos and use consistent "MAC" spelling 2015-02-09 14:32:49 +01:00
Dan Williams 76253e73f9 sd-dhcp-client: support non-Ethernet hardware addresses
Like Infiniband.  See RFC 4390 section 2.1 for details on DHCP
and Infiniband; chaddr is zeroed, hlen is set to 0, and htype
is set to ARPHRD_INFINIBAND because IB hardware addresses
are 20 bytes in length.
2014-10-11 12:15:54 +02:00
Michal Schmidt d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.

systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.
2014-09-15 16:08:50 +02:00
Tom Gundersen a6f1e036de sd-dhcp-server: linebreaks
Don't overflow unnecessarily.
2014-08-14 01:29:51 +02:00
Tom Gundersen 59b8f6b628 sd-dhcp-server: always send out ROUTER and SUBNET_MASK
For now we simply take these values from the server's address.
2014-08-04 20:58:15 +02:00
Thomas Hindoe Paaboel Andersen 621ac3d2cc sd-dhcp-server: avoid returning garbage value
Force renewing with a pool size of 0 would return the uninitialized r.
2014-08-03 20:42:59 +02:00
Thomas Hindoe Paaboel Andersen c15fb62a73 sd-dhcp-server: check if r < 0 2014-08-03 20:42:59 +02:00
Tom Gundersen 527503444e sd-dhcp-server: add forcerenew support 2014-07-28 10:44:51 +02:00
Tom Gundersen fa94c34b08 libsystemd-network: use CLOCK_BOOTTIME instead of CLOCK_MONOTONIC where possible
The timeouts in the networking library (DHCP lease timeouts and similar) should not be affected
by suspend. In the cases where CLOCK_BOOTTIME is not implemented, it is still safe to fallback to
CLOCK_MONOTONIC, as the consumers of the library (i.e., networkd) _should_ renew the leases when
coming out of suspend.
2014-07-24 19:02:58 +02:00
Tom Gundersen 1231c4d238 sd-dhcp-server: make gcc happy
It complains about optoffset possibly being uninitialized. It is wrong,
but let's just initialize it.
2014-07-14 16:49:41 +02:00
Tom Gundersen 7c16313f11 networkd/sd-dhcp-server: only start dhcp server when necessary 2014-06-29 15:18:21 +02:00
Tom Gundersen d122f9ee3a sd-dhcp-server: change default lease time form 1m to 1h
The short lease was useful for testing, but in real-world usage it is pointless to keep leases
this short. That said, the cost of lease renewal is really low, so we keep the lease still
relatively short at one hour to not get into hard-to-hit problems with lease exhaustion etc.
2014-06-21 15:26:41 +02:00
Tom Gundersen d6bd972d06 sd-dhcp-server: fix broadcast of DHCP packets
The destination IP address should be INADDR_BROADCAST, but was
accidentally left as INADDR_ANY.
2014-06-21 15:02:30 +02:00
Thomas Hindoe Paaboel Andersen 88675ae97c sd-dhcp-server: remove unused cleanup function
Removes _cleanup_dhcp_lease_free_. While the automatic cleanup
functions are great to have this one is never used and causes
a warning in clang.
2014-06-20 19:32:51 +02:00
Lennart Poettering 3bdace9bf7 dhcp-server: simplify dhcp server unref call
No need to use HASHMAP_ITERATE when we destruct all entries anyway.
2014-06-19 00:00:24 +02:00
Thomas Hindoe Paaboel Andersen 02557f973a sd-dhcp-server: fix a leak
We must use free instead of dhcp_lease_free here to avoid freeing
client_id.data.
2014-06-18 23:21:00 +02:00
Tom Gundersen 500792d818 sd-dhcp-server: add RELEASE support 2014-06-13 17:07:20 +02:00
Tom Gundersen 5b34277c20 sd-dhcp-server: add dummy DECLINE support 2014-06-13 17:07:20 +02:00
Tom Gundersen 87322b3aee sd-dhcp-server: track bound leases
Make sure we don't hand out the same IP twice. We still don't
handle lease expiry.
2014-06-13 17:07:19 +02:00
Tom Gundersen c7d9ffe6d6 sd-dhcp-server: add support for clients requesting lease lifetime 2014-06-13 17:07:19 +02:00
Tom Gundersen bd57b45029 sd-dhcp-server: add basic NAK support 2014-06-13 17:07:19 +02:00
Tom Gundersen 2dead8129f sd-dhcp-server: add basic REQUEST/ACK support 2014-06-13 17:07:19 +02:00
Tom Gundersen 4dc3556804 sd-dhcp-server: add basic DISCOVER/OFFER support 2014-06-13 17:07:19 +02:00
Tom Gundersen 969b009d94 sd-dhcp-server: add support for sending messages 2014-06-13 17:07:19 +02:00
Tom Gundersen 20af7091de sd-dhcp-server: add support for setting the server address 2014-06-13 17:07:19 +02:00
Tom Gundersen 8de4a226c7 sd-dhcp-server: bind to raw socket for sending
We would like to use the UDP socket, but we cannot as we need to specify
the MAC address manually.
2014-06-13 16:53:13 +02:00
Tom Gundersen 816e2e7af9 sd-dhcp-server: add basic message parsing
Parse the maximum message size the client can accept and the client id, falling back to
sane defaults if they are not set.
2014-06-13 16:53:13 +02:00
Tom Gundersen be077570f7 sd-dhcp-server: add basic message handling and verification 2014-06-13 16:53:13 +02:00
Tom Gundersen 3a864fe4a8 sd-dhcp-server: bind to a given interface
We will (at least at first), restrict our focus to running the server
on at most one interface.
2014-06-13 16:53:13 +02:00
Tom Gundersen ff734080aa sd-dhcp-server: add basic functionality for starting/stopping server
Bind to UDP socket and listen for messages, discarding anything we receive.
2014-06-13 16:53:13 +02:00
Tom Gundersen b44cd88210 sd-dhcp-server: add basic functionality for creating/destroying server instance 2014-06-13 16:53:13 +02:00