chiark / gitweb /
elogind.git
9 years agosysv-generator: don't check first if hashmap contains the service name
Thomas Hindoe Paaboel Andersen [Wed, 17 Sep 2014 21:03:27 +0000 (23:03 +0200)]
sysv-generator: don't check first if hashmap contains the service name

Just test if hashmap_get returns null. hashmap_contains does exactly
same thing internally so this is slightly more efficient for the true
case.

Silences a coverity warning too. CID#1237648

9 years agologind: fix typo
Ronny Chevalier [Wed, 17 Sep 2014 18:10:44 +0000 (20:10 +0200)]
logind: fix typo

9 years agoshared: conf-parser
Tom Gundersen [Wed, 17 Sep 2014 20:17:53 +0000 (22:17 +0200)]
shared: conf-parser

Check memory allocation. Found by Coverity.

Fixes CID #1237644.

9 years agoudev: event - modernize spawn_exec()
Tom Gundersen [Wed, 17 Sep 2014 19:53:20 +0000 (21:53 +0200)]
udev: event - modernize spawn_exec()

9 years agoudev: event - explicitly don't read() from invalid fd
Tom Gundersen [Wed, 17 Sep 2014 19:44:56 +0000 (21:44 +0200)]
udev: event - explicitly don't read() from invalid fd

This fixes CID #1237641.

9 years agoudev: event - modernize spawn_read()
Tom Gundersen [Wed, 17 Sep 2014 19:43:57 +0000 (21:43 +0200)]
udev: event - modernize spawn_read()

9 years agonss-resolve: remove dead code
Thomas Hindoe Paaboel Andersen [Wed, 17 Sep 2014 18:48:39 +0000 (20:48 +0200)]
nss-resolve: remove dead code

ifindex < 0 was already checked before entering the loop

Found by coverity. Fixes: CID#1237609

9 years agoudev: rules - close empty file
Tom Gundersen [Wed, 17 Sep 2014 17:53:01 +0000 (19:53 +0200)]
udev: rules - close empty file

If the file is found to be empty, we exit early without closing the file first.

Found by coverity. Fixes CID #1237759.

9 years agolibsystemd-network: dhcp-test - assert that malloc0 succeeds
Tom Gundersen [Wed, 17 Sep 2014 17:07:56 +0000 (19:07 +0200)]
libsystemd-network: dhcp-test - assert that malloc0 succeeds

Otherwise we would get a nullptr dereference later on.

Found by coverity. Fixes CID #1237655.

9 years agonetworkd: dhcp4 - fix unchecked return value
Tom Gundersen [Wed, 17 Sep 2014 17:00:55 +0000 (19:00 +0200)]
networkd: dhcp4 - fix unchecked return value

Found by coverity. CID #1237529 and #1237528.

9 years agobus: fix error leak in bus_node_exists()
David Herrmann [Wed, 17 Sep 2014 08:32:49 +0000 (10:32 +0200)]
bus: fix error leak in bus_node_exists()

If we call into user callbacks, we must always propagate possible errors.
Fix bus_node_exists() to do that and adjust the callers (which already
partially propagated the error).

Also speed up that function by first checking for registered enumerators
and/or object-managers.

9 years agobus: never respond to GetManagedObjects() on sub-paths
David Herrmann [Wed, 17 Sep 2014 07:28:09 +0000 (09:28 +0200)]
bus: never respond to GetManagedObjects() on sub-paths

The dbus-spec clearly specifies that GetManagedObjects() should only work
on the root-path of an object-tree. But on that path, it works regardless
whether there are any objects available or not.

We could, technically, define all sub-paths as a root-path of its own
sub-tree. However, if we do that, we enter undefined territory:

    Imagine only a fallback vtable is registered. We want
    GetManagedObjects() to *NOT* fail with UNKNOWN_METHOD if it is called
    on a valid sub-tree of the fallback. On the other hand, we don't want
    it to work on arbitrary sub-tree. Something like:
        /path/to/fallback/foobar/foobar/foobar/invalid/foobar
    should not work.
    However, there is no way to know which paths on a fallback are valid
    without looking at there registered objects. If no objects are
    registered, we have no way to figure it out.

Therefore, we now try to follow the dbus spec by only returning valid data
on registered root-paths. We treat each path as root which was registered
an object-manager on via add_object_manager(). So applications can now
directly control which paths to place an object-manager on.

We also fix the introspection to not return object-manager interfaces on
non-root paths.

Also fixes some dead-code paths initially reported by Philippe De Swert.

9 years agosysctl: make --prefix allow all kinds of sysctl paths
David Herrmann [Wed, 17 Sep 2014 07:06:49 +0000 (09:06 +0200)]
sysctl: make --prefix allow all kinds of sysctl paths

Currently, we save arguments passed as --prefix directly and compare them
later to absolute sysctl file-system paths. That is, you are required to
specify arguments to --prefix with leading /proc/sys/. This is kinda
uselesss. Furthermore, we replace dots by slashes in the name, which makes
it impossible to match on specific sysfs paths that have dots in their
name (like netdev names). The intention of this argument is clear, but it
never worked as expected.

This patch modifies --prefix to accept any kind of sysctl paths. It
supports paths prefixed with /proc/sys for compatibility (but drops the
erroneous dot->slash conversion), but instead applies normalize_sysctl()
which turns any name or path into a proper path. It then appends
/proc/sys/ so we can properly use it in matches.

Thanks to Jan Synacek <jsynacek@redhat.com> for catching this!

9 years agoutil: remove a unnecessary check
Thomas Hindoe Paaboel Andersen [Tue, 16 Sep 2014 20:58:35 +0000 (22:58 +0200)]
util: remove a unnecessary check

We only break out of the previous loop if fd >= 0 so there is no
use in checking it again.

Found by coverity. Fixes: CID#1237577

9 years agoterminal: remove dead code checking O_WRONLY
David Herrmann [Tue, 16 Sep 2014 21:00:26 +0000 (23:00 +0200)]
terminal: remove dead code checking O_WRONLY

We only reject evdev FDs that are O_WRONLY as they're currently pretty
useless. The following check for O_WRONLY is thus never excercised so drop
it.
Thanks to Thomas Andersen (via coverity)!

9 years agotest: silence a coverity report
Thomas Hindoe Paaboel Andersen [Tue, 16 Sep 2014 19:59:50 +0000 (21:59 +0200)]
test: silence a coverity report

We check the actual contents of the file on the line after but we
might as well also check the number of bytes read here.

Found by coverity. Fixes: CID#1237521

9 years agoshared: fix resource leak in config_parse_default_instance
Andreas Henriksson [Tue, 16 Sep 2014 19:36:26 +0000 (21:36 +0200)]
shared: fix resource leak in config_parse_default_instance

The recently allocated "printed" is not freed on error path.

Found by coverity. Fixes: CID#1237745

9 years agosysv-generator: fix resource leak
Andreas Henriksson [Tue, 16 Sep 2014 19:22:59 +0000 (21:22 +0200)]
sysv-generator: fix resource leak

The "unit" string allocation is not freed on either error or success path.

Found by coverity. Fixes: CID#1237755

9 years agocore: fix resource leak in manager_environment_add
Andreas Henriksson [Tue, 16 Sep 2014 19:11:02 +0000 (21:11 +0200)]
core: fix resource leak in manager_environment_add

Second error path must free the (potentially) allocated memory in the
first code chunk before returning.

Found by coverity. Fixes: CID#1237750

9 years agomissing: memfd_create takes unsigned int flags in final version
Cristian Rodríguez [Tue, 16 Sep 2014 17:17:01 +0000 (14:17 -0300)]
missing: memfd_create takes unsigned int flags in final version

9 years agoterminal: sd_bus_error_get_errno returns positive errno
Thomas Hindoe Paaboel Andersen [Mon, 15 Sep 2014 20:55:36 +0000 (22:55 +0200)]
terminal: sd_bus_error_get_errno returns positive errno

The 3 calls to sd_bus_error_get_errno appear to expect a negative
return value.

This patch negates the returned value so it matches the other error
cases in the 3 functions where sd_bus_error_get_errno is used.

9 years agosd-bus: sd_bus_message_get_errno should only return positive errno
Thomas Hindoe Paaboel Andersen [Mon, 15 Sep 2014 20:36:43 +0000 (22:36 +0200)]
sd-bus: sd_bus_message_get_errno should only return positive errno

sd_bus_message_get_errno can currently return either a number of
different poitive errno values (from bus-error-mapping), or a negative
EINVAL if passed null as parameter.

The check for null parameter was introduced in 40ca29a1370379d43e44c0ed425eecc7218dcbca
at the same as the function was renamed from bus_message_to_errno and
made public API. Before becoming public the function used to return
only negative values.

It is weird to have a function return both positive and negative errno
and it generally looks like a mistake. The function is guarded by the
--enable-kdbus flags so I wonder if we still have time to fix it up?
It does not have any documentation yet. However, except for a few details
it is just a convenient way to call sd_bus_error_get_errno which is documented
to return only positive errno.

This patch makes it return only positive errno and fixes up the two
calls to the function that tried to cope with both positive and negative
values.

9 years agobootchart: oom-check correct variable
Andreas Henriksson [Tue, 16 Sep 2014 17:40:25 +0000 (19:40 +0200)]
bootchart: oom-check correct variable

Coverity warned that we have already dereferenced ps->sample before
null-checking it. I suspect that's not really the issue and that
the check is checking the wrong variable.
Likely the oom-check should be on the just allocated ps->sample->next.

Found by coverity. Fixes: CID#1237765

9 years agobootchart: use safe_atod() rather than strtod()
Tom Gundersen [Tue, 16 Sep 2014 16:42:22 +0000 (18:42 +0200)]
bootchart: use safe_atod() rather than strtod()

9 years agohostname: add missing EMITS_CHANGE annotation
David Herrmann [Tue, 16 Sep 2014 15:33:20 +0000 (17:33 +0200)]
hostname: add missing EMITS_CHANGE annotation

We call into sd-bus to send PropertiesChanged notifications for
"Hostname", but forgot to add the annotation to the bus-vtable. Fix that!

9 years agolibsystemd-network: avoid double-free in error case
Andreas Henriksson [Tue, 16 Sep 2014 13:50:58 +0000 (15:50 +0200)]
libsystemd-network: avoid double-free in error case

Don't manually free 'n' in error path as it's already tagged
_cleanup_free_ and will be freed once it goes out of scope,
leading to double-free in this case.

Found with coverity. Fixes: CID#1237786

9 years agogpt-auto-generator: fix typo
Lukas Nykryn [Tue, 16 Sep 2014 11:50:11 +0000 (13:50 +0200)]
gpt-auto-generator: fix typo

9 years agoudev: rules - add missing whitespace to log message
Tom Gundersen [Mon, 15 Sep 2014 14:36:07 +0000 (16:36 +0200)]
udev: rules - add missing whitespace to log message

9 years agoudevd: use safe_ato*() in place of strto*()
Tom Gundersen [Mon, 15 Sep 2014 12:41:30 +0000 (14:41 +0200)]
udevd: use safe_ato*() in place of strto*()

9 years agoudev: util - use log_level_from_string()
Tom Gundersen [Mon, 15 Sep 2014 12:21:00 +0000 (14:21 +0200)]
udev: util - use log_level_from_string()

9 years agolibudev: util - drop util_delete_path()
Tom Gundersen [Mon, 15 Sep 2014 12:20:32 +0000 (14:20 +0200)]
libudev: util - drop util_delete_path()

Use rmdir_parents() from src/shared instead.

9 years agolibudev: drop util_lookup_{user,group}
Tom Gundersen [Tue, 9 Sep 2014 21:12:14 +0000 (23:12 +0200)]
libudev: drop util_lookup_{user,group}

Use shared versions instead. Difference is with overwriting of repeated user/group
name, and lack of logging.

9 years agoudev: apply permissions to static nodes before signallying READY
Tom Gundersen [Mon, 15 Sep 2014 10:04:29 +0000 (12:04 +0200)]
udev: apply permissions to static nodes before signallying READY

Processes expecting static nodes to have the right permissions may order themselves after systemd-udevd.service,
make sure that actually guarantees what is expected.

9 years agoudev: only print after final log level has been determined
Tom Gundersen [Mon, 15 Sep 2014 09:53:03 +0000 (11:53 +0200)]
udev: only print after final log level has been determined

This delays label_init(), and drops the (duplicate) printing of version
information.

9 years agoudevd: initialize epoll_event structs on allocation
Tom Gundersen [Fri, 12 Sep 2014 14:45:19 +0000 (16:45 +0200)]
udevd: initialize epoll_event structs on allocation

Also move the rest of event initialization next to the event loop (no functional change).

9 years agoudev: don't close std{in,out,err}
Tom Gundersen [Fri, 12 Sep 2014 14:22:44 +0000 (16:22 +0200)]
udev: don't close std{in,out,err}

Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted,
use the correct log_*() function in the first place.

9 years agoudev: drop duplicate logging
Tom Gundersen [Fri, 12 Sep 2014 14:17:00 +0000 (16:17 +0200)]
udev: drop duplicate logging

Once upon a time logging during early boot was unreliable, so extra logging messages were
sent by udev to stderr. That is no longer a concern, so drop all fprintf() calls from udved.

9 years agoudev: split out parse_argv()
Tom Gundersen [Fri, 12 Sep 2014 12:42:59 +0000 (14:42 +0200)]
udev: split out parse_argv()

Also rename some global variables to arg_* to make it clearer where they come from.

9 years agoudev: split out help and modernise a bit
Tom Gundersen [Fri, 12 Sep 2014 12:18:06 +0000 (14:18 +0200)]
udev: split out help and modernise a bit

9 years agoman: sd_bus_error typo fix
Thomas Hindoe Paaboel Andersen [Mon, 15 Sep 2014 21:17:57 +0000 (23:17 +0200)]
man: sd_bus_error typo fix

9 years agoterminal: fix missing hashmap_new() conversions
David Herrmann [Mon, 15 Sep 2014 15:12:41 +0000 (17:12 +0200)]
terminal: fix missing hashmap_new() conversions

hashmap_new() now takes *_ops instead of individual functions. Fix up any
missing invokations of it that haven't been converted already.

9 years agoremove unneeded error.h includes
Emil Renner Berthing [Mon, 15 Sep 2014 13:29:18 +0000 (15:29 +0200)]
remove unneeded error.h includes

These are the only two places where this glibc-specific
header is included. However none of the definitions in it
seem to be used, so just remove the includes.

9 years agosd-bus: use proper ITERATOR_FIRST abstraction
Michal Schmidt [Mon, 4 Aug 2014 20:54:10 +0000 (22:54 +0200)]
sd-bus: use proper ITERATOR_FIRST abstraction

Do not assume hashmap iterators are pointers.
They may be structs in an alternative hashmap implementation.

9 years agohashmap: minor hashmap_replace optimization
Michal Schmidt [Sun, 10 Aug 2014 21:35:27 +0000 (23:35 +0200)]
hashmap: minor hashmap_replace optimization

When hashmap_replace detects no such key exists yet, it calls hashmap_put that
performs the same check again. Avoid that by splitting the core of hashmap_put
into a separate function.

9 years agohashmap, set: remove unused functions
Michal Schmidt [Thu, 31 Jul 2014 16:04:20 +0000 (18:04 +0200)]
hashmap, set: remove unused functions

The following hashmap_* and set_* functions/macros have never had any
users in systemd's history:

  *_iterate_backwards
  *_iterate_skip
  *_last
  *_FOREACH_BACKWARDS

Remove this dead code.

9 years agohashmap: introduce hash_ops to make struct Hashmap smaller
Michal Schmidt [Tue, 12 Aug 2014 23:00:18 +0000 (01:00 +0200)]
hashmap: introduce hash_ops to make struct Hashmap smaller

It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.

systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.

9 years agobuild: colorize gcc only if on tty
Michal Schmidt [Fri, 15 Aug 2014 14:33:03 +0000 (16:33 +0200)]
build: colorize gcc only if on tty

Rather than forcing gcc to always produce colorized error messages
whether on tty or not, enable automatic colorization by ensuring
GCC_COLORS is set to a non-empty string.

Doing it this way removes the need for workarounds in ~/.emacs or
~/.vimrc for "M-x compile" or ":make", respectively, to work.

9 years agotest: fix test of uid-range
Thomas Hindoe Paaboel Andersen [Sun, 14 Sep 2014 20:25:58 +0000 (22:25 +0200)]
test: fix test of uid-range

The number of uid's in the range should be tested instead of written
directly.

The test still passes with the fix checks.

Found with Coverity. Fixes: CID#1237714 - 1237722

9 years agosd-dhcp: fix test of magic cookie
Thomas Hindoe Paaboel Andersen [Sun, 14 Sep 2014 20:06:37 +0000 (22:06 +0200)]
sd-dhcp: fix test of magic cookie

The magic cookie is set in dhcp_message_init. Test the magic cookie
value intead of writing the last 3/4 of it directly.

Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735

9 years agoresolved: fall back to hardcoded ifindex when checking if a link is the loopback
Tom Gundersen [Sat, 13 Sep 2014 18:41:35 +0000 (20:41 +0200)]
resolved: fall back to hardcoded ifindex when checking if a link is the loopback

Reported by Philippe De Swert <philippedeswert@gmail.com>.

Coverity CID#1237656

9 years agonetworkd: remove vestigial event sources
Dave Reisner [Sat, 13 Sep 2014 18:10:33 +0000 (14:10 -0400)]
networkd: remove vestigial event sources

187fe1db took advantage of floating events, but didn't remove pointers
it made superfluous.

9 years agocore: use correct function to free CalendarSpec
Dave Reisner [Sat, 13 Sep 2014 15:18:26 +0000 (11:18 -0400)]
core: use correct function to free CalendarSpec

9 years agocore: fix a potential mem leak
Thomas Hindoe Paaboel Andersen [Sat, 13 Sep 2014 10:35:06 +0000 (12:35 +0200)]
core: fix a potential mem leak

Found with Coverity. Fixes: CID#996438

9 years agoanalyze: fix mem leak
Thomas Hindoe Paaboel Andersen [Sat, 13 Sep 2014 10:29:43 +0000 (12:29 +0200)]
analyze: fix mem leak

Found with Coverity. Fixes: CID#1237756

9 years agocore: smack-setup: Actually allow for succesfully loading CIPSO policy
Philippe De Swert [Fri, 12 Sep 2014 13:49:48 +0000 (16:49 +0300)]
core: smack-setup: Actually allow for succesfully loading CIPSO policy

The line under the last switch statement  *loaded_policy = true;
would never be executed. As all switch cases return 0. Thus the
policy would never be marked as loaded.

Found with Coverity. Fixes: CID#1237785

9 years agoanalyze: avoid a null dereference
Thomas Hindoe Paaboel Andersen [Thu, 11 Sep 2014 21:41:44 +0000 (23:41 +0200)]
analyze: avoid a null dereference

If we have an error in the early sd_bus_* calls then unit_times
will still be null.

Found with coverity. Fixes: CID#996464

9 years agoudev: timeout - warn after a third of the timeout before killing
Tom Gundersen [Thu, 11 Sep 2014 16:49:04 +0000 (18:49 +0200)]
udev: timeout - warn after a third of the timeout before killing

9 years agofirstboot: silence a warning
Thomas Hindoe Paaboel Andersen [Thu, 11 Sep 2014 19:29:59 +0000 (21:29 +0200)]
firstboot: silence a warning

No change in behavoir as the fallthrough from ARG_COPY had already
set arg_copy_locale to true.

Found with coverity. Fixes: CID#1237622

9 years agomanager: use correct cleanup function
Thomas Hindoe Paaboel Andersen [Thu, 11 Sep 2014 19:14:53 +0000 (21:14 +0200)]
manager: use correct cleanup function

Close the dir instead of attempt to free it.

Introduced in 874310b7b68c4c0d36ff07397db30a959bb7dae5

Found with coverity. Fixes: CID#996368

9 years agoactivate: fix fd leak in do_accept()
Philippe De Swert [Wed, 10 Sep 2014 19:14:41 +0000 (22:14 +0300)]
activate: fix fd leak in do_accept()

Found with Coverity.

9 years agotest: fix mem-leak in fdopen() test
David Herrmann [Thu, 11 Sep 2014 15:37:30 +0000 (17:37 +0200)]
test: fix mem-leak in fdopen() test

We must free FILE* after function return to not leak resources. Note that
this also closes our fd as fdopen() takes ownership of it.
Reported by Philippe De Swert (via coverity).

9 years agobus: unref buscreds on failure
Philippe De Swert [Wed, 10 Sep 2014 09:20:42 +0000 (12:20 +0300)]
bus: unref buscreds on failure

Actually unref the buscreds when we are not going to return a
pointer to them. As when bus_creds_add_more fails we immediately
return the error code otherwise and leak the new buscreds.
Found with coverity. Fixes: CID#1237761

9 years agojournal: do not leak mmaps on OOM
Philippe De Swert [Wed, 10 Sep 2014 09:20:41 +0000 (12:20 +0300)]
journal: do not leak mmaps on OOM

After a section of memory is succesfully allocated, some of the following
actions can still fail due to lack of memory. In this case -ENOMEM is
returned without actually freeing the already mapped memory.
Found with coverity. Fixes: CID#1237762

9 years agoterminal: fix uninitialized variable in strerror() log message
David Herrmann [Thu, 11 Sep 2014 15:20:11 +0000 (17:20 +0200)]
terminal: fix uninitialized variable in strerror() log message

We currently print weird error-messages if xkbcommon fails (which cannot
fail so far, but might in the future). Fix the uninitialized variable
warnings by setting 'r' correctly.
Thanks to Philippe De Swert for catching this (via coverity).

9 years agojournal: do not dereference already freed patterns
Philippe De Swert [Wed, 10 Sep 2014 09:20:39 +0000 (12:20 +0300)]
journal: do not dereference already freed patterns

In case set_consume goes wrong, the pattern name has already been
freed. So we do not try to print it in the logs, assuming the pattern
addition print will be printed just before the failure anyway. Found
with coverity. Fixes: CID#1237798

9 years agobus: avoid using m->kdbus after freeing it
Philippe De Swert [Wed, 10 Sep 2014 09:20:38 +0000 (12:20 +0300)]
bus: avoid using m->kdbus after freeing it

m->kdbus could be freed before it is released. Changing the
order fixes the issue.

Found with Coverity. Fixes: CID#1237798

9 years agoterminal: drop redundant assertion
David Herrmann [Thu, 11 Sep 2014 13:30:56 +0000 (15:30 +0200)]
terminal: drop redundant assertion

This assertion is already there two lines down. Drop the redundant
assertion.

9 years agoterminal: fix wrong return value in idev if fcntl() fails
David Herrmann [Thu, 11 Sep 2014 13:29:58 +0000 (15:29 +0200)]
terminal: fix wrong return value in idev if fcntl() fails

This might cause >=0 to be returned, even though the method failed. Fix
this and return -errno.

9 years agoterminal: enable sessions in evcat after taking control
David Herrmann [Thu, 11 Sep 2014 13:28:37 +0000 (15:28 +0200)]
terminal: enable sessions in evcat after taking control

If we enable a session, any probed device might get immediately enabled.
This might cause TakeDevice() messages to be sent before we call
TakeControl(). Therefore, enable sessions *after* sending TakeControl() so
we always succeed if TakeControl() succeeds.

9 years agoterminal: remove unused set.h inclusion in idev
David Herrmann [Thu, 11 Sep 2014 13:27:56 +0000 (15:27 +0200)]
terminal: remove unused set.h inclusion in idev

We don't use set.h so no need to include it. We used to include it for
temporary refs on all idev devices of a session, but that never was pushed
upstream.

9 years agoudev: allow removing tags via TAG-="foobar"
David Herrmann [Thu, 11 Sep 2014 11:25:21 +0000 (13:25 +0200)]
udev: allow removing tags via TAG-="foobar"

This extends the udev parser to support OP_REMOVE (-=) and adds support
for TAG-= to remove previously set tags. We don't fail if the tag didn't
exist.

This is pretty handy if we ship default rules for seat-assignments and
users want to exclude specific devices from that. They can easily add
rules that drop any automatically added "seat" tags again.

9 years agoterminal: remove redundant "struct" prefixes
David Herrmann [Tue, 2 Sep 2014 12:19:38 +0000 (14:19 +0200)]
terminal: remove redundant "struct" prefixes

We define typedefs for all internal types so drop the redundant "struct"
prefix.

9 years agoterminal: discard async read() errors for evdev
David Herrmann [Tue, 2 Sep 2014 12:17:59 +0000 (14:17 +0200)]
terminal: discard async read() errors for evdev

If read() fails on evdev devices, we deal with this in idev_evdev_hup().
It is very likely this is an async revoke, therefore, we must not abort.
Fix our io helper to discard such errors after passing them to
idev_evdev_hup(), so we don't bail out of the event loop.

9 years agobacklight: Avoid error when state restore is disabled
Michael Biebl [Wed, 10 Sep 2014 22:49:36 +0000 (00:49 +0200)]
backlight: Avoid error when state restore is disabled

When the state restore is disabled, we would print:
"Unknown verb: load" instead of simply skipping loading the
state.

9 years agoudev: timeout - increase timeout
Tom Gundersen [Wed, 10 Sep 2014 08:56:26 +0000 (10:56 +0200)]
udev: timeout - increase timeout

Some kernel modules still take more than one minute to insmod, we no longer rely on the timeout
killing insmod within a given period of time, so just bump this to a much higher value. Its only
purpose is to make sure that nothing stays aronud forever.

9 years agoudev: fix copy-paste error in log message
Tom Gundersen [Wed, 10 Sep 2014 05:59:22 +0000 (07:59 +0200)]
udev: fix copy-paste error in log message

9 years agoTODO: Remove Elapsed Time DHCPv6 option as it is done
Patrik Flykt [Mon, 1 Sep 2014 10:21:35 +0000 (13:21 +0300)]
TODO: Remove Elapsed Time DHCPv6 option as it is done

9 years agotest-dhcp6-client: Add checks for Elapsed Time option
Patrik Flykt [Mon, 1 Sep 2014 10:21:34 +0000 (13:21 +0300)]
test-dhcp6-client: Add checks for Elapsed Time option

Verify that the Elapsed Time option is present.

9 years agosd-dhcp6-client: Implement Elapsed Time option
Patrik Flykt [Mon, 1 Sep 2014 10:21:33 +0000 (13:21 +0300)]
sd-dhcp6-client: Implement Elapsed Time option

Implement Elapsed Time option as it is defined as MUST in RFC 3315,
section 22.9. The elapsed time value is a 1/100th of a second with
a max value of 0xffff, i.e. 655.35 seconds.

As the main loop might not be running yet when sd_dhcp6_client_start() is
called, fetch the monotonic time directly and not from the event loop
while in state DHCP6_STATE_STOPPED.

9 years agoudev - drop print_kmsg
Tom Gundersen [Tue, 9 Sep 2014 20:48:07 +0000 (22:48 +0200)]
udev - drop print_kmsg

The only remaining user was 'starting version XXX', which is now logged using log_info().

9 years agoudev: netif_rename - don't log to kmsg
Tom Gundersen [Tue, 9 Sep 2014 20:45:03 +0000 (22:45 +0200)]
udev: netif_rename - don't log to kmsg

As of 3.17, the kernel will do this on its own, so just do regular log_debug() logging from udev.

9 years agoudev: net_setup_link - open ethtool and rtnl connections lazily
Tom Gundersen [Tue, 9 Sep 2014 13:36:56 +0000 (15:36 +0200)]
udev: net_setup_link - open ethtool and rtnl connections lazily

9 years agoudev: event - keep one rtnl per worker, rather than per event
Tom Gundersen [Tue, 9 Sep 2014 09:15:37 +0000 (11:15 +0200)]
udev: event - keep one rtnl per worker, rather than per event

Creating the rtnl context is cheap, but freeing it may not be, due to
synchronous close().

Also drop some excessive logging. We now log about the changing ifname
exactly once.

9 years agoudev: import the full db on MOVE events for devices without dev_t
Tom Gundersen [Tue, 9 Sep 2014 10:23:19 +0000 (12:23 +0200)]
udev: import the full db on MOVE events for devices without dev_t

9 years agobuild-sys: make hibernation support configure option also handle hybrid-sleep; fix...
Ivan Shapovalov [Mon, 8 Sep 2014 21:40:51 +0000 (01:40 +0400)]
build-sys: make hibernation support configure option also handle hybrid-sleep; fix indentation

9 years agohwdb: update
Marcel Holtmann [Tue, 9 Sep 2014 05:44:02 +0000 (07:44 +0200)]
hwdb: update

9 years agoexecute: silence warnings
Thomas Hindoe Paaboel Andersen [Mon, 8 Sep 2014 20:10:36 +0000 (22:10 +0200)]
execute: silence warnings

Mark two function parameters as const

9 years agonamespace: avoid posible use of uninitialized variable
Thomas Hindoe Paaboel Andersen [Mon, 8 Sep 2014 20:05:17 +0000 (22:05 +0200)]
namespace: avoid posible use of uninitialized variable

9 years agorules: net-setup-link - remove stray linebreak
Mantas Mikulėnas [Mon, 8 Sep 2014 19:53:39 +0000 (22:53 +0300)]
rules: net-setup-link - remove stray linebreak

If not backslash-escaped, it splits the rule in two.

9 years agorules: net-setup-link - preserve ID_NET_LINK_FILE and ID_NET_NAME after MOVE
Tom Gundersen [Mon, 8 Sep 2014 15:16:24 +0000 (17:16 +0200)]
rules: net-setup-link - preserve ID_NET_LINK_FILE and ID_NET_NAME after MOVE

9 years agomachined: remove redundant sd_notify
Dave Reisner [Mon, 8 Sep 2014 13:27:41 +0000 (09:27 -0400)]
machined: remove redundant sd_notify

We already call this on via bus_event_loop_with_idle on exit. This
makes machined consistent with other similar daemons: localed,
hostnamed, timedated.

9 years agonetworkd: allow specification of DHCP route metric
Angus Gibson [Mon, 8 Sep 2014 10:26:47 +0000 (20:26 +1000)]
networkd: allow specification of DHCP route metric

This lets the routing metric for links to be specified per-network,
still defaulting to DHCP_ROUTE_METRIC (1024) if unspecified. Hopefully
this helps with multiple interfaces configured via DHCP.

9 years agonetworkctl: show the link file applied to each link
Tom Gundersen [Mon, 8 Sep 2014 12:18:32 +0000 (14:18 +0200)]
networkctl: show the link file applied to each link

9 years agoudev: link-config - only set *name on success
Tom Gundersen [Mon, 8 Sep 2014 12:17:46 +0000 (14:17 +0200)]
udev: link-config - only set *name on success

9 years agoudev: net_setup_link - export the .link filename applied to the link
Tom Gundersen [Mon, 8 Sep 2014 12:00:58 +0000 (14:00 +0200)]
udev: net_setup_link - export the .link filename applied to the link

9 years agonetworkctl: show the network file applied to each link
Tom Gundersen [Mon, 8 Sep 2014 12:00:34 +0000 (14:00 +0200)]
networkctl: show the network file applied to each link

9 years agosd-network: add _get_network_file api
Tom Gundersen [Mon, 8 Sep 2014 11:50:52 +0000 (13:50 +0200)]
sd-network: add _get_network_file api

9 years agoTODO
Tom Gundersen [Mon, 8 Sep 2014 11:12:06 +0000 (13:12 +0200)]
TODO

9 years agonetworkd: add preferred source to dhcp4 gateway route
Emil Renner Berthing [Fri, 5 Sep 2014 09:56:02 +0000 (11:56 +0200)]
networkd: add preferred source to dhcp4 gateway route

This makes DHCPv4 and IPv4LL coexist peacefully.

[tomegun: apply to both the dhcp routes, use in_addr_is_null() rather than a
separate variable to indicate when prefsrc should be applied]

9 years agounits: networkd - order after udev
Tom Gundersen [Sat, 6 Sep 2014 20:37:31 +0000 (22:37 +0200)]
units: networkd - order after udev

This way we are sure that /dev/net/tun has been given the right permissions before we try to connect to it.
Ideally, we should create tun/tap devices over netlink, and then this whole issue would go away.