b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
22805d9207d5242681e5667ee304572e4abf9b94 |
|
20-Jan-2016 |
Beniamino Galvani <bgalvani@redhat.com> |
dhcp: make DHCP_OPTION_* enum public
libsystemd-network provides the public function
sd_dhcp_client_set_request_option() to enable the request of a given
DHCP option. However the enum defining such options is defined in the
internal header dhcp-protocol.h. Move the enum definition to the
public header sd-dhcp-client.h and properly namespace values. |
4afd3348c7506dd1d36305b7bcb9feb8952b9d6b |
|
27-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.
With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.
The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).
This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.
Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:
#define _cleanup_(function) __attribute__((cleanup(function)))
Or similar, to make the gcc feature easier to use.
Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.
See #2008. |
f693e9b38f13575b988335e3324a50dcc8772d48 |
|
25-Nov-2015 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp: parse error message in DECLINE or NAK
If a client sends a DECLINE or a server sends a NAK, they can include
a string with a message to explain the error. Parse this and print it
at debug level. |
0d43d2fcb7ac5264c739dc2f67f93ed0985a418a |
|
25-Nov-2015 |
Tom Gundersen <teg@jklm.no> |
libsystemd-network: clean up recv functions |
933f9caeeb2b3c1b951d330e04beb04226e5a890 |
|
16-Nov-2015 |
Daniel Mack <daniel@zonque.org> |
siphash24: let siphash24_finalize() and siphash24() return the result directly
Rather than passing a pointer to return the result, return it directly
from the function calls.
Also, return the result in native endianess, and let the callers care
about the conversion. For hash tables and bloom filters, we don't care,
but in order to keep MAC addresses and DHCP client IDs stable, we
explicitly convert to LE. |
dbe81cbd2a93088236a2e4e41eeb33378940f7b9 |
|
16-Nov-2015 |
Martin Pitt <martin.pitt@ubuntu.com> |
siphash24: change result argument to uint64_t
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which
enforce pointer alignment this fixes crashes when we previously cast an
unaligned array to uint64_t*, and on others this should at least improve
performance as the compiler now aligns these properly.
This also simplifies the code in most cases by getting rid of typecasts. The
only place which we can't change is struct duid's en.id, as that is _packed_
and public API, so we can't enforce alignment of the "id" field and have to
use memcpy instead. |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
04c0136989b7eb896bfb0fb176e11233d69e1453 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-*.h: clean up exported (or to-be-exported) header files
Exported header files should not include internal headers. Fix that.
Exported header files should not use the bool type. So far we opted to
stick to C89 for exported headers, and hence use "int" for bools in
them. Continue to do so.
Exported header files should have #include lines for everything they use
including inttypes.h and sys/types.h, so that they may be included in
any order.
Exported header files should have C++ guards, hence add them.
Exported header files should not use gcc extensions like #pragma once,
get rid of it. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
0cb3c286883b694fc52a18a3b559ff98931641f3 |
|
06-Oct-2015 |
Tom Gundersen <teg@jklm.no> |
siphash24: unify API
Make the API of the new helpers more similar to the old wrapper.
In particular we now return the hash as a byte string to avoid
any endianness problems. |
1e2527a6fede996a429bd44b30a15e76ee293437 |
|
05-Oct-2015 |
Tom Gundersen <teg@jklm.no> |
hashmap: hash_funcs - make inputs unambiguous
Make sure all variable-length inputs are properly terminated or that
their length is encoded in some way. This avoids ambiguity of
adjacent inputs.
E.g., in case of a hash function taking two strings, compressing "ab"
followed by "c" is now distinct from "a" followed by "bc". |
b826ab586c9e0a9c0d438a75c28cf3a8ab485929 |
|
05-Oct-2015 |
Tom Gundersen <teg@jklm.no> |
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. |
64d6c22905e94b02e760747c6c143dc9893083d9 |
|
01-Sep-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tree-wide: do not shadow the global var timezone |
99634696183dfabae20104e58157c69029a11594 |
|
31-Aug-2015 |
Tom Gundersen <teg@jklm.no> |
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. |
83cedf7ae28925e37931e7e92d22be9c936a1def |
|
28-Aug-2015 |
Tom Gundersen <teg@jklm.no> |
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). |
1a04db0fc9d08fffe80d6d7b5b60459295922b11 |
|
27-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
586ac6f711e2eccceb12421df22fca4f117226c4 |
|
27-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
networkd: make DHCP lease timeouts configurable |
b3ec603ce8053ba3f95da1d36f15ea762c83d1e1 |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
dhcp: rename index to ifindex
This avoids confusion what this is, in particular as libc knows an
index() function. |
9a0f246fcdb1238e6b3397169a10095f4df89210 |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
dhcp: store client id as void*, since we dont know what it is |
966d74c043098e12d4d5b101aa7650244c14b815 |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
dhcp: properly handle error from ioctl() |
e473522841f630bfd25725b06605462e5e30587f |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
dhcp: generic data should be void*, not uint8_t*
If we handly arbitrary data we should use "void*" pointers, not
"uint8_t*", how go intended C to be used. |
89ca10c6a61309d84d54c5dc5a295387ce39e610 |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
network: s/user_data/userdata/
Everywhere else we call the generic user data pointer just "userdata",
rather than "user_data". Let's do this here, too. |
3733eec3e292e4ddb4cba5eb8d3bd8cbee7102d8 |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
dhcp: stop using refcnt.h
No need to invole atomic ops in single-threaded APIs, let's simplify
this. |
8eb9058dc1f99a5eb9b8726a978fcc0720837a10 |
|
26-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
756775814cf69471f74ce853745bba69f2ba94ef |
|
06-Aug-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tree-wide: do not return error codes as bool |
bff92d2c2f913c368d80066ee89855665818edc8 |
|
04-Aug-2015 |
Susant Sahani <ssahani@gmail.com> |
networkd: DHCP fix CID 1315105
CID 1315105: Resource leaks (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 800 in
dhcp_server_handle_message()
*** CID 1315105: Resource leaks (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 800 in |
38a03f06a7393d2721c23f23f0589d2f6d0904af |
|
03-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: make sure sd_event_now() cannot fail
Previously, if the event loop never ran before sd_event_now() would
fail. With this change it will instead fall back to invoking now(). This
way, the function cannot fail anymore, except for programming error when
invoking it with wrong parameters.
This takes into account the fact that many callers did not handle the
error condition correctly, and if the callers did, then they kept simply
invoking now() as fall back on their own. Hence let's shorten the code
using this call, and make things more robust, and let's just fall back
to now() internally.
Whether now() is used or the cache timestamp may still be detected via
the return value of sd_event_now(). If > 0 is returned, then the fall
back to now() was used, if == 0 is returned, then the cached value was
returned.
This patch also simplifies many of the invocations of sd_event_now():
the manual fall back to now() can be removed. Also, in cases where the
call is invoked withing void functions we can now protect the invocation
via assert_se(), acknowledging the fact that the call cannot fail
anymore except for programming errors with the parameters.
This change is inspired by #841. |
2a1288ff89322a2f49c79f6d1832c8164c14a05c |
|
10-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
util: introduce CMSG_FOREACH() macro and make use of it everywhere
It's only marginally shorter then the usual for() loop, but certainly
more readable. |
a7f7d1bde43fc825c49afea3f946f5b4b3d563e0 |
|
27-Mar-2015 |
Harald Hoyer <harald@redhat.com> |
fix gcc warnings about uninitialized variables
like:
src/shared/install.c: In function ‘unit_file_lookup_state’:
src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
return r < 0 ? r : state;
^
src/shared/install.c:1796:13: note: ‘r’ was declared here
int r;
^ |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use. |
a38d99451f2bf8026ec51aee91662292e823c6a8 |
|
12-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"
This reverts commit d6d810fbf8071f8510450dbacd1d083f37603656.
It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw
sockets. |
d6d810fbf8071f8510450dbacd1d083f37603656 |
|
10-Feb-2015 |
Cristian Rodríguez <crrodriguez@opensuse.org> |
tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC |
e2acdb6b0f68d9b4152708a9f21bf9e11f8b9e7e |
|
09-Feb-2015 |
Torstein Husebø <torstein@huseboe.net> |
treewide: correct typos and use consistent "MAC" spelling |
76253e73f9c9c24fec755e485516f3b55d0707b4 |
|
11-Oct-2014 |
Dan Williams <dcbw@redhat.com> |
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. |
d5099efc47d4e6ac60816b5381a5f607ab03f06e |
|
15-Sep-2014 |
Michal Schmidt <mschmidt@redhat.com> |
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. |
a6f1e036de8f212f33ead7f5387c297afd8be26e |
|
14-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: linebreaks
Don't overflow unnecessarily. |
59b8f6b628145586e87b8a4f6e29c755ad7d61ed |
|
04-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: always send out ROUTER and SUBNET_MASK
For now we simply take these values from the server's address. |
621ac3d2cc8f37169166df9c7f379b0cb6b17e36 |
|
03-Aug-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-dhcp-server: avoid returning garbage value
Force renewing with a pool size of 0 would return the uninitialized r. |
c15fb62a731f1a457af94e60ac6a4d23f219a8f6 |
|
03-Aug-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-dhcp-server: check if r < 0 |
527503444ef24ae03c73cf85128c7acbb1146f3c |
|
28-Jul-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add forcerenew support |
fa94c34b083b5b4019975624453e53d0cbad2a5d |
|
24-Jul-2014 |
Tom Gundersen <teg@jklm.no> |
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. |
1231c4d238844e77018caf5b5852f01d96373c47 |
|
14-Jul-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: make gcc happy
It complains about optoffset possibly being uninitialized. It is wrong,
but let's just initialize it. |
7c16313f11e3953f3fe4dbf544f2d36f58d14138 |
|
29-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
networkd/sd-dhcp-server: only start dhcp server when necessary |
d122f9ee3a0e3c02ff8100a3dcd1866e90a6537a |
|
21-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
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. |
d6bd972d061af306ede2affd2c9340a1660f7996 |
|
21-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: fix broadcast of DHCP packets
The destination IP address should be INADDR_BROADCAST, but was
accidentally left as INADDR_ANY. |
88675ae97c62dcef32c654038a9bb92fd890e408 |
|
20-Jun-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
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. |
3bdace9bf779ce051f00c14914b35c3a26164aa9 |
|
19-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
dhcp-server: simplify dhcp server unref call
No need to use HASHMAP_ITERATE when we destruct all entries anyway. |
02557f973aed0fed7154fefe53d67e2935f918dc |
|
18-Jun-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-dhcp-server: fix a leak
We must use free instead of dhcp_lease_free here to avoid freeing
client_id.data. |
500792d8180c9a11d65f107cdc79dea21b2964c4 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add RELEASE support |
5b34277c2015e32e51d10cfa076df2c7106b4537 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add dummy DECLINE support |
87322b3aee0dc649ff1ae7a403dcc9d7305baba2 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: track bound leases
Make sure we don't hand out the same IP twice. We still don't
handle lease expiry. |
c7d9ffe6d629cb5b34dd749e4a88b190b11a0f48 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add support for clients requesting lease lifetime |
bd57b45029ff25067704c9538e79f31e71c10045 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic NAK support |
2dead8129f7b6fe644e17e1dc1739bebacfe1364 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic REQUEST/ACK support |
4dc355680460fdc8e0d590d8572dff1b6a257d88 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic DISCOVER/OFFER support |
969b009d9416806911b9b52e7e7bc619c0c1a931 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add support for sending messages |
20af7091de0cdf92bf299addfc3f96c3ef805bd8 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add support for setting the server address |
8de4a226c71ef43e652274b33b5d19211a44ac7b |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
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. |
816e2e7af96886e4a43194042ef61ba9fec2c77d |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
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. |
be077570f779664ed87b50f60608df9fbe258821 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic message handling and verification |
3a864fe4a894745ac61f1ecabd7cadf04139a284 |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
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. |
ff734080aa02cd70b13bc0fdeec4a5886166163a |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic functionality for starting/stopping server
Bind to UDP socket and listen for messages, discarding anything we receive. |
b44cd8821087f2afebf85fec5b588f5720a9415c |
|
13-Jun-2014 |
Tom Gundersen <teg@jklm.no> |
sd-dhcp-server: add basic functionality for creating/destroying server instance |