1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

22506 Commits

Author SHA1 Message Date
Lennart Poettering
586ac6f711 networkd: make DHCP lease timeouts configurable 2015-08-27 01:47:42 +02:00
Lennart Poettering
39745a5afb networkd: fix indentation 2015-08-27 01:18:10 +02:00
Lennart Poettering
4b7b5abb78 dhcp: NTP servers should be requested by networkd but not implicitly by sd-dhcp
The library so far always requested the NTP servers. This might be
unnecessary in some uses, hence let's move the request into networkd
instead.
2015-08-27 01:17:30 +02:00
Lennart Poettering
0339cd7707 dhcp: clean up dhcp4 lease object
a) drop handling of obsolete or unused DHCP options time_offset,
   mtu_aging_timeout, policy filter, mdr, ttl, ip forwarding settings.
   Should this become useful one day we can readd support for this.

b) For subnet mask and broadcast it is not always clear whether 0 or
   255.255.255.255 might be valid, hence maintain a boolean indicating
   validity next to it.

c) serialize/deserialize broadcast address, lifetime, T1 and T2 together
   with the rest of the fields in dhcp_lease_save() and
   dhcp_lease_load().

d) consistently return ENODATA from getter functions for data that is
   missing in the lease.

e) add missing getter calls for broadcast, lifetime, T1, T2.

f) when decoding DHCP options, generate debug messages on parse
   failures, but try to proceed if possible.

g) Similar, when deserializing a lease in dhcp_lease_load(), make sure
   we deal nicely with unparsable fields, to provide upgrade compat.

h) fix some memory allocations
2015-08-27 01:05:13 +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
966d74c043 dhcp: properly handle error from ioctl() 2015-08-26 23:26:01 +02:00
Lennart Poettering
e473522841 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.
2015-08-26 23:05:34 +02:00
Lennart Poettering
89ca10c6a6 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.
2015-08-26 22:47:53 +02:00
Lennart Poettering
0ae0e5cd96 dhcp: coding style fixes
We place the opening bracket of a function on the same line as the
function name. Let's do so in the DHCP sources too.
2015-08-26 21:09:00 +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
57de20dd8f basic: document that people shouldn't use refcnt.h without reason
refcnt.h only exists for cases where objects are simultaneously handled
by different threads. Otherwise it should not be used. The only case
where this applies is sd_bus, really, and pretty much none of our APIs,
since we do not claim thread-safety for them.
2015-08-26 21:04:38 +02:00
Lennart Poettering
bd91b83e57 dhcp: keep lease save/load functions private
When we make sd-dhcp public one day we really should not make
sd_dhcp_lease_save() and sd_dhcp_lease_load() public, since it's pretty
much only useful as internal utility for networkd itself.
2015-08-26 20:48:21 +02:00
Lennart Poettering
2f3cf1f9e1 networkd: let's uppercase the first character in log messages
Let's try to generate log messages that resemble english language
sentences, hence uppercase the first character.
2015-08-26 20:45:29 +02:00
Lennart Poettering
9098162579 dhcp: normalize DHCP host and domain names from leases
Previoulsy, we just checked whether the domain names specified in
incoming DHCP leases are valid. Given that validation code actually
internally normalizes anyway, it's a good idea to simply do the full
normalization and store that in the lease structure. This allows us to
remove the manual removal of a trailing dot, if there is one.
2015-08-26 20:45:29 +02:00
Lennart Poettering
2d03c0b803 dhcp: various simplifications 2015-08-26 20:45:29 +02:00
Lennart Poettering
e26b50585b network: turn on DHCP timezone passing between container and host
Let's turn on DHCP timezone passing from the host to a container, so
that the timezone is always in sync.
2015-08-26 20:45:29 +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
Lennart Poettering
43f447b121 dhcp: be more careful when parsing strings from DHCP packets
Let's make sure there's no embedded 0 byte. Also, let's reset the string
if the length is zero.
2015-08-26 20:41:42 +02:00
Lennart Poettering
1ac608c9cc networkd: don't leak memory of Hostname= is used twice in a .network file
Also, we should only accept trailing dots where we have to, but not
everywhere, hence be more strict when validating configured hostnames.
2015-08-26 20:41:22 +02:00
Lennart Poettering
5c904ba5a5 time-util: add new get_timezone() call to get local timezone
Let's move the timedated-specific code to time-util.h and make it
generic.
2015-08-26 20:36:42 +02:00
Kay Sievers
fd5a461316 hwdb: update 2015-08-26 18:38:30 +02:00
Kay Sievers
1aa28c9521 build-sys: bump versions 2015-08-26 16:09:17 +02:00
David Herrmann
a00458421d sd-dhcp6: fix domainname memleak
strv_extend() does not consume the passed entry, hence, we must properly
free it. Furthermore, we should *not* use strv_consume() as we do greedy
allocations on 'ret'; and greedy-allocations should only be used for short
lived objects or caches.

Fix the domainname parser to properly free temporary storage when done.
2015-08-26 12:37:56 +02:00
David Herrmann
e6b18ffaea sd-dhcp: don't randomly ref objects
In our API design, getter-functions don't ref objects. Calls like
foo_get_bar() will not ref 'bar'. We never do that and there is no real
reason to do it in single threaded APIs. If you need a ref-count, you
better take it yourself *BEFORE* doing anything else on the parent object
(as this might invalidate your pointer).

Right now, sd_dhcp?_get_lease() refs the lease it returns. A lot of
code-paths in systemd do not expect this and thus leak the lease
reference. Fix this by changing the API to not ref returned objects.
2015-08-26 12:30:56 +02:00
Daniel Mack
31ab68df9a Merge pull request #1048 from poettering/resolved-man
man: resolved man page updates (plus one to machinectl)
2015-08-26 12:01:56 +02:00
David Herrmann
86d17e1d73 Merge pull request #1047 from poettering/machinectl-TERM
machinectl: pass $TERM into "machinectl shell" sessions
2015-08-26 11:55:48 +02:00
Lennart Poettering
762a5766dc man: minor extension to the machinectl man page
s/an/any/, as reported by Vito Caputo.

Also mention explicitly that the security properties (i.e. SELinux) are
also isolated when "machinectl shell" is used.
2015-08-26 11:02:28 +02:00
Lennart Poettering
0d6868f9ae man: document nss-resolve 2015-08-26 11:00:09 +02:00
Martin Pitt
be5afe9f5f Merge pull request #1044 from d-hatayama/fix_systemctl_abspath
selinux: fix regression of systemctl subcommands when absolute unit file paths are specified
2015-08-26 10:53:45 +02:00
Lennart Poettering
2dc6b11d29 man: document resolved's RR synthesizing and query routing 2015-08-26 10:30:06 +02:00
Lennart Poettering
031fc5a1ac Merge pull request #998 from vbatts/tar_nosparse_flag
import: don't create sparse tar archives
2015-08-26 10:09:11 +02:00
Lennart Poettering
89fec31893 machinectl: pass $TERM into "machinectl shell" sessions 2015-08-26 10:07:21 +02:00
Tom Gundersen
aa036f1a23 Merge pull request #1046 from poettering/resolved-dump
dump resolved cache/zone info on SIGSUR1, plus one fix
2015-08-26 10:02:37 +02:00
Lennart Poettering
d9fcf2ba1a manager: close hostname fd *after* removing it epoll
Otherwise the epoll removal will fail and result in a warning.
2015-08-26 09:42:06 +02:00
Lennart Poettering
4d506d6bb7 resolved: dump cache and zone contents to syslog on SIGUSR1 2015-08-26 09:41:45 +02:00
Marcel Holtmann
da1d9fc2cc hwdb: Update database of Bluetooth company identifiers 2015-08-26 09:21:02 +02:00
HATAYAMA Daisuke
9fa7c1aeb9 selinux: fix regression of systemctl subcommands when absolute unit file paths are specified
The commit 4938696301 overlooked the
fact that unit files can be specified as unit file paths, not unit
file names, wrongly passing a unit file path to the 1st argument of
manager_load_unit() that handles it as a unit file name. As a result,
the following 4 systemctl subcommands:

    enable
    disable
    reenable
    link
    mask
    unmask

fail with the following error message:

    # systemctl enable /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # systemctl disable /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # systemctl reenable /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # cp /usr/lib/systemd/system/kdump.service /tmp/
    # systemctl link /tmp/kdump.service
    Failed to execute operation: Unit name /tmp/kdump.service is not valid.
    # systemctl mask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.
    # systemctl unmask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Unit name /usr/lib/systemd/system/kdump.service is not valid.

To fix the issue, first check whether a unit file is passed as a unit
file name or a unit file path, and then pass the unit file to the
appropreate argument of manager_load_unit().

By the way, even with this commit mask and unmask reject unit file
paths as follows and this is a correct behavior:

    # systemctl mask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Invalid argument
    # systemctl unmask /usr/lib/systemd/system/kdump.service
    Failed to execute operation: Invalid argument
2015-08-26 15:00:05 +09:00
Daniel Mack
7c268a0489 Merge pull request #1043 from phomes/master
test-util: fix a memleak
2015-08-26 00:05:33 +02:00
Daniel Mack
487ebe593c Merge pull request #1039 from poettering/nspawn-machine-template
nspawn: make sure --template= and --machine= my be combined
2015-08-25 23:58:40 +02:00
Daniel Mack
6a18bd1616 Merge pull request #1038 from poettering/coredumpctl-directory
Add --directory= option for reading alternate journal
2015-08-25 23:58:03 +02:00
Daniel Mack
a0cb22c475 Merge pull request #1040 from poettering/cgroup-path-fix
fix "systemctl status idontexist.service" showing the full cgroup tree
2015-08-25 23:57:28 +02:00
Thomas Hindoe Paaboel Andersen
21e5a0bea0 test-util: fix a memleak 2015-08-25 23:52:18 +02:00
Daniel Mack
d8b7e75f51 resolve: fix regression in dns-scope
Bring back a return statement 106784eb errornously removed.

Thanks to @phomes for reporting.
2015-08-25 23:51:34 +02:00
Daniel Mack
13918f62ff Merge pull request #1041 from phomes/master
trivial cleanups
2015-08-25 23:48:07 +02:00
Daniel Mack
4ece412faf Merge pull request #1034 from poettering/resolved-fixes-2
various resolved fixes
2015-08-25 23:47:30 +02:00
Thomas Hindoe Paaboel Andersen
c615b4ba9f machinectl: remove unused variable 2015-08-25 21:15:54 +02:00
Thomas Hindoe Paaboel Andersen
2307f37e46 execute: make the invalid entry of the enum -1
Set _EXEC_UTMP_MODE_INVALID to -1. This matches the return value from
string_table_lookup.
2015-08-25 21:15:54 +02:00
Lennart Poettering
98bac6058c core: report root cgroup as "/" over the bus
Internally, the root cgroup is stored as the empty string in
Unit.cgroup_path, and "no cgroup" as NULL. Unfortunately, D-Bus does not
know a NULL concept, hence when reporting the cgroup to clients we
should turn the root cgroup into "/", and leave the empty string for the
"no cgroup" case.

This should make sure that "systemctl status -- -.slice" works correctly
and shows the entire cgroup tree.
2015-08-25 20:42:50 +02:00
Lennart Poettering
37a0d5bf21 Revert "systemctl: properly handle empty control group paths in "status""
This reverts commit b04c25f9ef.
2015-08-25 20:37:54 +02:00