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

12243 Commits

Author SHA1 Message Date
Tom Gundersen
642900d3fa shared: dns-name - introduce dns_label_unescape_suffix()
Intended to be called repeatedly, and returns then successive unescaped labels
from the most to the least significant (left to right).

This is slightly inefficient as it scans the string three times (two would be
sufficient): once to find the end of the string, once to find the beginning
of each label and lastly once to do the actual unescaping. The latter two
could be done in one go, but that seemed unnecessarily convoluted.
2015-07-28 00:07:31 +02:00
Ivan Shapovalov
29b8b5ce87 analyze: move acquire_boot_times() above acquire_time_data()
Next patch will make the latter call into the former.
2015-07-28 01:01:10 +03:00
Daniel Mack
3992bee819 Merge pull request #744 from poettering/vnethdr-fix
networkd: capitalize VNetHeader= as VnetHeader=
2015-07-27 21:34:11 +02:00
Tom Gundersen
75c0cab158 util: base32hex - explain distinction with base32 2015-07-27 20:34:47 +02:00
Tom Gundersen
c73ee39d10 resolved: transaction - don't explicitly verify packet source
This is handled by the kernel now that the socket is connect()ed.
2015-07-27 20:34:28 +02:00
Tom Gundersen
088480faf1 resolved: transaction - don't unref server when creating TCP socket
This was a bug.
2015-07-27 20:34:15 +02:00
Tom Gundersen
72290734be resolved: scope - write() unicast DNS packets
As we have connect()ed to the desired DNS server, we no longer need to pass
control messages manually when sending packets. Simplify the logic accordingly.
2015-07-27 20:32:24 +02:00
Tom Gundersen
471d40d92f resolved: transaction - introduce dns_transaction_emit()
This function emits the UDP packet via the scope, but first it will
determine the current server (and connect to it) and store the
server in the transaction.

This should not change the behavior, but simplifies the code.
2015-07-27 20:30:54 +02:00
Lennart Poettering
2aba142edd networkd: capitalize VNetHeader= as VnetHeader=
Even when we use shortened, combined words, we still should uppercase
where a new word starts. I couldn't find a canonically capitalized
version of this term, hence I think we should follow our naming rules
here.
2015-07-27 20:24:31 +02:00
Tom Gundersen
c19ffd9fbf resolved: transaction - move a couple of functions
No functional change, but makes follow-up patch clearer.
2015-07-27 20:18:43 +02:00
David Herrmann
d537694a98 terminal: drop unfinished code
This drops the libsystemd-terminal and systemd-consoled code for various
reasons:

 * It's been sitting there unfinished for over a year now and won't get
   finished any time soon.

 * Since its initial creation, several parts need significant rework: The
   input handling should be replaced with the now commonly used libinput,
   the drm accessors should coordinate the handling of mode-object
   hotplugging (including split connectors) with other DRM users, and the
   internal library users should be converted to sd-device and friends.

 * There is still significant kernel work required before sd-console is
   really useful. This includes, but is not limited to, simpledrm and
   drmlog.

 * The authority daemon is needed before all this code can be used for
   real. And this will definitely take a lot more time to get done as
   no-one else is currently working on this, but me.

 * kdbus maintenance has taken up way more time than I thought and it has
   much higher priority. I don't see me spending much time on the
   terminal code in the near future.

If anyone intends to hack on this, please feel free to contact me. I'll
gladly help you out with any issues. Once kdbus and authorityd are
finished (whenever that will be..) I'll definitely pick this up again. But
until then, lets reduce compile times and maintenance efforts on this code
and drop it for now.
2015-07-27 20:15:34 +02:00
Tom Gundersen
0db643664c resolved: transaction - move DNS UDP socket creation to the scope
With access to the server when creating the socket, we can connect()
to the server and hence simplify message sending and receiving in
follow-up patches.
2015-07-27 20:13:11 +02:00
Tom Gundersen
647f6aa8fc resolved: transaction - close socket when changing server
Close the socket when changing the server in a transaction, in
order for it to be reopened with the right server when we send
the next packet.

This fixes a regression where we could get stuck with a failing
server.
2015-07-27 20:01:07 +02:00
Tom Gundersen
86ad4cd709 resolved: transaction - don't request PKTINFO for unicast DNS
This was only ever used by LLMNR, so don't request this for unicast DNS packets.
2015-07-27 19:56:45 +02:00
Tom Gundersen
0eb99d0a6a resloved: transaction - unify IPv4 and IPv6 sockets
A transaction can only have one socket at a time, so no need to distinguish these.
2015-07-27 19:52:48 +02:00
David Herrmann
2d5c8a2756 sd-bus: fix path of object-manager signals
Each signal of the ObjectManager interface carries the path of the object
in question as an argument. Therefore, a caller will deduce the object
this signal is generated for, by parsing the _argument_. A caller will
*not* use the object-path of the message itself (i.e., message->path).
This is done on purpose, so the caller can rely on message->path to be
the path of the actual object-manager that generated this signal, instead
of the path of the object that triggered this signal.

This commit fixes all InterfacesAdded/Removed signals to use the path of
the closest object-manager as message->path. 'closest' in this case means
closest parent with at least one object-manager registered.

This fix raises the question what happens if we stack object-managers in
a hierarchy. Two implementations are possible: First, we report each
object only on the nearest object-manager. Second, we report it on each
parent object-manager. This patch chooses the former. This is compatible
with other existing ObjectManager implementations, which are required to
call GetManagedObjects() recursively on each object they find, which
implements the ObjectManager interface.
2015-07-27 19:15:08 +02:00
Daniel Mack
ad8373e9e3 bus-proxy: augment debug message for dropped broadcasts a bit
Add the PID we are proxying for, as well as the message's sender and
destination string, to the debug message that is printed when the proxy
drops unmatched broadcasts.
2015-07-27 15:41:53 +02:00
Susant Sahani
f33ff02b1a networkd: add support for macvtap
This patch add support for macvtap.

see http://virt.kernelnewbies.org/MacVTap
2015-07-27 11:18:28 +05:30
Susant Sahani
d13125752d sd-netlink: Add macvtap support 2015-07-27 11:18:07 +05:30
Martin Pitt
baee30afce networkd-wait-online: fix -i argument
-i (aka --interface) takes an argument. Tell getopt_long() that, so that optarg
isn't NULL.
2015-07-26 15:39:09 +02:00
Kay Sievers
7189be2728 Merge pull request #716 from michaelolbrich/automount-fixes
Automount fixes
2015-07-26 13:56:50 +02:00
Kay Sievers
2909365c51 Merge pull request #724 from dbuch/master
proxyd: downgrade to log_debug() for unmatched broadcasts
2015-07-26 11:43:13 +02:00
Kay Sievers
fc7bdb583f systemd-boot: fix whitespace 2015-07-26 00:38:01 +02:00
Kay Sievers
2da6d7b91d Merge pull request #634 from icarlosvenegas/sd-boot-show-efi-cmdline_v2
sd-boot: Show stub cmdline when edit (v2)
2015-07-26 00:35:23 +02:00
Daniel Buch
e1d654341b proxyd: downgrade to log_debug() for unmatched broadcasts 2015-07-25 14:12:39 +02:00
Zbigniew Jędrzejewski-Szmek
23da66bb40 networkd: rename RootBlock to AllowPortToBeRoot
Justification is similar to BPDUGuard rename. "Positive" values
are easier. This is a rather uncommon option, so using a slightly
longer name should not be a problem, and may in fact may make it
easier to guess what the option does without reading the
documentation.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek
072f9e4af4 networkd: turn UnicastFlood on by default
Looking at the kernel commit, "on" seems to be the default value:
commit 867a59436fc35593ae0e0efcd56cc6d2f8506586
Author: Vlad Yasevich <vyasevic@redhat.com>
Date:   Wed Jun 5 10:08:01 2013 -0400

    bridge: Add a flag to control unicast packet flood.

    Add a flag to control flood of unicast traffic.  By default, flood is
    on and the bridge will flood unicast traffic if it doesn't know
    the destination.  When the flag is turned off, unicast traffic
    without an FDB will not be forwarded to the specified port.

... and it seems to be the reasonable thing to do by default.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek
84c3409631 networkd: rename BPDUGuard to UseBPDU
Rename to follow the follow the style of other options.

In general "positive" options are preferred to "negative" ones,
because they are easier to describe and easier for humans to
parse (c.f. the shortening on the man page entry).
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek
a9b70f9dfd network: rename DiffServiceCodePoint to CopyDSCP
Old name was slightly misleading, because this flag does not determine
whether DSCP is used overall, but only if it is copied to the
decapsulated packet. Rename to better reflect that.

"Copy" does not imply direction. This is on purpose, because we might
later on enhance the setting to allow/disallow copying in the other
direction, to the encapsulated packet. If that is implemented,
CopyDSCP could understand additional values. This is nicer than
having two separate settings and follows the example of DHCP=.

Also, we try to avoid abbreviations, but we allow acronyms
like MTU, in DiscoverPathMTU=.

This setting was recently added, so it's fine to rename it without
backwards compat.
2015-07-24 23:44:34 -04:00
Zbigniew Jędrzejewski-Szmek
6e74cadeef netlink-types: use consistent whitespace at EOL
Follow up for v222-124-g79e27dbcb1.
2015-07-24 23:43:51 -04:00
Kay Sievers
c11ae0bace bootctl: add missing newline 2015-07-25 03:26:32 +02:00
Thomas Hindoe Paaboel Andersen
7bea001ea4 ata_id: remove unused union member
The last use of octa was removed in 01f61d331b
2015-07-25 00:14:13 +02:00
Michael Olbrich
3dbadf9ef9 automount: handle state changes of the corresponding mount unit correctly
The expire timeout must be started/stopped if the corresponding mount unit
changes its state, e.g. it is started via local-fs.target or stopped by a
manual umount.
2015-07-24 22:30:26 +02:00
Michael Olbrich
5f8ae398ae automount: don't try to umount if it already happened
Return the token immediately instead. Otherwise the token is never returned
to the kernel, because the umount job is a noop and will not trigger a
state change.
2015-07-24 22:30:22 +02:00
Daniel Mack
816b4547da resolved: fix DNS_TYPE_ANY vs DNS_CLASS_ANY confusion
Assigning a TPYE enum value to a class variable is certainly wrong.
However, they both have the same value, so the result was correct
nevertheless.
2015-07-24 19:54:00 +02:00
Daniel Mack
b83b298102 Merge pull request #704 from richardmaw-codethink/empty-arg-unquote
unquote_first_word: parse ` '' ` as an empty argument instead of no arg
2015-07-24 19:49:29 +02:00
Tom Gundersen
0b071992bb Merge pull request #714 from zonque/automount
automount: do not start expiration timer for TimeoutIdleSec=0
2015-07-24 19:15:54 +02:00
Daniel Mack
93a3b53b2b automount: do not start expiration timer for TimeoutIdleSec=0
The timer value for automount unit specified with TimeoutIdleSec= is rounded
up to one second if that directive is set to 0.

Fix this by bailing early in automount_enter_runnning() in case no timeout is
requested.
2015-07-24 18:33:52 +02:00
daurnimator
29ddae7b78 sd-bus: remove _VTABLE from new method vtable initialiser 2015-07-24 22:59:19 +10:00
daurnimator
09c8a7c63c sd-bus: add 'offset' member for vtable methods
Defaults to zero, which retains the current behaviour.
Fixes #577
2015-07-24 22:22:54 +10:00
Daniel Mack
45d9a30414 tree-wide: do not use _cleanup_free_ on const pointers
free() cannot be used with const pointers. However, our _cleanup_free_
handler features cast logic that hides that qualifier, so we don't get a
warning.
2015-07-24 13:52:30 +02:00
David Herrmann
95cdf5e3a9 sd-bus: don't treat KDBUS_ITEM_TIMESTAMP as unknown item
In bus_kernel_translate_message(), we print a DEBUG message on unknown
items. But right now, we also print this message for KDBUS_ITEM_TIMESTAMP
despite parsing it properly. Fix this!
2015-07-24 12:53:23 +02:00
Daniel Mack
603d5da504 Merge pull request #606 from dvdhrm/bus-proxy-pedantic-matches2
bus-proxy: never pass on unmatched broadcasts (v2)
2015-07-24 12:50:56 +02:00
Daniel Mack
77b7f80509 Merge pull request #695 from poettering/journal-fixes
Journal fixes
2015-07-24 12:04:30 +02:00
Daniel Mack
7121b2152a Merge pull request #702 from ldzhong/fix
udev: fix parameter process
2015-07-24 11:59:30 +02:00
Richard Maw
14e685c29d unquote_first_word: parse '' as an empty argument instead of no argument 2015-07-24 09:29:46 +00:00
Lidong Zhong
e14b6f211c udev: fix parameter process 2015-07-24 16:39:55 +08:00
Daniel Mack
a20fbee75a Merge pull request #699 from ysbnim/master
exit-status: add missing string for EXIT_SMACK_PROCESS_LABEL
2015-07-24 10:20:40 +02:00
Daniel Mack
b4c279bea7 Merge pull request #696 from poettering/automount-expiry-freq
automount: lower the idle polling frequency a bit
2015-07-24 10:09:06 +02:00
Daniel Mack
4026f52a24 Merge pull request #697 from poettering/service-bus-name
core: print a nicer warning when two units have the same BusName= set…
2015-07-24 10:08:44 +02:00
Sungbae Yoo
94b573bd1a exit-status: add a missing string for EXIT_SMACK_PROCESS_LABEL 2015-07-24 14:51:05 +09:00
Lennart Poettering
fc1ba5d193 core: print a nicer warning when two units have the same BusName= setting
This should make issues like #609 easier to debug.
2015-07-24 03:50:36 +02:00
Lennart Poettering
dbf5cc473f automount: lower the idle polling frequency a bit
The autofs kernel idle logic requires us to poll the kernel for
idleness. This is of course suboptimal, but cannot be fixed without
kernel change.

Currently the polling frequency is set to 1/10 of the idle timeout. This
is quite high, as seen in #571. Let's lower this to 1/3.
2015-07-24 03:13:57 +02:00
Lennart Poettering
e80acc51ae journal: uppercase first character in verify error messages
In the english language the first character of a sentence is supposed to
be uppercase. Let's make sure this also applies to the journal
verification error messages.
2015-07-24 02:18:13 +02:00
Lennart Poettering
02ab86c732 journalctl: properly detect empty journal files
When we encounter a journal file with exactly zero entries, print a nice
message and exit, and don't print a weird error message.
2015-07-24 02:10:32 +02:00
Lennart Poettering
bca9e39dfa journal: explain the error when we find a non-DATA object that is compressed
Only objects of type DATA may be compressed, generate a message about
that, like we do for all other errros.
2015-07-24 02:02:07 +02:00
Lennart Poettering
8dc37a8525 journal: when verifying journal files, handle empty ones nicely
A journal file that carries no objects should be considered valid.
2015-07-24 02:00:43 +02:00
Lennart Poettering
dade37d403 journal: avoid mapping empty data and field hash tables
When a new journal file is created we write the header first, then sync
and only then create the data and field hash tables in them. That means
to other processes it might appear that the files have a valid header
but not data and field hash tables. Our reader code should be able to
deal with this.

With this change we'll not map the two hash tables right-away after
opening a file for reading anymore (because that will of course fail if
the objects are missing), but delay this until the first time we access
them. On top of that, when we want to look something up in the hash
tables and we notice they aren't initialized yet, we consider them
empty.

This improves handling of some journal files reported in #487.
2015-07-24 01:55:45 +02:00
Lennart Poettering
45c047b227 journal-verify: don't hit SIGFPE when determining progress
If we determine the progress based on a number of objects available,
don't blindly devide by the number of objects, given that it might be 0.
2015-07-24 01:40:44 +02:00
Daniel Mack
39109ec08d Merge pull request #694 from poettering/fileio-fixes
Fileio fixes
2015-07-24 00:04:49 +02:00
Lennart Poettering
03c55bc0b9 process: an empty environment block should be returned as such
An empty env block is completely valid, hence return it as such, and
don't turn it into an error.
2015-07-23 23:47:54 +02:00
Lennart Poettering
a644184a17 process: return ESRCH when a PID is not valid anymore
so far, when we read something from /proc/$PID we would pass on the
ENOENT from the kernel as error, if the process was missing. With this
change we systematically convert this to ESRCH, which is the more
appropriate error code, and what all the other glibc/syscalls like
kill() use.

All code that calls these functions should be fine with this change. In
fact, one invocation of get_process_exe() in bus-creds.c already assumed
ESRCH would be returned if a process is missing, and this assumption is
now validated after the change.
2015-07-23 23:44:40 +02:00
Lennart Poettering
901108257e fileio: get_status_field() don't clobber arg on OOM
According to our coding style guidelines we shouldn't clobber
pass-by-ref arguments on failure, hence don't do so here either.
2015-07-23 23:36:36 +02:00
Daniel Mack
6fa7ec3b6b Merge pull request #692 from poettering/fd-copy-directory-all
copy: when we recursively copy a directory tree, copy everything
2015-07-23 23:20:18 +02:00
Lennart Poettering
8420fa3acf copy: when we recursively copy a directory tree, copy everything
Don't ignore hidden files and directories.

Fixes #386
2015-07-23 23:09:34 +02:00
Tom Gundersen
37b4859186 Merge pull request #683 from ssahani/tun1
networkd: ip6gre add support for flowlabel
2015-07-23 22:46:07 +02:00
Lennart Poettering
0ed5c799a6 Merge pull request #670 from floppym/ptsuid
nspawn: Don't pass uid mount option for devpts
2015-07-23 21:56:09 +02:00
Lennart Poettering
c5f44880ca Merge pull request #678 from eworm-de/oracle-kvm
Oracle kvm
2015-07-23 21:38:01 +02:00
Christian Hesse
e32886e010 virt: handle Virtualbox 5.0 with kvm hypervisor
Virtualbox 5.0 now supports kvm hypervisor. In this case cpuid
identidies as "kvm", which breaks units depending on
ConditionVirtualization=oracle.
So return "oracle" even with kvm hypervisor.
2015-07-23 21:18:55 +02:00
Lennart Poettering
28a5679cdc Merge pull request #682 from ssahani/bridge
networkd: add bridge link properties
2015-07-23 21:07:57 +02:00
Susant Sahani
eb7ff4dd5f networkd: add bridge link properties
new bridge properties

br.network

[Match]
Name=enp0s25

[Network]
Bridge=br-test

[Bridge]
Cost=332
BPDUGuard = true
HairPin = true
FastLeave = true
RootBlock = true
UnicastFlood = true
2015-07-23 23:31:58 +05:30
Tom Gundersen
6709eb94f9 resolve: transaction - stop processing packet when found to be invalid
We were stopping the transaction, but we need to stop processing the packet alltogether.
2015-07-23 18:06:50 +02:00
Tom Gundersen
0e03ade57e resolved: packet - fix segfault in truncate()
A size_t was being accessed as a char* due to the order of arguments being inverted.
2015-07-23 18:06:50 +02:00
Tom Gundersen
8e6edc490c resolved: rr - ignore pseudo types in NSEC(3) bitmaps 2015-07-23 18:06:50 +02:00
Tom Gundersen
0bbd72b2f3 resolved: rr - fix parsing of NSEC3
We were appending rather than reading the bitmap.
2015-07-23 18:06:50 +02:00
Tom Gundersen
89492aaf99 resolved: rr - don't read past end of RR when parsing NSEC(3)
We can never read past the end of the packet, so this seems impossible
to exploit, but let's error out early as reading past the end of the
current RR is clearly an error.

Found by Lennart, based on patch by Daniel.
2015-07-23 18:06:50 +02:00
Tom Gundersen
549c1a2564 resolved: rr - SSHFP contains the fingerprint, not the key
Rename the field to make this clearer.
2015-07-23 18:01:50 +02:00
Tom Gundersen
f1d178cce1 resolved: packet - fail on invalid zero-length data
Most blobs (keys, signatures, ...) should have a specific size given by
the relevant algorithm. However, as we don't use/verify the algorithms
yet, let's just ensure that we don't read out zero-length data in cases
where this does not make sense.

The only exceptions, where zero-length data is allowed are in the NSEC3
salt field, and the generic data (which we don't know anything about,
so  better not make any assumptions).
2015-07-23 18:01:17 +02:00
Lennart Poettering
370a2172ac bitmap: various clean-ups
a) use memcmp() to compare bitmaps efficiently

b) use UINT64_C() macro instead of ULL suffixes to get right suffix for
   uint64_t constants

c) add a few assert()s

d) when comparing integers with 0 we generally try to make this explicit
   with "!= 0".

e) remove redundant bitmap_isset() if check, as we don't have it in
   bitmap_isset() either.

f) It should be fine to invoke bitmap_unset() on a NULL bitmap
2015-07-23 15:57:54 +02:00
Tom Gundersen
b96c778a00 Merge pull request #669 from poettering/dns-rr-memdup
resolve: unify memdup() code when parsing RRs
2015-07-23 12:34:34 +02:00
Susant Sahani
54a9d20c47 networkd: ip6gre add support for flowlabel 2015-07-23 15:45:38 +05:30
Susant Sahani
0c1f248ef6 sd-netlink: add bridge NL params 2015-07-23 15:06:03 +05:30
Susant Sahani
38a0245fb2 Add bridge NL params to missing.h 2015-07-23 15:06:03 +05:30
Tom Gundersen
f4955d321e Merge pull request #677 from zonque/bitmap2
basic: bitmap: use uint64_t instead if long long unsigned
2015-07-23 11:35:55 +02:00
Daniel Mack
56511eca83 Merge pull request #674 from ssahani/tunnel
ip6 tunnel: add support for DSCP
2015-07-23 11:00:15 +02:00
David Herrmann
8cd4eb791a Merge pull request #537 from poettering/nss-mymachines-userns
Hook up container userns with nss-mymachines
2015-07-23 09:53:47 +02:00
Daniel Mack
e25aa3453b Merge pull request #663 from poettering/tmpfiles-chattr-enotty
tmpfiles: downgrade errors when a file system does not support file a…
2015-07-23 09:12:43 +02:00
Daniel Mack
33b63dd732 Merge pull request #673 from poettering/dns-packet-append-type-window
resolved: make sure we alway initialize *start in dns_packet_append_t…
2015-07-23 08:53:36 +02:00
Daniel Mack
848d08b74e basic: bitmap: use uint64_t instead if long long unsigned
long long unsigned is always 64 bit wide, so use a more readable type.
2015-07-23 08:49:58 +02:00
Daniel Mack
2d3102cc40 Merge pull request #672 from poettering/bitmap-isclear
bitmap: bitmap_clear()
2015-07-23 08:49:14 +02:00
Susant Sahani
ec2a3e3af2 networkd: ip6 tunnel add DSCP
This patch adds support for setting the
DSCP field in the ip6 tunnel.

when set it inherits DSCP field between inner and outer header.
2015-07-23 09:52:24 +05:30
Lennart Poettering
6fa919016a resolved: make sure we alway initialize *start in dns_packet_append_type_window() 2015-07-23 04:54:35 +02:00
Lennart Poettering
05fb03beee bitmap: bitmap_clear()
No need to actually reset the bitmap, we can just truncate it back zero
size. That not only makes bitmap_clear() quicker, but also subsequent
bitmap_isclear().
2015-07-23 04:51:57 +02:00
Lennart Poettering
f5430a3ef3 resolve: unify memdup() code when parsing RRs
Let's make dns_packet_read_public_key() more generic by renaming it to
dns_packet_read_memdup() (which more accurately describes what it
does...). Then, patch all cases where we memdup() RR data to use this
new call.

This specifically checks for zero-length objects, and handles them
gracefully. It will set zero length payload fields as a result.

Special care should be taken to ensure that any code using this call
can handle the returned allocated field to be NULL if the size is
specified as 0!
2015-07-23 04:50:19 +02:00
Mike Gilbert
3dce891505 nspawn: Don't pass uid mount option for devpts
Mounting devpts with a uid breaks pty allocation with recent glibc
versions, which expect that the kernel will set the correct owner for
user-allocated ptys.

The kernel seems to be smart enough to use the correct uid for root when
we switch to a user namespace.

This resolves #337.
2015-07-22 22:34:57 -04:00
Tom Gundersen
f7d51e1c19 Merge pull request #667 from poettering/dns-rr-memleak
resolve: fix two minor memory leaks
2015-07-23 03:58:47 +02:00
Lennart Poettering
2c1fb4f712 resolve: fix two minor memory leaks
strv_extend() already strdup()s internally, no need to to this twice.
(Also, was missing OOM check...).

Use strv_consume() when we already have a string allocated whose
ownership we want to pass to the strv.

This fixes 50f1e641a9.
2015-07-23 03:26:01 +02:00
Lennart Poettering
3ea1453c42 resolve: drop dns_scope_good_dns_server()
It's not used anymore since 29815b6c60,
hence let's remove it from the sources.
2015-07-23 03:10:42 +02:00
Daniel Mack
6aafa9483d Merge pull request #665 from poettering/reword-journal-size-msg
journal: reword msg about enforced size limits a bit
2015-07-23 02:32:29 +02:00
Lennart Poettering
da2e288bbc journal: reword msg about enforced size limits a bit
http://lists.freedesktop.org/archives/systemd-devel/2015-July/033574.html
2015-07-23 02:04:19 +02:00
Daniel Mack
ebbc7bc91d Merge pull request #632 from Stebalien/cgls-nspawn
Machines can also be services
2015-07-23 00:43:00 +02:00
Steven Allen
065d629611 cgls: machines can also be services
This makes `systemd-cgls -M <machine name>` work with nspawn containers in
systemd 222.
2015-07-22 17:53:14 -04:00
Lennart Poettering
ad75a97f7d tmpfiles: downgrade errors when a file system does not support file attributes
This downgrades errors from setting file attributes via tmpfiles to
warnings and makes them non-fatal.

Also, as a special case, if a file system does not support file
attributes at all, then the message is downgraded to debug, so that it
is not seen at all.

With this change reiserfs should not see any messages at all anymore
(since it apparently does not implement file attributes at all), but XFS
will still get a warning but no failure. The warning is something the
XFS kernel folks should fix though, by adjusting their file attributes
behaviour to be identical to ext234's.

Fixes #560.
2015-07-22 22:02:14 +02:00
Michal Schmidt
42328446f4 Merge pull request #660 from michich/in-set
improve IN_SET macro
2015-07-22 19:57:03 +02:00
Michal Schmidt
77247cba3e basic: more optimizable IN_SET macro
Making the array static allows gcc -O2 to generate smaller code:

"size systemd" before:
   text    data     bss     dec     hex filename
1377286  128608    2632 1508526  1704ae systemd

After:
   text    data     bss     dec     hex filename
1374326  128572    2664 1505562  16f91a systemd

(IN_SET still results in worse generated code than using
 "x == FOO || x == BAR || ...". I don't think we'll be able to match
 that with the C preprocessor.)

This change limits the use of IN_SET to sets with constant elements. All
present callers use constants. The compiler would report an "initializer
element is not constant" error otherwise.
2015-07-22 19:31:17 +02:00
Michal Schmidt
249a2737ba basic: better readable IN_SET macro
Putting the set elements in an array variable and using ELEMENTSOF makes
it clearer what's going on.

Incidentally, it also makes gcc -O2 generate slightly smaller code:
"size systemd", before:
   text    data     bss     dec     hex filename
1378318  128608    2632 1509558  1708b6 systemd

After:
   text    data     bss     dec     hex filename
1377286  128608    2632 1508526  1704ae systemd
2015-07-22 19:29:05 +02:00
Lennart Poettering
d21f001496 Merge pull request #654 from ssahani/nl
network: Add tunnel params
2015-07-22 19:06:36 +02:00
Tom Gundersen
bd37a92297 Merge pull request #647 from michich/job-logging
Job logging fixes and improvements
2015-07-22 14:17:12 +02:00
Susant Sahani
8aee0f1ff3 sd-netlink: add tunnel params 2015-07-22 15:01:58 +05:30
Susant Sahani
66f4bc7795 Tunnel NL params: Add to missing.h 2015-07-22 15:01:58 +05:30
Zbigniew Jędrzejewski-Szmek
01f61d331b ata_id: unreverse WWN identifier
An endianness conversion was lost in 6024a6e302.
Restore it. Now ata_id and scsi_id output match.

https://bugzilla.redhat.com/show_bug.cgi?id=1227503
2015-07-22 00:24:15 -04:00
Michal Schmidt
3567afa5b4 udev: unify reporting of invalid cmdline keys
This way it does not need distinct string literals and it also preserves
the "rd." prefix.
2015-07-21 20:07:34 +02:00
Michal Schmidt
e00f5bddde udev: fix crash with invalid udev.log-priority
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1245293
2015-07-21 20:07:34 +02:00
Michal Schmidt
64f575d2ab core: adjust job completion message log levels
We do not print all non-OK job completion status messages to the console
in red, because not all of them are plain errors. We do however log the
same messages as LOG_ERR.

Differentiate the log levels by deducing them from the job result in a
way that more or less matches the color of the console message.
2015-07-21 19:28:17 +02:00
Michal Schmidt
b81bbe5355 core: small refactor of job completion logging
Joins three log_struct() calls into one.
2015-07-21 19:24:20 +02:00
Michal Schmidt
4f29c6fea6 core: log completion of remaining job types
JOB_RESTART and failed JOB_VERIFY_ACTIVE completions were printed to
console but not to the log.
2015-07-21 19:24:20 +02:00
Michal Schmidt
30961fa300 core: do not log done failed-condition jobs as if unit started
It is misleading to see "Started foo." in the log when the unit's
condition was false.
2015-07-21 19:24:20 +02:00
Michal Schmidt
c382d69e3d core: remove generic job completion messages from unit vtables
These units' message format strings are identical to the generic
strings. Since we can always rely on the fallback, these are now
redundant.
2015-07-21 19:24:20 +02:00
Michal Schmidt
aa49ab5f22 core: try harder to get job completion messages too
This is similar to "core: always try harder to get unit status
message format string", but for job completion status messages.
It makes generic status messages applicable for printing to the console.
And it rewrites the functions in a more table-based style.
2015-07-21 19:24:04 +02:00
Michal Schmidt
b5bf308ba5 core: unit_get_status_message_format() never returns NULL
unit_get_status_message_format() is used only with one of JOB_START,
JOB_STOP, JOB_RELOAD, all of which have fallback message strings
defined, so the function may never return NULL.
2015-07-21 18:48:45 +02:00
Daniel Mack
0a327854f8 bootchart: fix negative 'timeleft' condition
Fix the overrun case in sample acquistion and negative number calculations.

Reported by Stefan Sauer.

Fixes #642
2015-07-21 18:37:06 +02:00
Daniel Mack
81b72a962f user-sessions: fix write_string_file() fallout
WRITE_STRING_FILE_ATOMIC is only valid if WRITE_STRING_FILE_CREATE is also
given. IOW, an atomic file write operation is only possible when creating a
file is also being asked for.

This is a regression from the recent write_string_file() rework.
2015-07-21 15:59:02 +02:00
Daniel Mack
6f566391a4 logind: fix write_string_file() fallout
WRITE_STRING_FILE_ATOMIC is only valid if WRITE_STRING_FILE_CREATE is also
given. IOW, an atomic file write operation is only possible when creating a
file is also being asked for.

This is a regression from the recent write_string_file() rework.
2015-07-21 15:58:59 +02:00
Michal Schmidt
a85ca902c9 core: always try harder to get unit status message format string
The starting/stopping messages are printed to the console only if the
corresponding format string is defined in the unit's vtable. To avoid
excessive messages on the console, the unit types whose start/stop
jobs are instantaneous had the format strings intentionally undefined.
When logging the same event to the journal, a fallback to generic
Starting/Stopping/Reloading messages is used.

The problem of excessive console messages with instantaneous jobs
is already resolved in a nicer way ("core: fix confusing logging of
instantaneous jobs"), so there's no longer a need to have two ways of
getting the format strings. Let's fold them into one function with
the fallback to generic message strings.
2015-07-21 15:09:12 +02:00
Michal Schmidt
2d018ae23b core: correct return value from reload methods
Return 1 from *_reload() methods to signify "we did something", just
like in *_start(). This causes "Reloading foo..." messages to be logged.
"Reloaded foo." messages are already logged.
2015-07-21 15:09:12 +02:00
Michal Schmidt
d1a34ae9c2 core: fix confusing logging of instantaneous jobs
For instantaneous jobs (e.g. starting of targets, sockets, slices, or
Type=simple services) the log shows the job completion
before starting:

        systemd[1]: Created slice -.slice.
        systemd[1]: Starting -.slice.
        systemd[1]: Created slice System Slice.
        systemd[1]: Starting System Slice.
        systemd[1]: Listening on Journal Audit Socket.
        systemd[1]: Starting Journal Audit Socket.
        systemd[1]: Reached target Timers.
        systemd[1]: Starting Timers.
        ...

The reason is that the job completes before the ->start() method returns
and only then does unit_start() print the "Starting ..." message.
The same thing happens when stopping units.

Rather than fixing the order of the messages, let's just not emit the
Starting/Stopping message at all when the job completes instantaneously.
The job completion message is sufficient in this case.
2015-07-21 15:09:12 +02:00
Susant Sahani
407af9dd89 networkd: ip6 tunnel add support for flowlabel
Add Pv6 Flow Label support. The 20-bit Flow Label field in the IPv6
header[RFC2460] is used by a  node to label packets of a flow.
2015-07-21 10:06:44 +05:30
Tom Gundersen
e89f2a98e6 Merge pull request #625 from ssahani/tun2
sd-netlink: add tunnel parameters
2015-07-20 22:30:18 +02:00
Jose Carlos Venegas Munoz
b1da143f2a sd-boot:Show stub cmdline when edit
If Linux efi stub is used, embedded cmdline in efi stub is
not shown. As a result, it is required to rewrite all the
line, if is only required to modify it. This behavior only
happen using Linux efi stub.

This patch allows boot loader to show embedded cmdline when
'e' key is pressed to edit boot loader options.
2015-07-20 14:56:02 -05:00
Tom Gundersen
3083663e5d Merge pull request #630 from namhyung/use-isempty
sd-bus: use isempty() consistently
2015-07-20 18:08:13 +02:00
Tom Gundersen
31053e929e Merge pull request #549 from ssahani/dhcp
networkd: allow hostname override
2015-07-20 17:58:45 +02:00
Namhyung Kim
d41eee127a sd-bus: use isempty() consistently
Instead of open-coding, use isempty() to check NULL or empty string
for consistency.
2015-07-20 23:41:18 +09:00
Susant Sahani
56bf3853b4 add NL parameters to missing.h 2015-07-20 10:17:50 +05:30
Susant Sahani
79e27dbcb1 sd-netlink: add tunnel NL parameters 2015-07-20 10:17:14 +05:30
Tom Gundersen
cdf6f5ae04 basic: bitmap - complete fix for bitshift overflow
The bug found by David existed in several places, fix them all. Also
extend the tests to cover these cases.
2015-07-17 18:59:16 +02:00
Tom Gundersen
511ed79917 Merge pull request #611 from dvdhrm/bitmap-fixes
Bitmap fixes
2015-07-17 12:33:49 +02:00
David Herrmann
724dd73d1b Merge pull request #607 from ssahani/vxlan1
networkd: move config parsers to specific header files
2015-07-17 12:26:32 +02:00
David Herrmann
a933570dea bitmap: avoid 32bit integer overflow in shift
We really must use 64bit integers to calculate long-long shifts.
Otherwise, we will never get higher masks than 2^31.
2015-07-17 12:19:06 +02:00
David Herrmann
22cedfe15f bitmap: allow bitmap_iterate() on NULL bitmap
Make sure we properly treat NULL bitmaps as empty. Right now, we don't
(which really looks like a typo).
2015-07-17 12:18:13 +02:00
Umut Tezduyar Lindskog
97b845b0fc cgtop: include missing signal.h for sigwinch 2015-07-17 10:39:06 +02:00
David Herrmann
2810332843 logind: never select closing sessions for a VT
If a session is in closing state (and already got rid of its VT), then
never re-select it for that VT. There is no reason why we should grant
something to a session that is already going away *AND* already got rid
of exactly that.
2015-07-16 18:46:12 +02:00
David Herrmann
da770c386f logind: prefer new sessions over older ones on VT switches
Our seat->positions[] array keeps track of the 'preferred' session on a
VT. The only situation this is used, is to select the session to activate
when a VT is activated. In the normal case, there's only one session per
VT so the selection is trivial.

Older greeters, however, implement take-overs when they start sessions on
the same VT that the greeter ran on. We recently limited such take-overs
to VTs where a greeter is running on, to force people to never share VTs
in new code that is written.

For legacy reasons, we need to be compatible to old greeters, though.
Hence, we allow those greeters to implement take-over. In such take-overs,
however, we should really make sure that the new sessions gets preferred
over the old one under all circumstances. Hence, make sure we override
the previous preferred session with a new session.
2015-07-16 18:23:55 +02:00
Susant Sahani
3b50bf800e networkd: move config_parse_tunnel_address
move config_parse_tunnel_address from networkd.h to

tunnel specific file networkd-netdev-tunnel.h
2015-07-16 20:16:53 +05:30
Susant Sahani
a94d64d256 networkd: move config_parse_vxlan_group_address
move config_parse_vxlan_group_address from
networkd.h to networkd-netdev-vxlan.h
2015-07-16 20:14:05 +05:30
David Herrmann
e23bc0e7ca bus-proxy: never pass on unmatched broadcasts
The lovely libvirtd goes into crazy mode if it receives broadcasts that
it didn't subscribe to. With bus-proxyd, this might happen in 2 cases:

    1) The kernel passes us an unmatched signal due to a false-positive
       bloom-match.

    2) We generate NameOwnerChanged/NameAcquired/NameLost locally even
       though the peer didn't subscribe to it.

dbus-daemon is reliable in what signals it passes on. So make sure we
follow that style. Never ever send a signal to a local peer if it doesn't
match an installed filter of that peer.
2015-07-16 16:36:35 +02:00
David Herrmann
9afd2b46f2 sd-bus: add new test for NameAcquired via proxy/dbus-daemon
This adds test-bus-proxy which should be used to test correct behavior of
systemd-bus-proxyd. The first test that was added is to verify we actually
receive NameAcquired signals for ourselves on bus-connect.
2015-07-16 16:35:09 +02:00
David Herrmann
2ec7c4279e Merge pull request #602 from teg/bitmap-iterator
bitmap: use external iterator
2015-07-16 15:12:26 +02:00
David Herrmann
1845880757 sd-bus: properly match ID changes
If the caller does not specify arg1 for NameOwnerChanged matches, we
really must take the ID from arg2 or arg3, if provided. They are
guaranteed to be identical to arg1 if either is supplied, but there is no
strict requiredment that arg1 is supplied. Hence, make sure to always
take the more restrictive match. Otherwise, we install rather wide
matches without anyone requiring them.
2015-07-16 15:01:52 +02:00
David Herrmann
1af5f746d5 sd-bus: destination-matches cannot match NameOwnerChanged
Make sure we don't install NameOwnerChanged matches if the caller passed
a destination='' match (except if it is the broadcast address). Per spec,
all NameOwnerChanged signals are broadcasts.

Only the NameLost/NameAcquired signals are unicasts, but those are never
received through sd-bus. Instead, the bus-proxy synthesizes them and it
already installs proper matches for them.
2015-07-16 15:01:52 +02:00
David Herrmann
4f1d774135 sd-bus: fix invalid stack access on test-bus-marshal
Make sure we actually parse "unsigned long long" if we encode a uint64_t.
Otherwise, we will get random data from the stack.
2015-07-16 15:01:52 +02:00
Tom Gundersen
cb57dd4159 bitmap: use external iterator
Reuse the Iterator object from hashmap.h and expose a similar API.

This allows us to do

{
    Iterator i;
    unsigned n;

    BITMAP_FOREACH(n, b, i) {
        Iterator j;
        unsigned m;

        BITMAP_FOREACH(m, b, j) {
            ...
        }
    }
}

without getting confused. Requested by David.
2015-07-16 14:11:12 +02:00
David Herrmann
443a559813 sd-bus: fix gvariant structure encoding
In gvariant, all fixed-size objects need to be sized a multiple of their
alignment. If a structure has only fixed-size members, it is required to
be fixed size itself. If you imagine a structure like (ty), you have an
8-byte member followed by an 1-byte member. Hence, the overall inner-size
is 9. The alignment of the object is 8, though. Therefore, the specs
mandates final padding after fixed-size structures, to make sure it's
sized a multiple of its alignment (=> 16).

On the gvariant decoder side, we already account for this in
bus_gvariant_get_size(), as we apply overall padding to the size of the
structure. Therefore, our decoder correctly skips such final padding when
parsing fixed-size structure.

On the gvariant encoder side, however, we don't account for this final
padding. This patch fixes the structure and dict-entry encoders to
properly place such padding at the end of non-uniform fixed-size
structures.

The problem can be easily seen by running:
    $ busctl --user monitor
and
    $ busctl call --user org.freedesktop.systemd1 / org.foobar foobar "(ty)" 777 8

The monitor will fail to parse the message and print an error. With this
patch applied, everything works fine again.

This patch also adds a bunch of test-cases to force non-uniform
structures with non-pre-aligned positions.

Thanks to Jan Alexander Steffens <jan.steffens@gmail.com> for spotting
this and narrowing it down to non-uniform gvariant structures. Fixes #597.
2015-07-16 11:23:34 +02:00
Daniel Mack
42921716a4 Merge pull request #588 from teg/resolved-nsec
resolved: add basic NSEC and NSEC3 support
2015-07-15 17:27:35 -04:00
David Herrmann
7d67077f78 sd-bus: fix object tree to be deeper than 2 levels
So right now our object-tree is limited to 2 levels at most
('/' and '/foo/...../bar'). We never link any intermediate levels, even
though that was clearly the plan. Fix the bus_node_allocate() helper to
actually link all intermediate nodes, too, not just the root node.

This fixes a simple inverse ptr-diff bug.

The downside of this fix is that we clearly never tested (nor used) the
object tree in any way. The only reason that the introspection works is
that our enumerators shortcut the object tree.

Lets see whether that code actually works..

Thanks to: Nathaniel McCallum <nathaniel@themccallums.org>
..for reporting this. See #524 for an actual example code.
2015-07-15 14:39:12 +02:00
David Herrmann
bf4c113e17 sd-device: never return NULL+0
It is highly confusing if a getter function returns 0, but the value is
set to NULL. This, right now, triggers assertions as code relies on the
returned values to be non-NULL.

Like with sd-bus-creds and friends, return 0 only if a value is actually
available.

Discussed with Tom, and actually fixes real bugs as in #512.
2015-07-15 12:31:21 +02:00
David Herrmann
ab822b624b sd-boot: ignore missing /etc/machine-id
If /etc/machine-id is missing (eg., gold images), we should not fail
installing sd-boot. This is a perfectly fine use-case and we should simply
skip installing the default loader config in that case.
2015-07-15 12:04:31 +02:00
Tom Gundersen
5d45a88084 resolved: rr - add NSEC3 support
Needed for DNSSEC.
2015-07-14 22:17:24 +02:00
Tom Gundersen
919a7f5f1c basic: util - add base32hexmem() function similar to hexmem()
This implements more of RFC4648.
2015-07-14 22:14:08 +02:00
Tom Gundersen
50f1e641a9 resolved: rr - add NSEC support
Needed for DNSSEC.
2015-07-14 21:53:10 +02:00
Tom Gundersen
5ffa42cb80 basic: add a Bitmap implementation
For when a Hashmap is overkill.
2015-07-14 21:53:10 +02:00
Tom Gundersen
2a2953b355 basic: util - fix memleak on error in unbase64mem() 2015-07-14 21:14:45 +02:00
Tom Gundersen
dad8f7f2b6 Merge pull request #538 from mischief/multiple-routers
sd-dhcp-lease: fix handling of multiple routers

We only support one router, but in case more than one is given, we now ignore subsequent ones, rather than fall over.
2015-07-14 20:17:11 +02:00
Daniel Mack
9ecec7d766 Merge pull request #586 from teg/resolved-rrs-3
resolved: minor improvements to RR handling
2015-07-14 13:43:18 -04:00
Tom Gundersen
d23a27a964 resolved: improve printing of unknown RRs
This implements the recommendations from RFC3597.
2015-07-14 19:36:35 +02:00
Daniel Mack
c0d645b51f Merge pull request #585 from teg/resolved-harden-2
resolved: harden
2015-07-14 13:26:16 -04:00
David Herrmann
ca970016b7 Merge commit 'refs/pull/436/head' of https://github.com/systemd/systemd
This merges:
  sd-netlink: respect attribute type flags

..fixing a conflict due to a typo fix.
2015-07-14 19:19:39 +02:00
Tom Gundersen
abf126a355 resolved: rr - add DS support
Needed for DNSSEC.
2015-07-14 19:16:16 +02:00
Tom Gundersen
7c6423e191 resolved: rr - print formated timestamps in RRSIG 2015-07-14 19:16:12 +02:00
Tom Gundersen
d20b1667db resolved: use one UDP socket per transaction
We used to have one global socket, use one per transaction instead. This
has the side-effect of giving us a random UDP port per transaction, and
hence increasing the entropy and making cache poisoining significantly
harder to achieve.

We still reuse the same port number for packets belonging to the same
transaction (resent packets).
2015-07-14 18:50:57 +02:00
Tom Gundersen
29815b6c60 resolved: implement RFC5452
This improves the resilience against cache poisoning by being stricter
about only accepting responses that match precisely the requst they
are in reply to.

It should be noted that we still only use one port (which is picked
at random), rather than one port for each transaction. Port
randomization would improve things further, but is not required by
the RFC.
2015-07-14 18:50:57 +02:00
Tom Gundersen
8300ba218e resolved: pin the server used in a transaction
We want to discover information about the server and use that in when crafting
packets to be resent.
2015-07-14 18:50:53 +02:00
Daniel Mack
73b836e22f Merge pull request #530 from dvdhrm/resolve-host-dbus
resolve-host: enable dbus-activation
2015-07-14 12:41:29 -04:00
Tom Gundersen
91b14d6ff3 resolved: reference count the dns servers
We want to reference the servers from their active transactions, so make sure
they stay around as long as the transaction does.
2015-07-14 12:03:04 +02:00
Tom Gundersen
a0166609f7 resolved: packet - ensure there is space for IP+UDP headers
Currently we only make sure our links can handle the size of the payload witohut
taking the headers into account.
2015-07-14 12:03:04 +02:00
Susant Sahani
f5f07dbf06 networkd: tap add support for vnet_hdr
This patch adds support to configure IFF_VNET_HDR flag
for a tap device. It allows whether sending and receiving
large pass larger (GSO) packets. This greatly increases the
achievable throughput.
2015-07-14 14:10:56 +05:30
Tom Gundersen
1bf968f363 resolved: rr - print DNSKEY and RRSIG in base64
As mandated by RFC4034.
2015-07-14 01:18:51 +02:00
Daniel Mack
818ef443f0 resolved: make LLMNR checks conditional
Make all LLMNR related packet inspections conditional to p->protocol.
Use switch-case statements while at it, which will make future additions
more readable.
2015-07-13 11:28:30 -04:00
Daniel Mack
8b757a3861 resolved: separate LLMNR specific header bits
The C and T bits in the DNS packet header definitions are specific to LLMNR.
In regular DNS, they are called AA and RD instead. Reflect that by calling
the macros accordingly, and alias LLMNR specific macros.

While at it, define RA, AD and CD getters as well.
2015-07-13 11:28:29 -04:00
Daniel Mack
22a37591ed resolved: use a #define for LLMNR port
De-duplicate some magic numbers.
2015-07-13 11:28:29 -04:00
Daniel Mack
5f402ae84b resolved: move LLMNR related functions into separate file 2015-07-13 11:28:29 -04:00
Beniamino Galvani
e43a8393ea dhcp: add support for vendor specific DHCP option
This adds support for option 43 (Vendor Specific Information) to
libsystemd-network DHCP code. The option carries an opaque object of n
octets, interpreted by vendor-specific code on the clients and
servers.

[@zonque: adopted to new unhexmem() API]
2015-07-12 14:26:32 -04:00
Tom Gundersen
13a5d76b32 basic: util - add base64mem() function similar to hexmem()
This implements RFC4648 for a slightly more compact representation of
binary data compared to hex (6 bits per character rather than 4).
2015-07-12 19:24:14 +02:00
Tom Gundersen
30494563f2 basic: util - fix errorhandling in unhexmem()
We were ignoring failures from unhexchar, which meant that invalid
hex characters were being turned into garbage rather than the string
rejected.

Fix this by making unhexmem return an error code, also change the API
slightly, to return the size of the returned memory, reflecting the
fact that the memory is a binary blob,and not a string.

For convenience, still append a trailing NULL byte to the returned
memory (not included in the returned size), allowing callers to
treat it as a string without doing a second copy.
2015-07-12 19:11:34 +02:00
Tom Gundersen
39fced0162 Merge pull request #558 from poettering/logind-bus-policy
logind: bring bus policy up-to-date
2015-07-12 11:44:45 +02:00
Nick Owens
a05185279b sd-dhcp-lease: fix handling of multiple routers
currently if a dhcp server sends more than one router, sd-dhcp-lease
does not copy the ip because it assumes it will only ever be 4 bytes. a
dhcp server could send more than one ip in the router list, so we should
copy the first one and ignore the rest of the bytes.
2015-07-11 15:37:01 -07:00
Lennart Poettering
6b62bbbc7b logind: some firmware implementations remove OsIndications if it is unset
We shouldn't fall over that, and just assume it is 0 in this case.

Fixes #499.
2015-07-11 17:32:25 -03:00
Lennart Poettering
559b5cc273 logind: bring bus policy up-to-date
A while back we opened up all of logind's bus calls to unprivileged
users, via PK. However, the dbus1 policy wasn't updated accordingly.

With this change, the dbus1 policy is opened up for all bus calls that
should be available to unprivileged clients.

(also rearranges some calls in the vtable, to make more sense, and be in
line with the order in the bus policy file)

Fixes #471.
2015-07-11 17:03:42 -03:00
Daniel Mack
6f9d58d87f Merge pull request #551 from poettering/fopen-temporary-noerrno
util: make sure we don't clobber errno in error path
2015-07-11 13:35:50 -04:00
Daniel Mack
0dc705bee2 Merge pull request #552 from poettering/path-is-mount-point-simplification
basic: simplify path_is_mount_point() a bit
2015-07-11 13:35:24 -04:00
Lennart Poettering
10c03e9e82 basic: simplify path_is_mount_point() a bit
This removes two uses of the ternary operator.
2015-07-11 14:20:44 -03:00
Lennart Poettering
64ee7ab462 util: make sure we don't clobber errno in error path 2015-07-11 14:19:36 -03:00
Daniel Mack
f2db89c99c Merge pull request #548 from vcaputo/fix_path_state_debug_msg
core: include unit in path state transition debug logging.
2015-07-10 20:42:32 -04:00
Vito Caputo
3541bf1f07 core: include unit in path state transition debug logging. 2015-07-10 16:40:46 -07:00
David Herrmann
e6494a07cb logind: rename 'pos' to 'position'
Spell out the proper name. Use 'pos' over 'position', and also update the
logind state file to do the same. Note that this breaks live updates.
However, we only save 'POSITION' on non-seat0, so this shouldn't bother
anyone for real. If you run multi-seat setups, you better restart a
machine on updates, anyway.
2015-07-10 15:25:44 +02:00
David Herrmann
cc85d56245 logind: allow greeters to take over VTs
Make sure a greeter can forcefully spawn a session on a VT that is
in-use. A recent patch prevented this (this used to be possible for all
session types) as it is highly fragile. However, as it turns out,
greeters seem to rely on that feature. Therefore, make sure we allow it
explicitly for greeters.
2015-07-10 15:25:43 +02:00
Susant Sahani
a7d0ef446e networkd: DHCP override hostname
This patch enhances the DHCP client to send the hostname
reference
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021550.html

Tested with
Example conf:

[Match]
Name=eth1

[Network]
DHCP=v4

[DHCP]
SendHostname=true
Hostname=test
2015-07-10 15:42:27 +05:30
Lennart Poettering
c01ff965b4 nss-mymachines: map userns users of containers to real user names
Given a container "foo", that maps user id $UID to container user, using
user namespaces, this NSS module extenstion will now map the $UID to a
name "vu-foo-$TUID" for the translated UID $UID.

Similar, userns groups are mapped to "vg-foo-$TGID" for translated GIDs
of $GID.

This simple change should make userns users more discoverable. Also,
given that many tools like "adduser" check NSS before allocating a UID,
should lower the chance of UID range conflicts between tools.
2015-07-09 14:46:20 -03:00
Lennart Poettering
43694a8cc7 Merge pull request #531 from dvdhrm/boot-buildid
boot: use BUILD_ID if VERSION_ID is not available
2015-07-09 11:50:03 -03:00
Lennart Poettering
0aa7a4c225 Merge pull request #532 from dvdhrm/bus-managed-root
sd-bus: include queried path in GetManagedObjects
2015-07-09 11:47:55 -03:00
cee1
ac5213569c basic/util.c fopen_temporary(): close fd if failed 2015-07-09 10:41:23 -04:00
Lennart Poettering
d711ea2b95 Merge pull request #529 from dvdhrm/bus-slot-description
sd-bus: sd_bus_slot_get_description() should return const strings
2015-07-09 11:38:11 -03:00
David Herrmann
92d16a53e3 sd-bus: include queried path in GetManagedObjects
If GetManagedObjects is called on /foo/bar, then it should also include
the object /foo/bar, if it exists. Right now, we only include objects
underneath /foo/bar/.

This follows the behavior of existing dbus implementations.

Obsoletes #527 and fixes #525. Reported by: Nathaniel McCallum
2015-07-09 13:30:16 +02:00
David Herrmann
59658d1958 boot: use BUILD_ID if VERSION_ID is not present
According to os-release(5), VERSION_ID is not mandatory and BUILD_ID only
needs to be unique underneath VERSION_ID. Therefore, assuming a missing
VERSION_ID field means 'empty', we can rely on BUILD_ID to be unique.

Use BUILD_ID if VERSION_ID is not present. This way, rolling-release
distros can still provide a proper os-release entry without crafting
random VERSION_ID strings.

This fixes #186.
2015-07-09 13:07:27 +02:00
David Herrmann
d8c64b7f90 boot: fix memleaks in os-release parser
There is no guarantee that the os-release section contains each key only
once, nor any guarantee that all keys are present. Make sure we properly
free memory in both cases.

Not that it matters much, as we're short-living, anyway. But correct code
is always nicer to read..
2015-07-09 13:02:54 +02:00
David Herrmann
fbbf7a90cc resolve-host: enable dbus-activation
Right now, systemd-resolve-host fails if resolved is not running.
However, resolved supports bus-activation (at least on kdbus) just fine.
Enable this so we can use resolve-host at all times.

This was disabled right from the beginning, without any comment why.
2015-07-09 11:47:43 +02:00
David Herrmann
839b6dbba9 sd-bus: sd_bus_slot_get_description() should return const strings
All other *_get_description() functions use 'const char**', so make sure
sd_bus_slot_get_description() does the same.

This changes API, but ABI stays stable. I think this is fine, but I
wouldn't mind bumping SONAME.

Reported in #528.
2015-07-09 10:44:04 +02:00
Thomas Blume
06af2a04fb Reload manager defaults at daemon-reload
"systemctl daemon-reload" should also update the manager defaults from
/etc/systemd/system.conf.
For details, see:
http://lists.freedesktop.org/archives/systemd-devel/2015-June/033062.html

Amended to use  manager_set_defaults() as common function.
2015-07-09 10:22:30 +02:00
Thomas Hindoe Paaboel Andersen
207dffe2ff machine: remove unused variables 2015-07-08 23:46:47 +02:00
Lennart Poettering
593b07d25d Merge pull request #516 from utezduyar/consistent-get-callback-return
property callback returns are consistent
2015-07-08 17:24:20 -03:00
Lennart Poettering
1434eb3838 Merge pull request #500 from zonque/fileio
fileio: consolidate write_string_file*()
2015-07-08 17:13:53 -03:00
Lennart Poettering
74d8a0d4b2 Merge pull request #514 from teg/resolved-rrsig-marshal
resolved: fix marshalling of RRSIG records
2015-07-08 13:00:20 -03:00
Tom Gundersen
1161d5d28b Merge pull request #510 from zonque/journal-gatewayd
journal-gatewayd: fix tmpfile logic
2015-07-08 16:16:44 +02:00
Daniel Mack
b9fd7bb60a Merge pull request #501 from keszybz/remove-python-systemd
Remove python-systemd
2015-07-08 09:38:38 -04:00
Umut Tezduyar Lindskog
0f82610153 property callback returns are consistent
It is no different to return 0 over 1 in the property
callback. It is confusing to return 1 which made me think
1 has a special purpose. This way code is consistent with
the rest of the tree.
2015-07-08 14:37:25 +02:00
Tom Gundersen
0b1b17d325 resolved: fix marshalling of RRSIG records
The key tag is 16, not 8 bits.
2015-07-08 13:53:39 +02:00
Daniel Mack
9e19c04f3a journal-gatewayd: fix tmpfile logic
"rw" is not a valid mode string for f*open(). This got broken in
cc02a7b330 ("journal-gatewayd: factor out opening of temp
file").
2015-07-07 17:21:27 -04:00
David Herrmann
b80120c4cb logind: fail on CreateSession if already in session
Right now, if you're already in a session and call CreateSession, we
return information about the current session of yours. This is highy
confusing and a nasty hack. Avoid that, and instead return a commonly
known error, so the caller can detect that.

This has the side-effect, that we no longer override XDG_VTNR and XDG_SEAT
in pam_systemd, if you're already in a session. But this sounds like the
right thing to do, anyway.
2015-07-07 19:38:41 +02:00
David Herrmann
586cd08e1b logind: allow sessions to share a VT if it's a greeter
Old gdm and lightdm start the user-session during login before they
destroy the greeter-session. Therefore, the user-session will take over
the VT from the greeter. We recently prevented this by never allowing
multiple sessions on the same VT. Fix this now, by explicitly allowing
this if the owning session is a GREETER.

Note that gdm no longer behaves like this. Instead, due to wayland, they
always use a different VT for each session. All other login-managers are
highly encouraged to destroy the greeter-session _before_ starting the
user-session. We now work around this, but this will probably not last
forever (and will already have nasty side-effects on the greeter-session).
2015-07-07 19:13:52 +02:00
Zbigniew Jędrzejewski-Szmek
af86c44038 Remove repeated 'the's 2015-07-07 07:40:53 -04:00
Daniel Mack
7e59232f31 Merge pull request #502 from keszybz/login-small-cleanup
Login small cleanup
2015-07-06 20:45:17 -04:00
Zbigniew Jędrzejewski-Szmek
2799e519ca Remove python-systemd
python-system has moved to it's own repository:
https://github.com/systemd/python-systemd
2015-07-06 20:32:12 -04:00
Zbigniew Jędrzejewski-Szmek
fc08079ef2 treewide: fix typos of let's 2015-07-06 20:09:54 -04:00
Zbigniew Jędrzejewski-Szmek
5549398216 login: use normal comparison to zero for integers
! is supposed to be used for booleans and pointers.
2015-07-06 20:04:53 -04:00
Daniel Mack
ad118bda15 tree-wide: fix write_string_file() user that should not create files
The latest consolidation cleanup of write_string_file() revealed some users
of that helper which should have used write_string_file_no_create() in the
past but didn't. Basically, all existing users that write to files in /sys
and /proc should not expect to write to a file which is not yet existant.
2015-07-06 19:27:20 -04:00
Daniel Mack
4c1fc3e404 fileio: consolidate write_string_file*()
Merge write_string_file(), write_string_file_no_create() and
write_string_file_atomic() into write_string_file() and provide a flags mask
that allows combinations of atomic writing, newline appending and automatic
file creation. Change all users accordingly.
2015-07-06 19:19:25 -04:00
Daniel Mack
40beecdb6d fileio: add 'enforce_newline' argument to write_string_stream()
Add a flag to control whether write_string_stream() should always enforce a
trailing newline character in the file.
2015-07-06 17:31:44 -04:00
Kay Sievers
de8763b6d2 get_process_environ: exit early when there is nothing to read 2015-07-06 23:02:47 +02:00
Lennart Poettering
eff8efe671 Merge pull request #492 from richardmaw-codethink/nspawn-automatic-uid-shift-fix-v2
nspawn: Communicate determined UID shift to parent version 2
2015-07-06 20:53:56 +02:00
Lennart Poettering
1f0d969512 networkd: various fixes for the IPv6 privacy extensions support
- Make sure that the IPv6PrivacyExtensions=yes results in
  prefer-temporary, not prefer-public.

- Introduce special enum value "kernel" to leave setting unset, similar
  how we have it for the IP forwarding settings.

- Bring the enum values in sync with the the strings we parse for them,
  to the level this makes sense (specifically, rename "disabled" to
  "no", and "prefer-temporary" to "yes").

- Make sure we really set the value to to "no" by default, the way it is
  already documented in the man page.

- Fix whitespace error.

- Make sure link_ipv6_privacy_extensions() actually returns the correct
  enum type, rather than implicitly casting it to "bool".

- properly size formatting buffer for ipv6 sysctl value

- Don't complain if /proc/sys isn't writable

- Document that the enum follows the kernel's own values (0 = off, 1 =
  prefer-public, 2 = prefer-temporary)

- Drop redundant negating of error code passed to log_syntax()

- Manpage fixes

This fixes a number of issues from PR #417
2015-07-06 20:37:22 +02:00
Daniel Mack
f767522a65 Merge pull request #495 from poettering/forwarding-fix
networkd: be more defensive when writing to ipv4/ipv6 forwarding sett…
2015-07-06 14:22:23 -04:00
Kay Sievers
619b80a1c7 bus-proxyd: fix log message and explain dbus-1 compat matches 2015-07-06 17:58:50 +02:00
Kay Sievers
de865432f8 bus-proxyd: subscribe to unicast signals directed to the proxy connection 2015-07-06 17:47:38 +02:00
David Herrmann
e1141a9622 sd-bus: support matching on destination names
Right now, we never install destination matches on kdbus as the kernel did
not support MATCH rules on those. With the introduction of
KDBUS_ITEM_DST_ID we can now match on destination IDs, so add explicit
support for those.

This requires a recent kdbus module to work. However, there seems to be no
user-space that uses "Destination=''" matches, yet, so old kdbus modules
still work fine (we couldn't find any real user).

This is needed to match on unicast signals in bus-proxy. A followup will
add support for this.
2015-07-06 17:45:33 +02:00
Richard Maw
825d5287d7 nspawn: Communicate determined UID shift to parent
There is logic to determine the UID shift from the file-system, rather
than having it be explicitly passed in.

However, this needs to happen in the child process that sets up the
mounts, as what's important is the UID of the mounted root, rather than
the mount-point.

Setting up the UID map needs to happen in the parent becuase the inner
child needs to have been started, and the outer child is no longer able
to access the uid_map file, since it lost access to it when setting up
the mounts for the inner child.

So we need to communicate the uid shift back out, along with the PID of
the inner child process.

Failing to communicate this means that the invalid UID shift, which is
the value used to specify "this needs to be determined from the file
system" is left invalid, so setting up the user namespace's UID shift
fails.
2015-07-06 13:23:19 +01:00
Lennart Poettering
15dee3f07c networkd: be more defensive when writing to ipv4/ipv6 forwarding settings
1) never bother with setting the flag for loopback devices

2) if we fail to write the flag due to EROFS (which is likely to happen
   in containers where /proc/sys is read-only) or any other error, check
   if the flag already has the right value. If so, don't complain.

Closes #469
2015-07-06 13:41:51 +02:00
Torstein Husebø
aa6b0ac449 treewide: fix typos 2015-07-06 12:51:16 +02:00
Lennart Poettering
dbb60d6944 nspawn: fix indenting 2015-07-06 12:35:51 +02:00
Tom Gundersen
2f75af03c9 Merge pull request #443 from ssahani/lldp
lldp: set correct state for processing
2015-07-06 11:35:12 +02:00
Daniel Mack
b5070ab9d0 Merge pull request #417 from ssahani/ipv6-private
Ipv6 private extensions
2015-07-05 13:08:13 -04:00
Zbigniew Jędrzejewski-Szmek
de7de280b5 login: simplify assignment 2015-07-05 12:02:20 -04:00
David Herrmann
6482446281 core: fix missing bus-util.h include
Whoopsy, forgot to 'git add' this, sorry.
2015-07-05 12:24:29 +02:00
David Herrmann
1f49dffc0f core: don't mount kdbusfs if not wanted
Just like we conditionalize loading kdbus.ko, we should conditionalize
mounting kdbusfs. Otherwise, we might run with kdbus if it is builtin,
even though the user didn't want this.
2015-07-05 11:25:38 +02:00
Susant Sahani
49092e22c2 networkd: Add support for ipv6 privacy extension
This patch add support for ipv6 privacy extensions.

The variable  /proc/sys/net/ipv6/conf/<if>/use_tempaddr

can be changed via the boolean

IPv6PrivacyExtensions=[yes/no/prefer-temporary]

When true enables privacy extensions, but prefer public addresses over
temporary addresses.
prefer-temporary  prefers temporary adresses over public addresses.
Defaults to false.

[Match]
Name=enp0s25

[Network]
IPv6PrivacyExtensions=prefer-temporary
2015-07-05 11:24:31 +05:30
Miguel Bernal Marin
68cc17f131 bootctl: fix sdboot to systemd-boot
sdboot was renamed to systemd-boot

Fixes: e7dd673d1e ("gummiboot/sd-boot/systemd-boot: rename galore")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
2015-07-04 17:03:50 -05:00
David Herrmann
6acc94b621 Merge pull request #485 from poettering/sd-bus-flush-close-unref
sd-bus: introduce new sd_bus_flush_close_unref() call
2015-07-04 12:41:01 +02:00
David Herrmann
a0c8526a73 core: fix coding style in agent-handling
Avoid late bail-out based on a condition. This makes code hard to read.
Instead, reverse the forwarding-condition.
2015-07-04 12:23:39 +02:00
David Herrmann
0a069ce62d core: harden cgroups-agent forwarding
On dbus1, we receive systemd1.Agent signals via the private socket, hence
it's trusted. However, on kdbus we receive it on the system bus. We must
make sure it's sent by UID=0, otherwise unprivileged users can fake it.

Furthermore, never forward broadcasts we sent ourself. This might happen
on kdbus, as we forward the message on the same bus we received it on,
thus ending up in an endless loop.
2015-07-04 12:23:39 +02:00
David Herrmann
1d44f7584a busctl: flush stdout after dumping data
Running `busctl monitor` currently buffers data for several seconds /
kilobytes before writing stdout. This is highly confusing if you dump in a
file, ^C busctl and then end up with a file with data of the last few
_seconds_ missing.

Fix this by explicitly flushing after each signal.
2015-07-04 12:23:39 +02:00
Lennart Poettering
2812dcba85 Merge pull request #484 from xnox/persistent-journal
journal: in persistent mode create /var/log/journal, with all parents.
2015-07-03 20:08:14 +02:00
Lennart Poettering
03976f7b4a sd-bus: introduce new sd_bus_flush_close_unref() call
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
(which writes all unwritten messages out) + sd_bus_close() (which
terminates the connection, releasing all unread messages) +
sd_bus_unref() (which frees the connection).

The combination of this call is used pretty frequently in systemd tools
right before exiting, and should also be relevant for most external
clients, and is hence useful to cover in a call of its own.

Previously the combination of the three calls was already done in the
_cleanup_bus_close_unref_ macro, but this was only available internally.

Also see #327
2015-07-03 19:49:03 +02:00