chiark / gitweb /
elogind.git
10 years agoman: fix description of is-enabled returned value
Zbigniew Jędrzejewski-Szmek [Wed, 25 Dec 2013 03:57:15 +0000 (22:57 -0500)]
man: fix description of is-enabled returned value

10 years agobus: add a temporary hard-coded policy to proxyd to make gdm work
Lennart Poettering [Thu, 26 Dec 2013 15:07:38 +0000 (16:07 +0100)]
bus: add a temporary hard-coded policy to proxyd to make gdm work

gdm relies on the policy to deny its own requests to not deadlock. Given
that we currently do not enforce any policy in the dbus1 compat proxy
service this means that gdm will necessarily deadlock on our systems.

To work around this, enforce a fixed policy teomporarily, until we
interpret the legacy XML policy in full.

Booh, gdm, booh, for requring this and making me waste two days on
tracking this brokenness down.

10 years agobus: always show messages we send
Lennart Poettering [Thu, 26 Dec 2013 14:24:58 +0000 (15:24 +0100)]
bus: always show messages we send

10 years agoman: document fail/nofail, auto/noauto
Zbigniew Jędrzejewski-Szmek [Thu, 26 Dec 2013 04:20:57 +0000 (23:20 -0500)]
man: document fail/nofail, auto/noauto

Also s/filesystem/file system/ in a few places.

10 years agoTrim TODO
Zbigniew Jędrzejewski-Szmek [Thu, 26 Dec 2013 03:53:09 +0000 (22:53 -0500)]
Trim TODO

10 years agoman: grammar and wording improvements
Jan Engelhardt [Thu, 26 Dec 2013 01:47:45 +0000 (02:47 +0100)]
man: grammar and wording improvements

This is a recurring submission and includes corrections to:
- missing words, preposition choice.
- change of /lib to /usr/lib, because that is what most distros are
  using as the system-wide location for systemd/udev files.

10 years agoman: improvements to comma placement
Jan Engelhardt [Thu, 26 Dec 2013 01:47:44 +0000 (02:47 +0100)]
man: improvements to comma placement

This is a recurring submission and includes corrections to:
comma placement.

10 years agoman: resolve word omissions
Jan Engelhardt [Thu, 26 Dec 2013 01:47:43 +0000 (02:47 +0100)]
man: resolve word omissions

This is a recurring submission and includes corrections to:
word omissions and word class choice.

10 years agobus: don't process Peer interface messages in the proxy
Lennart Poettering [Thu, 26 Dec 2013 02:08:52 +0000 (03:08 +0100)]
bus: don't process Peer interface messages in the proxy

10 years agoupdate TODO
Lennart Poettering [Thu, 26 Dec 2013 02:08:35 +0000 (03:08 +0100)]
update TODO

10 years agobus: make system bus kdbus node world-accessible
Lennart Poettering [Thu, 26 Dec 2013 02:08:15 +0000 (03:08 +0100)]
bus: make system bus kdbus node world-accessible

10 years agojournalctl: make sure -b --foobar cannot be misunderstood as --boot=--foobar
Lennart Poettering [Thu, 26 Dec 2013 00:52:01 +0000 (01:52 +0100)]
journalctl: make sure -b --foobar cannot be misunderstood as --boot=--foobar

10 years agoRevert "completion: don't offer completions for journalctl -b"
Lennart Poettering [Wed, 25 Dec 2013 18:17:14 +0000 (19:17 +0100)]
Revert "completion: don't offer completions for journalctl -b"

This reverts commit c756a6d57cdb678b702c68913dae3e11ff0427ae.

10 years agoRevert "journalctl: remove unexpected behavior of journalctl -b"
Lennart Poettering [Wed, 25 Dec 2013 18:17:10 +0000 (19:17 +0100)]
Revert "journalctl: remove unexpected behavior of journalctl -b"

This reverts commit cf5bccc2bb9569030cb04debbc4208aaca0fe5b4.

We should fix thinks properly if they aren't perfect, not just break
other things...

10 years agobuild-sys: minor fixes found with cppcheck
Lennart Poettering [Wed, 25 Dec 2013 18:00:12 +0000 (19:00 +0100)]
build-sys: minor fixes found with cppcheck

10 years agobuild-sys: the pure/const warning options are probably too much as default, but let...
Lennart Poettering [Wed, 25 Dec 2013 17:34:44 +0000 (18:34 +0100)]
build-sys: the pure/const warning options are probably too much as default, but let's make it available via "autogen.sh a"

10 years agocompletion: don't offer completions for journalctl -b
Dave Reisner [Wed, 25 Dec 2013 17:58:37 +0000 (12:58 -0500)]
completion: don't offer completions for journalctl -b

Since this is a shortopt with an optional argument, assume the user
knows what they're doing. The longopts --boot and --this-boot will
continue to offer boot IDs as completions.

10 years agojournalctl: remove unexpected behavior of journalctl -b
Dave Reisner [Wed, 25 Dec 2013 17:24:19 +0000 (12:24 -0500)]
journalctl: remove unexpected behavior of journalctl -b

This flag shouldn't try and consume the following argument. It should
behave like every other flag which takes an optional argument when
parsed by getopt_long.

10 years agobus: add a bit of pure/const decorators
Lennart Poettering [Wed, 25 Dec 2013 17:26:51 +0000 (18:26 +0100)]
bus: add a bit of pure/const decorators

10 years agoman: add missing sd_bus_message_get_cookie man page fie
Lennart Poettering [Wed, 25 Dec 2013 17:05:48 +0000 (18:05 +0100)]
man: add missing sd_bus_message_get_cookie man page fie

10 years agoman: document sd_bus_message_get_cookie()
Lennart Poettering [Wed, 25 Dec 2013 17:03:05 +0000 (18:03 +0100)]
man: document sd_bus_message_get_cookie()

10 years agobus: rename message "serial" to "cookie"
Lennart Poettering [Wed, 25 Dec 2013 16:46:45 +0000 (17:46 +0100)]
bus: rename message "serial" to "cookie"

Even if the lower-leveld dbus1 protocol calls it "serial", let's expose
the word "cookie" for this instead, as this is what kdbus uses and since
it doesn't imply monotonicity the same way "serial" does.

10 years agobus: conditionally set cookie_reply/timeout and update kdbus.h
Kay Sievers [Wed, 25 Dec 2013 15:42:50 +0000 (16:42 +0100)]
bus: conditionally set cookie_reply/timeout and update kdbus.h

10 years agobus: update kdbus.h
Kay Sievers [Wed, 25 Dec 2013 04:45:43 +0000 (05:45 +0100)]
bus: update kdbus.h

10 years agobus: set cookie_reply and update kdbus.h
Kay Sievers [Wed, 25 Dec 2013 04:02:58 +0000 (05:02 +0100)]
bus: set cookie_reply and update kdbus.h

10 years agobus: also write debug logs about messages we send
Lennart Poettering [Wed, 25 Dec 2013 02:09:09 +0000 (03:09 +0100)]
bus: also write debug logs about messages we send

10 years agobus: be a bit more verbose when debug mode is on
Lennart Poettering [Wed, 25 Dec 2013 01:13:50 +0000 (02:13 +0100)]
bus: be a bit more verbose when debug mode is on

10 years agoshared: fix getpeername_pretty() for AF_UNIX sockets
Lennart Poettering [Tue, 24 Dec 2013 20:24:06 +0000 (21:24 +0100)]
shared: fix getpeername_pretty() for AF_UNIX sockets

10 years agounit: include peer identity in description of per-connection socket-activated services
Lennart Poettering [Tue, 24 Dec 2013 20:18:21 +0000 (21:18 +0100)]
unit: include peer identity in description of per-connection socket-activated services

10 years agosleep-config: fix useless check for swapfile type
Dave Reisner [Tue, 24 Dec 2013 21:42:06 +0000 (16:42 -0500)]
sleep-config: fix useless check for swapfile type

Since 0c6f1f4ea49 the check was useless, because the kernel will
ever only write "partition" or "file" there.

OTOH, it is possible that "\\040(deleted)" (escaped " (deleted)")
will be added for removed files. This should not happen, so add
a warning to detect those cases.

10 years agotmpfiles: introduce the concept of unsafe operations
Zbigniew Jędrzejewski-Szmek [Sat, 21 Dec 2013 01:25:39 +0000 (20:25 -0500)]
tmpfiles: introduce the concept of unsafe operations

Various operations done by systemd-tmpfiles may only be safely done at
boot (e.g. removal of X lockfiles in /tmp, creation of /run/nologin).
Other operations may be done at any point in time (e.g. setting the
ownership on /{run,var}/log/journal). This distinction is largely
orthogonal to the type of operation.

A new switch --unsafe is added, and operations which should only be
executed during bootup are marked with an exclamation mark in the
configuration files. systemd-tmpfiles.service is modified to use this
switch, and guards are added so it is hard to re-start it by mistake.

If we install a new version of systemd, we actually want to enforce
some changes to tmpfiles configuration immediately. This should now be
possible to do safely, so distribution packages can be modified to
execute the "safe" subset at package installation time.

/run/nologin creation is split out into a separate service, to make it
easy to override.

https://bugzilla.redhat.com/show_bug.cgi?id=1043212
https://bugzilla.redhat.com/show_bug.cgi?id=1045849

10 years agoman,units: tmpfiles.d(5) cleanup
Zbigniew Jędrzejewski-Szmek [Tue, 24 Dec 2013 15:21:45 +0000 (10:21 -0500)]
man,units: tmpfiles.d(5) cleanup

Condition for /lib (necessary for split /usr) was missing from the unit.

Some changes which were done in tmpfiles.d(5) were not carried over to
systemd-tmpfiles(1).

Also use markup where possible.

10 years agobus: properly shift cgroup data returned from kdbus by the container's root before...
Lennart Poettering [Tue, 24 Dec 2013 18:31:44 +0000 (19:31 +0100)]
bus: properly shift cgroup data returned from kdbus by the container's root before parsing

10 years agobus: fix return message if StartServiceByName() in the driver fails due
Lennart Poettering [Tue, 24 Dec 2013 17:42:38 +0000 (18:42 +0100)]
bus: fix return message if StartServiceByName() in the driver fails due
to non-existing service

10 years agobusctl: show service/session a name belongs to in the list of names
Lennart Poettering [Tue, 24 Dec 2013 17:15:38 +0000 (18:15 +0100)]
busctl: show service/session a name belongs to in the list of names

Also, don't show machine name by default as this might cause timeouts on
non-responding peers.

10 years agolog: log_error() and friends add a newline after each line anyway, so avoid including...
Lennart Poettering [Tue, 24 Dec 2013 15:39:37 +0000 (16:39 +0100)]
log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings

10 years agoutil: don't accept an empty peer label as valid
Lennart Poettering [Tue, 24 Dec 2013 15:21:59 +0000 (16:21 +0100)]
util: don't accept an empty peer label as valid

10 years agobus: only accept kdbus creds if they are valid
Lennart Poettering [Tue, 24 Dec 2013 15:20:47 +0000 (16:20 +0100)]
bus: only accept kdbus creds if they are valid

This allows userspace to fake kdbus creds via struct ucred in the proxy,
without making the recieving side choke on the missing fields of the
kdbus struct, more precisel pid_starttime and tid

10 years agoutil: unify SO_PEERCRED/SO_PEERSEC invocations
Lennart Poettering [Tue, 24 Dec 2013 14:53:04 +0000 (15:53 +0100)]
util: unify SO_PEERCRED/SO_PEERSEC invocations

Introduce new call getpeercred() which internally just uses SO_PEERCRED
but checks if the returned data is actually useful due to namespace
quirks.

10 years agobus: fix hello ioctl buffer size calculation
Lennart Poettering [Tue, 24 Dec 2013 14:38:30 +0000 (15:38 +0100)]
bus: fix hello ioctl buffer size calculation

10 years agobus: make gcc shut up
Lennart Poettering [Tue, 24 Dec 2013 14:33:02 +0000 (15:33 +0100)]
bus: make gcc shut up

10 years agobus: fake client side creds in the proxy to the caller's creds
Lennart Poettering [Tue, 24 Dec 2013 14:03:32 +0000 (15:03 +0100)]
bus: fake client side creds in the proxy to the caller's creds

10 years agohwdb: Add SDIO product ID for Marvell SD8897 WLAN function
Marcel Holtmann [Tue, 24 Dec 2013 03:04:19 +0000 (19:04 -0800)]
hwdb: Add SDIO product ID for Marvell SD8897 WLAN function

10 years agobus: allow peeking signatures recusively inside of containers
Lennart Poettering [Tue, 24 Dec 2013 02:02:49 +0000 (03:02 +0100)]
bus: allow peeking signatures recusively inside of containers

Previously we invalidated the peeked signature as soon as the caller
would recurse into a container, making stack based handling difficult.
With this change we will keep the peeked signature around until the user
advances to the next field.

10 years agoupdate TODO
Lennart Poettering [Tue, 24 Dec 2013 01:57:17 +0000 (02:57 +0100)]
update TODO

10 years agobus: fix assert when serializing fixed size struct to gvariant
Lennart Poettering [Mon, 23 Dec 2013 22:48:30 +0000 (23:48 +0100)]
bus: fix assert when serializing fixed size struct to gvariant

10 years agobus: don't attach KDBUS_ITEM_ID to match ioctl() if we don't need it
Lennart Poettering [Mon, 23 Dec 2013 21:32:33 +0000 (22:32 +0100)]
bus: don't attach KDBUS_ITEM_ID to match ioctl() if we don't need it

10 years agobus: fix sender match creation on kdbus
Lennart Poettering [Mon, 23 Dec 2013 20:55:27 +0000 (21:55 +0100)]
bus: fix sender match creation on kdbus

10 years agosd-event: make sd_event_add_signal() fail with EBUSY if signal is not blocked
Lennart Poettering [Mon, 23 Dec 2013 20:44:20 +0000 (21:44 +0100)]
sd-event: make sd_event_add_signal() fail with EBUSY if signal is not blocked

10 years agocore: when we close the notify fd, we also need to free its event source
Lennart Poettering [Mon, 23 Dec 2013 20:01:32 +0000 (21:01 +0100)]
core: when we close the notify fd, we also need to free its event source

10 years agounits: systemd-machined now exits on idle and we shouldn't try to restart it then
Lennart Poettering [Mon, 23 Dec 2013 19:37:03 +0000 (20:37 +0100)]
units: systemd-machined now exits on idle and we shouldn't try to restart it then

10 years agounits: limit caps for bus proxyd and driverd services
Lennart Poettering [Mon, 23 Dec 2013 19:37:00 +0000 (20:37 +0100)]
units: limit caps for bus proxyd and driverd services

10 years agosd-event: fix return code of sd_event_run()
Lennart Poettering [Mon, 23 Dec 2013 19:22:33 +0000 (20:22 +0100)]
sd-event: fix return code of sd_event_run()

10 years agomachinectl: fix success check when getting pty from within container
Lennart Poettering [Mon, 23 Dec 2013 18:15:43 +0000 (19:15 +0100)]
machinectl: fix success check when getting pty from within container

10 years agobus-proxyd: init cleanup variable
Kay Sievers [Mon, 23 Dec 2013 18:16:49 +0000 (19:16 +0100)]
bus-proxyd: init cleanup variable

10 years agobus: update kdbus.h
Kay Sievers [Mon, 23 Dec 2013 18:14:24 +0000 (19:14 +0100)]
bus: update kdbus.h

10 years agobus: when getting a kdbus connection into a container wait first for child, then...
Lennart Poettering [Mon, 23 Dec 2013 18:10:11 +0000 (19:10 +0100)]
bus: when getting a kdbus connection into a container wait first for child, then read message

There's no EOF generated for AF_UNIX/SOCK_DGRAM sockets, hence let's
wait for the child first to see if it succeeded, only then read the socket.

10 years agobus: when we are connected to a bus, then do not assume peer creds are useful as...
Lennart Poettering [Mon, 23 Dec 2013 17:56:37 +0000 (18:56 +0100)]
bus: when we are connected to a bus, then do not assume peer creds are useful as message creds

10 years agoutil: when we try to read /proc/cmdline in a container, read /proc/1/cmdline instead
Lennart Poettering [Mon, 23 Dec 2013 17:10:57 +0000 (18:10 +0100)]
util: when we try to read /proc/cmdline in a container, read /proc/1/cmdline instead

10 years agolog: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"
Lennart Poettering [Mon, 23 Dec 2013 16:56:44 +0000 (17:56 +0100)]
log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"

10 years agobus: make sure sd_bus_emit_properties_changed_strv() doesn't return ENOENT if no...
Lennart Poettering [Mon, 23 Dec 2013 16:30:21 +0000 (17:30 +0100)]
bus: make sure sd_bus_emit_properties_changed_strv() doesn't return ENOENT if no properties with a change flag are in the interface

10 years agobus: write debug message when we get a method call we cannot handle
Lennart Poettering [Mon, 23 Dec 2013 16:18:30 +0000 (17:18 +0100)]
bus: write debug message when we get a method call we cannot handle

10 years agodelta: if prefix is specified, only show overrides there
Zbigniew Jędrzejewski-Szmek [Mon, 23 Dec 2013 03:53:23 +0000 (22:53 -0500)]
delta: if prefix is specified, only show overrides there

systemd-delta /run/systemd/system will show all unit overrides
in /run, etc.

10 years agodelta: fix delta for drop-ins
Zbigniew Jędrzejewski-Szmek [Mon, 23 Dec 2013 00:45:02 +0000 (19:45 -0500)]
delta: fix delta for drop-ins

Also, fix highlighting, add more debug statements, make const tables
static and global, run path_kill_slashes only at entry.

10 years agobus: make sure to request peer cred only after connect(), not before
Lennart Poettering [Mon, 23 Dec 2013 02:43:43 +0000 (03:43 +0100)]
bus: make sure to request peer cred only after connect(), not before

10 years agobus: always talk to the full dbus driver object
Lennart Poettering [Mon, 23 Dec 2013 02:30:41 +0000 (03:30 +0100)]
bus: always talk to the full dbus driver object

10 years agobus-proxyd: synthesize NameAcquire/NameLost signals for socket clients
Lennart Poettering [Mon, 23 Dec 2013 01:59:03 +0000 (02:59 +0100)]
bus-proxyd: synthesize NameAcquire/NameLost signals for socket clients

10 years agoupdate TODO
Lennart Poettering [Mon, 23 Dec 2013 01:08:12 +0000 (02:08 +0100)]
update TODO

10 years agobus: use memcpy() rather than unbounded strcpy()
Lennart Poettering [Mon, 23 Dec 2013 01:08:05 +0000 (02:08 +0100)]
bus: use memcpy() rather than unbounded strcpy()

10 years agobus: switch kdbus bloom filter over to SipHash (from MurmurHash3)
Lennart Poettering [Sun, 22 Dec 2013 22:26:07 +0000 (23:26 +0100)]
bus: switch kdbus bloom filter over to SipHash (from MurmurHash3)

Let's try to standardize on a single non-cryptographic hash algorithm,
and for that SipHash appears to be the best answer.

With this change there are two other hash functions left in systemd: an
older version of MurmurHash embedded into libudev for the bloom filters
in udev messages (which is hard to update, given that the we probably
should stay compatible with older versions of the library). And lookup3
in the journal files (which we could replace for new files, but which is
probably not worth the work).

10 years agolibudev: ship the original MurmurHash2.[ch] file
Kay Sievers [Mon, 23 Dec 2013 01:46:39 +0000 (02:46 +0100)]
libudev: ship the original MurmurHash2.[ch] file

10 years agologinctl: fix output of type with class
Mantas Mikulėnas [Sun, 22 Dec 2013 05:22:46 +0000 (07:22 +0200)]
loginctl: fix output of type with class

10 years agoFix extraction of _SYSTEMD_USER_UNIT
Zbigniew Jędrzejewski-Szmek [Sun, 22 Dec 2013 23:28:03 +0000 (18:28 -0500)]
Fix extraction of _SYSTEMD_USER_UNIT

Units from user services underneath user@.service would not be detected
properly.

10 years agosystemctl: also color filenames of drop-ins in cat
Zbigniew Jędrzejewski-Szmek [Sun, 22 Dec 2013 21:11:45 +0000 (16:11 -0500)]
systemctl: also color filenames of drop-ins in cat

10 years agosd-daemon: introduce sd_watchdog_enabled() for parsing $WATCHDOG_USEC
Lennart Poettering [Sun, 22 Dec 2013 21:14:05 +0000 (22:14 +0100)]
sd-daemon: introduce sd_watchdog_enabled() for parsing $WATCHDOG_USEC

Also, introduce a new environment variable named $WATCHDOG_PID which
cotnains the PID of the process that is supposed to send the keep-alive
events. This is similar how $LISTEN_FDS and $LISTEN_PID work together,
and protects against confusing processes further down the process tree
due to inherited environment.

10 years agojournal: when we shall go down do so cleanly
Lennart Poettering [Sun, 22 Dec 2013 20:10:06 +0000 (21:10 +0100)]
journal: when we shall go down do so cleanly

10 years agoshared: switch our hash table implementation over to SipHash
Lennart Poettering [Sun, 22 Dec 2013 18:59:12 +0000 (19:59 +0100)]
shared: switch our hash table implementation over to SipHash

SipHash appears to be the new gold standard for hashing smaller strings
for hashtables these days, so let's make use of it.

10 years agobus: also take write queue into consideration in sd_bus_try_close()
Lennart Poettering [Sun, 22 Dec 2013 18:50:07 +0000 (19:50 +0100)]
bus: also take write queue into consideration in sd_bus_try_close()

10 years agocore: the cgroup properties are not actually const
Lennart Poettering [Sun, 22 Dec 2013 18:44:04 +0000 (19:44 +0100)]
core: the cgroup properties are not actually const

10 years agohwdb: update
Marcel Holtmann [Sun, 22 Dec 2013 19:32:11 +0000 (11:32 -0800)]
hwdb: update

10 years agohwdb: Add SDIO database to ids-update.pl script
Marcel Holtmann [Sun, 22 Dec 2013 19:30:57 +0000 (11:30 -0800)]
hwdb: Add SDIO database to ids-update.pl script

10 years agohwdb: Add SDIO Bluetooth and WiFi devices from Marvell
Marcel Holtmann [Sun, 22 Dec 2013 19:20:53 +0000 (11:20 -0800)]
hwdb: Add SDIO Bluetooth and WiFi devices from Marvell

10 years agohwdb: Add SDIO products from GCT and CSR
Marcel Holtmann [Sun, 22 Dec 2013 19:08:50 +0000 (11:08 -0800)]
hwdb: Add SDIO products from GCT and CSR

10 years agohwdb: Add SDIO WLAN devices from ST-Ericsson and TI
Marcel Holtmann [Sun, 22 Dec 2013 18:58:30 +0000 (10:58 -0800)]
hwdb: Add SDIO WLAN devices from ST-Ericsson and TI

10 years agohwdb: Correct SDIO vendor identifier for Broadcom
Marcel Holtmann [Sun, 22 Dec 2013 18:49:08 +0000 (10:49 -0800)]
hwdb: Correct SDIO vendor identifier for Broadcom

10 years agohwdb: Add SDIO device information for Broadcom B43 based cards
Marcel Holtmann [Sun, 22 Dec 2013 18:46:13 +0000 (10:46 -0800)]
hwdb: Add SDIO device information for Broadcom B43 based cards

10 years agohwdb: Add some known SDIO device identification strings
Marcel Holtmann [Sun, 22 Dec 2013 18:33:25 +0000 (10:33 -0800)]
hwdb: Add some known SDIO device identification strings

10 years agohwddb: Add database for SDIO vendor and class information
Marcel Holtmann [Sun, 22 Dec 2013 18:21:20 +0000 (10:21 -0800)]
hwddb: Add database for SDIO vendor and class information

10 years agoRevert "bus-proxyd: use a loop instead of c&p"
Kay Sievers [Sun, 22 Dec 2013 15:41:24 +0000 (16:41 +0100)]
Revert "bus-proxyd: use a loop instead of c&p"

This reverts commit 9818fa6d6d32d87a3e1b96934a54523ea6b02879.

The proxy does not work anymore with this patch.

10 years agoman: fix make install
Marc-Antoine Perennou [Sun, 22 Dec 2013 08:47:42 +0000 (17:47 +0900)]
man: fix make install

commit 5b04fe60004e7c5cd5a43648ede3e6a965e70b8c broke it with
‘./man/sd_session_is_remote.3’: No such file or directory

10 years agolibsystemd-dhcp: add some asserts
Tom Gundersen [Wed, 18 Dec 2013 09:52:22 +0000 (10:52 +0100)]
libsystemd-dhcp: add some asserts

10 years agolibsystemd-dhcp: Handle T2 Rebinding timeout
Patrik Flykt [Fri, 20 Dec 2013 15:16:20 +0000 (17:16 +0200)]
libsystemd-dhcp: Handle T2 Rebinding timeout

Reuse existing functionality when adding T2 Rebinding support.

10 years agolibsystemd-dhcp: Factor out common code initializing events
Patrik Flykt [Fri, 20 Dec 2013 15:16:19 +0000 (17:16 +0200)]
libsystemd-dhcp: Factor out common code initializing events

Factor out common code from timeout T1 handling and starting of
the DHCP client.

10 years agolibsystemd-dhcp: Handle T1 Renewing timeout
Patrik Flykt [Fri, 20 Dec 2013 15:16:18 +0000 (17:16 +0200)]
libsystemd-dhcp: Handle T1 Renewing timeout

Expiration of T1 timeout takes the client to the Rebinding state,
where it attempts to renew its lease. Start by opening a DCHP unicast
socket as there now is a proper IP address set.

Compute the resend timer as half of the remaining time down to a
minimum of 60 seconds (RFC2131). Modify DHCP Request sending to send
only UDP DHCP data when unicasting. Also modify DHCP Ack/Nak
receiving such that the client_receive_ack() takes care of using
either the full IP, UDP, DHCP packet or only the DHCP payload
depending whether the client is in Requesting or Renewing state.
Finally always report DHCP_EVENT_IP_ACQUIRE from Requesting state
and only DHCP_EVENT_IP_CHANGE if the IP address was modified when
the lease was renewed.

10 years agolibsystemd-dhcp: Add functions for sending unicast UDP messages
Patrik Flykt [Fri, 20 Dec 2013 15:16:17 +0000 (17:16 +0200)]
libsystemd-dhcp: Add functions for sending unicast UDP messages

Create a helper functions setting up an unicast DHCP UDP socket and
sending data. Add function stubs for the test program.

[tomegun: initialize structs when allocating, and drop unneccesary 'err']

10 years agolibsystemd-dhcp: Check test result without casting value
Patrik Flykt [Fri, 20 Dec 2013 15:16:16 +0000 (17:16 +0200)]
libsystemd-dhcp: Check test result without casting value

10 years agolibsystemd-dhcp: Fix checksum computation for buffer with odd size
Patrik Flykt [Fri, 20 Dec 2013 15:16:15 +0000 (17:16 +0200)]
libsystemd-dhcp: Fix checksum computation for buffer with odd size

Fix off-by-one error and notice that summing may need more than one
round for the result to be in the lower 16 bits.

10 years agolibsystemd-dhcp: Fix receiving of other message when expecting Ack
Patrik Flykt [Fri, 20 Dec 2013 15:16:14 +0000 (17:16 +0200)]
libsystemd-dhcp: Fix receiving of other message when expecting Ack

When a DHCP Nak is received, return a DHCP_EVENT_NO_LEASE event. If
some other DHCP message is received or an error happens when parsing
options, return -ENOMSG in order to ignore the packet. There may be
more than one server serving the same subnet, each server will send
its Offer to the client.

10 years agolibsystemd-dhcp: Unref event source before closing socket
Patrik Flykt [Fri, 20 Dec 2013 15:16:13 +0000 (17:16 +0200)]
libsystemd-dhcp: Unref event source before closing socket

10 years agolibsystemd-dhcp: Return proper error on OOM
Patrik Flykt [Fri, 20 Dec 2013 15:16:12 +0000 (17:16 +0200)]
libsystemd-dhcp: Return proper error on OOM