Commit graph

30 commits

Author SHA1 Message Date
Michal Schmidt da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt 0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
Thomas Haller 1c6eb4e36b sd-dhcp-lease: fix copy-paste error asserting wrong function argument 2014-11-20 16:51:29 +01:00
Dan Williams e37f74a6d5 sd-dhcp-lease: load/save client ID
The lease is usually tied to the client ID, so users of the
lease may want to know what client ID it was acquired with.
2014-11-19 00:58:51 +01:00
Tom Gundersen 1dc24d5f48 sd-dhcp-lease: expose load/save functions
Based on patch by Dan Williams.
2014-11-18 19:10:37 +01:00
Tom Gundersen 1caa12d0a8 sd-dhcp-lease: use shared default prefixlen function
Also change the default prefixlen function to only access the first octet of the in_addr.
2014-11-01 19:02:44 +01:00
Tom Gundersen bab4792961 sd-dhcp-lease: use unaligned read helpers 2014-11-01 18:59:55 +01:00
Tom Gundersen df40eee8ed shared: in-addr-utils - add default_subnet_mask and default_prefixlen methods
These use the (deprecated) IPv4 address classes to deduce the corresponding subnet masks. This is useful when addresses
without subnet masks and prefix lengths are given.

Make use of these new functions from sd-dhcp-lease.
2014-10-27 17:40:24 +01:00
Lennart Poettering 708281b811 dhcp: the localhost isn't valid as hostname either 2014-08-15 03:10:20 +02:00
Tom Gundersen 784d9b9c09 sd-dhcp-lease: verify hostname and domainnames we receive 2014-08-15 01:04:53 +02:00
Tom Gundersen b0e39c8284 networkd: merge DNS and NTP entries when exporting
In the state files, do not distinguish where the various entries came from
(static or DHCP), but include them all in the same list.
2014-07-23 23:54:51 +02:00
Lennart Poettering a2ba62c719 sd-network: remove redundant array size parameter from functions that return arrays
As long as the number of array entries is relatively small it's nicer to
simply return the number of entries directly, instead of using a size_t*
return parameter for it.
2014-07-17 01:42:26 +02:00
Eugene Yakubovich e1ea665eda Add support for DHCP static route options
This adds support for DHCP options 33 and 121: Static Route and
Classless Static Route. To enable this feature, set UseRoutes=true
in .network file. Returned routes are added to the routing table.
2014-06-29 15:18:21 +02:00
Patrik Flykt 68ceb9df6a sd-dhcp-client/networkd: set lifetimes for IPv4 addresses
Note that /proc/sys/net/ipv4/ip_dynaddr needs to be non-zero.

[tomegun: hook up DHCP renew events to increase the lifetime when necessary]
2014-06-29 15:18:21 +02:00
Tom Gundersen f5c0c00f40 dhcp-lease: add support for parsing a few more dhcp options 2014-05-20 23:31:22 +02:00
Tom Gundersen e140ae58f1 dhcp-lease: refactor lease parsing
Use helper functions, and add some more sanity checking/asserts.
2014-05-20 23:31:22 +02:00
Tom Gundersen 81d98a39eb sd-dhcp-lease/sd-network: modernization and fix leak 2014-05-19 18:14:56 +02:00
Tom Gundersen 09bee74d7a sd-dhcp-lease: move in_addr (de)serialization to shared network code 2014-05-19 18:14:56 +02:00
Umut Tezduyar Lindskog 8ddbeaa23c networkd: dont configure route if lease doesn't have one 2014-04-30 00:05:28 +02:00
Tom Gundersen bc4155669a sd-dhcp-lease: fix double realloc 2014-04-29 21:57:59 +02:00
Tom Gundersen 109731eb25 sd-dhcp-lease: (de)serialize DNS and NTP servers
Also use inet_ntoa rather than inet_ntop.
2014-04-29 15:05:33 +02:00
Tom Gundersen 0b21bde96d sd-dhcp-leaes: use newdup() 2014-04-29 12:46:06 +02:00
Tom Gundersen 4684469639 sd-dhcp-lease: add NTP support
Export the NTP servers so timesyncd can use them.
2014-04-29 12:25:58 +02:00
Zbigniew Jędrzejewski-Szmek 6e00a80641 test-dhcp-client: unref lease objects to make valgrind happy
Also unref client objects in test code, and initalize logging,
to DEBUG by default.
2014-04-12 10:20:55 -04:00
Tom Gundersen 9e64dd7276 sd-dhcp-client: add fallback subnet masks
The DHCP RFC does not require the DHCP server to send a subnet mask, so if it
is missing, let's try to use the default subnet masks based on address class.
In case the class the address belongs to does not have a default subnet mask,
we fail as before.

Also improve logging when handling invalid dhcp messages, and simply ignore them
rather than stop the whole dhcp client.
2014-03-21 17:52:42 +01:00
Tom Gundersen 0ea51a1129 networkd: fix creation of runtime dirs at startup
This allows us to drop the repeated attempted creations of the runtime dirs during runtime.
2014-03-14 12:44:17 +01:00
Tom Gundersen 8e34a618e2 sd-dhcp-lease: add sd_dhcp_lease_get_next_server() 2014-03-03 17:18:22 +01:00
Tom Gundersen 0ad853bc06 sd-dhcp-lease: add sd_dhcp_lease_get_server_identifier() 2014-03-03 16:48:02 +01:00
Tom Gundersen ce78df79b8 sd-dhcp-lease: add Root Path support
This is necessary when mounting /dev/nfs based on a DHCP lease.
2014-03-03 16:48:02 +01:00
Tom Gundersen fe8db0c5ee sd-network: add new library
This is similar to sd-login, but exposes the state of networkd rather than logind.

Include it in libsystemd-dhcp and rename it to libsystemd-network.
2014-02-28 01:01:13 +01:00
Renamed from src/libsystemd-dhcp/dhcp-lease.c (Browse further)