Commit graph

26 commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen 71d35b6b55 tree-wide: sort includes in *.h
This is a continuation of the previous include sort patch, which
only sorted for .c files.
2015-11-18 23:09:02 +01:00
Tom Gundersen b826ab586c hashmap: refactor hash_func
All our hash functions are based on siphash24(), factor out
siphash_init() and siphash24_finalize() and pass the siphash
state to the hash functions rather than the hash key.

This simplifies the hash functions, and in particular makes
composition simpler as calling siphash24_compress() repeatedly
on separate chunks of input has the same effect as first
concatenating the input and then calling siphash23_compress()
on the result.
2015-10-05 18:22:10 +02:00
Tom Gundersen 9963469618 sd-dhcp-server: simplify pool creation
Merge sd_dhcp_server_set_address() and sd_dhcp_server_set_lease_pool() into
sd_dhcp_server_configure_pool() as the behavior of the two former depends
on the order they are called in. The flexibility is not needed, so let's
just do this in one call.
2015-08-31 21:34:58 +02:00
Tom Gundersen 83cedf7ae2 sd-dhcp-server: improve predictability of leases
Rather than having all clients attempt to get the same leases (starting at the
beginning of the pool), make each client star at a random offset into the pool
determined by their client id. This greatly increases the chances of a given
client receiving the same IP address even though both the client and server
have lost any lease information (and distinct server instances handing out
the same leases).
2015-08-28 11:05:32 +02:00
Lennart Poettering 1a04db0fc9 dhcp,network: support emitting DNS/NTP server information from DHCP server
For now, this is very simple and IP addresses have to be configured
manually.
2015-08-27 14:48:37 +02:00
Lennart Poettering 586ac6f711 networkd: make DHCP lease timeouts configurable 2015-08-27 01:47:42 +02:00
Lennart Poettering b3ec603ce8 dhcp: rename index to ifindex
This avoids confusion what this is, in particular as libc knows an
index() function.
2015-08-26 23:31:49 +02:00
Lennart Poettering 9a0f246fcd dhcp: store client id as void*, since we dont know what it is 2015-08-26 23:30:27 +02:00
Lennart Poettering 3733eec3e2 dhcp: stop using refcnt.h
No need to invole atomic ops in single-threaded APIs, let's simplify
this.
2015-08-26 21:05:53 +02:00
Lennart Poettering 8eb9058dc1 dhcp,network: implement RFC 4833 (DHCP Timezone option)
This one is simply to add: encode the tzdata timezone in the DHCP
options and optionally make use of it.
2015-08-26 20:44:20 +02:00
Zbigniew Jędrzejewski-Szmek c9403dced7 #pragma once here and there 2015-01-23 09:30:44 -05:00
Lennart Poettering 79008bddf6 log: rearrange log function naming
- Rename log_meta() → log_internal(), to follow naming scheme of most
  other log functions that are usually invoked through macros, but never
  directly.

- Rename log_info_object() to log_object_info(), simply because the
  object should be before any other parameters, to follow OO-style
  programming style.
2014-11-27 22:05:24 +01:00
Lennart Poettering 086891e5c1 log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers
This change has two benefits:

- The format string %m will now resolve to the specified error (or to
  errno if the specified error is 0. This allows getting rid of a ton of
  strerror() invocations, a function that is not thread-safe.

- The specified error can be passed to the journal in the ERRNO= field.

Now of course, we just need somebody to convert all cases of this:

        log_error("Something happened: %s", strerror(-r));

into thus:

        log_error_errno(-r, "Something happened: %m");
2014-11-27 22:05:23 +01: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
Tom Gundersen 527503444e sd-dhcp-server: add forcerenew support 2014-07-28 10:44:51 +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 2dead8129f sd-dhcp-server: add basic REQUEST/ACK 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