sd-rtnl: fix size check in sd_rtnl_message_append_string()

(cherry picked from commit 3072eecf3c714e3ed88c882623c40aca15445f64)
sd-rtnl: fix reading of nla type

We must filter out the 'network-byteorder' and 'nested' flags.

(cherry picked from commit 0a2478a918763f73de5d1b78ebb1023c31042583)
sd-bus: properly handle removals of non-existing matches

(cherry picked from commit ef7b6c0190fefaacf6d8f8e1a6dda4ba8b98091b)
nspawn: ignore EEXIST when creating mount point

A combination of commits f3c80515c and 79d80fc14 cause nspawn to
silently fail with a commandline such as:

  # systemd-nspawn -D /build/extra-x86_64 --bind=/usr

strace shows the culprit:

  [pid 27868] writev(2, [{"Failed to create mount point /build/extra-x86_64/usr: File exists", 82}, {"\n", 1}], 2) = 83

(cherry picked from commit 1ab19cb167b32967556eefd8f6d3df0e3de7d67d)
snapshot: return error when snapshot exists

(cherry picked from commit 7cabba07745b388497e8c0fc19b61984167fd474)
sd-dhcp-client: clean up raw socket sd_event_source when creating new UDP socket

The raw socket sd_event_source used for DHCP server solicitations
was simply dropped on the floor when creating the new UDP socket
after a lease has been acquired.  Clean it up properly so we're
not still listening and responding to events on it.

(cherry picked from commit affaa94fc38a980a70534f70f6a6c58a4129b062)
shared/install: avoid prematurely rejecting "missing" units

f7101b7368df copied some logic to prevent enabling masked units, but
also added a check which causes attempts to enable templated units to
fail. Since we know the logic beyond this check will properly handle
units which truly do not exist, we can rely on the unit file state
comparison to suffice for expressing the intent of f7101b7368df.

ref: https://bugs.archlinux.org/task/42616
(cherry picked from commit 0ffce503cd6e5a5ff5ba5cd1cc23684cfb8bb9e3)
sd-dhcp6-client: fix off-by-two error in DUID length

The duid data passed by the caller does not include the DUID type,
but sd_dhcp6_client_set_duid() was treating it like it did.

(cherry picked from commit 393b6f28ecec537f05567c4ec8af8c499d0ea226)
units: order sd-journal-flush after sd-remount-fs

Otherwise we could attempt to flush the journal while /var/log/ was
still ro, and silently skip journal flushing.

The way that errors in flushing are handled should still be changed to
be more transparent and robust.

(cherry picked from commit 1f1926aa5e836caa3bd6df43704aecd606135103)
journald: fix minor memory leak

(cherry picked from commit 99d0966e75a984bed4f117c888ecc93e16e7b7b6)
units: make systemd-journald.service Type=notify

It already calls sd_notify(), so it looks like an oversight.

Without it, its ordering to systemd-journal-flush.service is
non-deterministic and the SIGUSR1 from flushing may kill journald before
it has its signal handlers set up.

https://bugs.freedesktop.org/show_bug.cgi?id=85871
https://bugzilla.redhat.com/show_bug.cgi?id=1159641
(cherry picked from commit a87a38c20196a4aeb56b6ba71d688eefd0b21c30)

Conflicts:
	units/systemd-journald.service.in
udev: Fix parsing of udev.event-timeout kernel parameter.

(cherry picked from commit f671774f52838d35d78e62ddcb781b5b65b3373f)
manager: Ensure user's systemd runtime directory exists.

This mirrors code in dbus.c when creating the private socket and
avoids error messages like:

systemd[1353]: bind(/run/user/603/systemd/notify) failed: No such file or directory
systemd[1353]: Failed to fully start up daemon: No such file or directory

(cherry picked from commit 0c3f25e0c1f028d4da9cc5253abf0322230e6835)
systemctl: when invokes as "reboot -f", sync()

We do this in the clean shutdown path in shutdown.c, hence we should do
is for "reboot -f", too.

(cherry picked from commit 4a3ad39957399c4a30fc472a804e72907ecaa4f9)
shutdown: fix arguments to /run/initramfs/shutdown

Our initrd interface specifies that the verb is in argv[1].
This is where systemd passes it to systemd-shutdown, but getopt
permutes argv[]. This confuses dracut's shutdown script:
  Shutdown called with argument '--log-level'. Rebooting!

getopt can be convinced to not permute argv[] by having '-' as the first
character of optstring. Let's use it. This requires changing the way
non-option arguments (in our case, the verb) are processed.

This fixes a bug where the system would reboot instead of powering off.

(cherry picked from commit 4b5d8d0f22ae61ceb45a25391354ba53b43ee992)
timer: reenable TIMER_ACTIVE timers when restarted

A timer configured with OnActiveSec will start its associated unit again
if the timer is stopped, then started. However, if the timer unit is
restarted -- with "systemctl restart", say -- this does not occur.

This commit ensures that TIMER_ACTIVE timers are re-enabled whenever the
timer is started, even if that's within a restart job.

(cherry picked from commit 779042e772d2459f7649b34a164902dc456f1bab)
sd-dhcp-client: fix REBOOT state handling

client->secs wasn't getting set in the REBOOT state, causing
an assertion.  REBOOT should work the same way as INIT, per
RFC 2131:

 secs   2  Filled in by client, seconds elapsed since client
           began address acquisition or renewal process.

REBOOT is necessary because some DHCP servers (eg on
home routers) do not hand back the same IP address unless the
'ciaddr' field is filled with that address, which DISCOVER
cannot do per the RFCs.  This leads to multiple leases
on machine reboot or DHCP client restart.

(cherry picked from commit d8d74ef06fa0ccf39084a6177e70e4c2297cca57)
sd-dhcp-lease: fix copy-paste error asserting wrong function argument

(cherry picked from commit 1c6eb4e36bf88015d0bbe8fae417622e6132b864)
sd-bus: create clean error when a property Set() call with incorrect signature is passed in

(cherry picked from commit 0ca454d474a13f363dcd5ef8dc97ca158569d3ed)
Do not check for existence of remote binaries

systemd-run would fail when run with -M or -H and an absolute path,
if this path did not exists locally. Allow it to continue, since we
don't have a nice way of checking if the binary exists remotely.

The case where -M or -H is used and a local path is unchanged, and we
still iterate over $PATH to find the binary. We need to convert to an
absolute path, and we don't have a nice mechanism to check remotely,
so we assume that the binary will be located in the same place locally
and remotely.

http://lists.freedesktop.org/archives/systemd-devel/2014-November/025418.html
(cherry picked from commit b63bd1090bf6ce79b6757c3f8f4172a367854577)