Commit graph

13896 commits

Author SHA1 Message Date
Tom Gundersen efbc88b8ed networkd: improve link state change logging 2014-01-03 16:20:10 +01:00
Tom Gundersen d0d311d62f networkd: add some debug info about notifications we ignore 2014-01-03 16:02:12 +01:00
Kay Sievers 88c59cb3c1 bus: always create --user bus when kdbus is active
We set the variable in the unit file for --user, so this check is
always true.
2014-01-03 02:59:05 +01:00
Tom Gundersen ff25413852 networkd: link - explicitly set the link to be up if the call to IFF_UP succeeds
No need to wait for the NEWLINK message to arrive.
2014-01-03 02:18:55 +01:00
Zbigniew Jędrzejewski-Szmek 477e73b531 networkd: fix memory leak in error path 2014-01-02 19:49:49 -05:00
Zbigniew Jędrzejewski-Szmek 7384fa923e networkd: do not deference null pointer in cleanup 2014-01-02 19:49:43 -05:00
Zbigniew Jędrzejewski-Szmek d4c636603a core: fix gcc unused variable warning 2014-01-02 19:49:33 -05:00
Zbigniew Jędrzejewski-Szmek 0349c608c8 bus: fix memleak in sd_bus_creds_new_from_pid 2014-01-02 19:45:48 -05:00
Zbigniew Jędrzejewski-Szmek 5ce70e5bcd Introduce cleanup functions for cap_free
Unfortunately a different cleanup function is necessary per type,
because cap_t** and char** are incompatible with void**.
2014-01-02 19:45:48 -05:00
Zbigniew Jędrzejewski-Szmek ac6b760cee build-sys: add --disable-dbus autoconf option 2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek a0846368c8 build-sys: make valgrind-tests target output nicer 2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek 4ebe732c0c rtnl: fix memory corruptions after realloc
struct sd_rtnl_message would keep two additional pointers into the hdr
field. Every time hdr was realloced, those pointers should be adjusted,
but weren't. It seems less error-prone to keep offsets instead.
2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek 6ee4f99042 bus: break reference cycle between bus and messages
Because messages in the read and write queues hold a reference on the
bus, and the bus holds a reference on each of them, we would never
free the bus if the read or write queues were not empty. Explicitly
substract the number of messages in those queue from the bus reference
count when deciding whether to free or not.

A simple test which creates and unrefs simple objects is added.
2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek ccd06097c7 Use format patterns for usec_t, pid_t, nsec_t, usec_t
It is nicer to predefine patterns using configure time check instead of
using casts everywhere.

Since we do not need to use any flags, include "%" in the format instead
of excluding it like PRI* macros.
2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek ab9001a1e3 Move bus path definitions to def.h 2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek da13d4d20f core/service: check if mainpid matches only if it is set
https://bugzilla.redhat.com/show_bug.cgi?id=1047304
2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek a9244623f7 core/manager: print info about interesting signals
Information about signals which are not routinely received by systemd
are printed at info level. This should make it easier to see what is
happening in the system.
2014-01-02 19:45:47 -05:00
Zbigniew Jędrzejewski-Szmek 41aef6fc74 core/service: tweak messages on operation timeouts 2014-01-02 19:45:47 -05:00
Tom Gundersen a2db1d6b3f libsystemd-dhcp: don't assert on client_stop()
We need to be able to stop the dhcp client at any time, and the function appears to be written to handle this.
2014-01-03 01:42:26 +01:00
Tom Gundersen b1b532f58c networkd: dhcp - avoid null pointer dereference 2014-01-03 01:42:26 +01:00
Tom Gundersen 1746cf2ad7 networkd: add more asserts and ignore all events when link has failed 2014-01-03 01:42:26 +01:00
Kay Sievers b11d8d1993 rules: drivers - do not reset RUN list 2014-01-03 01:32:03 +01:00
Tom Gundersen 06a6e59301 networkd: only track state of links we are managing
If a network is not (yet) set for a link, we do not care about its state (as we
anyway don't know what to do with it).
2014-01-02 15:56:10 +01:00
Tom Gundersen 449f755492 networkd: improve logging
Remove redundant messages, add some debugging ones and make wording more uniform.
2014-01-02 15:49:23 +01:00
Kay Sievers be9326ca1d networkd: fix NULL pointer deref 2014-01-02 05:16:14 +01:00
Tom Gundersen 5eb036ca53 networkd: fix getting initial state
We were requesting the state and then ignoring it...
2014-01-02 01:43:05 +01:00
Tom Gundersen f5be560181 networkd: add DHCPv4 support
This adds basic DHCPv4 support. Link-sense is enabled unconditionally,
but the plan is to make that configurable.

I tested this in a VM with lots of NICs and over wifi in the various
coffee shops I found this Christmas, but more testing would definitely
be appreciated.
2014-01-01 16:26:27 +01:00
Tom Gundersen f048a16b46 networkd: distinguish between static and dynamic addresses/routes
Static addresses/routes are associated with a network. Dynamic
addresses/routes are associtade with links (as the corresponding network
may be shared by several links).
2014-01-01 16:23:00 +01:00
Tom Gundersen 407fe036a2 network: add support for dropping address 2014-01-01 15:12:50 +01:00
Zbigniew Jędrzejewski-Szmek 9b55cd5665 build-sys: make test output a bit nicer 2013-12-31 13:00:57 -05:00
Zbigniew Jędrzejewski-Szmek 7a7c74cae4 dhcp: fix creation of req_opts array
GREEDY_REALLOC needs to have two size variables: one for the
allocated size, and a second one for the used size. Using
the allocated size only lead to leaving some elements unitialized
and assigning some more than once.
2013-12-31 13:00:57 -05:00
Zbigniew Jędrzejewski-Szmek aa9ed65389 build-sys: make test-dhcp-* statically linked
This makes them behave like everything else following
48d7417d3 'build-sys: link most internal libraries statically'.
2013-12-31 13:00:57 -05:00
Zbigniew Jędrzejewski-Szmek dabeaa460d sleep-config: fix double free
Before 34a3baa4d 'sleep-config: Dereference pointer before check for NULL'
oom conditions would not be detected properly. After that commit, a double
free was performed.

Rework the whole function to be easier to understand, and also replace
strv_split_nulstr with strv_new, since we know the strings anyway.
2013-12-31 13:00:57 -05:00
Stefan Beller b8265d4f8e boot-efi: Remove superfluous assignment
2 lines after the changed line we assign err to efi_get_variable(...)
unconditionally, so it makes no sense to initialize it to some value.
2013-12-31 17:53:30 +01:00
Stefan Beller 34a3baa4db sleep-config: Dereference pointer before check for NULL
This fixes a bug pointed out by http://css.csail.mit.edu/stack/
(Optimization-unstable code)
It is a similar fix as f146f5e159 (2013-12-30, core:
Forgot to dereference pointer when checking for NULL)

To explain this bug consider the following similar, but simpler code:
	if (!p)
		free(*p)

Assume the if condition evaluates to true, then we will access *p,
which means the compiler can assume p is a valid pointer, so it could
dereference p and use the value *p.
Assuming p as a valid pointer, !p will be false.
But initally we assumed the condition evaluates to true.

By this reasoning the optimizing compiler can deduce, we have dead code.
("The if will never be taken, as *p must be valid, because otherwise
accessing *p inside the if would segfault")

This led to an error message of the static code checker, so I checked the
code in question.

As we access *modes and *states before the check in the changed line of
this patch, I assume the line to be wrong and we actually wanted to check
for *modes and *states being both non null.
2013-12-30 19:10:22 +01:00
Stefan Beller 226b735a74 bootchart: Remove unneeded check for NULL
Directly before the changed line there is:

	while ((parent->next_ps && parent->pid != ps->ppid))
		parent = parent->next_ps;

which looks one element ahead of the list, hence we can rely on parent
being non null here.
If 'parent' were NULL at that while loop already, it would crash as we're
dereferencing 'parent' when checking for next_ps already.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
2013-12-30 19:10:22 +01:00
Zbigniew Jędrzejewski-Szmek 8181565124 tmpfiles: rename --unsafe to --boot
As suggested by Kay, it is better to describe what is done,
not what might happen.
2013-12-30 13:01:27 -05:00
Zbigniew Jędrzejewski-Szmek 8f8770706e build-sys: fix systemd-stdio-bridge link to work with split /usr
shumski> there seems to be slight error in systemd git master Makefile.am
2013-12-30 12:11:13 -05:00
Stefan Beller f146f5e159 core: Forgot to dereference pointer when checking for NULL
Actually we already checked for !rt before, now we'd like to examine
the return value of the memory allocation.
2013-12-30 16:23:13 +01:00
Zbigniew Jędrzejewski-Szmek 3cf148f307 man: expand on some more subtle points in systemd.socket(5)
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727708#1694
2013-12-30 00:17:16 -05:00
Zbigniew Jędrzejewski-Szmek 819c7e4fa4 systemd-python: fix listen_fds under Python 2 2013-12-30 00:17:16 -05:00
Zbigniew Jędrzejewski-Szmek b560cc1c45 systemd-python: fix setting of exception codes
The return value of 0 would be treated as failure by mistake,
resulting in " SystemError: error return without exception set".
The way that set_error() is used is changed to be the same
everywhere.
2013-12-30 00:17:15 -05:00
Zbigniew Jędrzejewski-Szmek 892213bf1f acticate: rename --environment to --setenv
Nspawn has --setenv, and systemd itself accepts systemd.setenv.
It is nice to have the same parameter name everywhere.

Old name is accepted, but not advertised.
2013-12-30 00:17:15 -05:00
Kay Sievers ed14edc04f udev: LOG_PRIORITY -> LOG_LEVEL 2013-12-29 18:05:25 +01:00
Thomas Hindoe Paaboel Andersen a8c78decf0 autogen: add shortcut for running scan-build
scan-build is a static analyzer in llvm. As ususal static analyzers
tend to mostly find theoretical bugs in software that has been in
production for a while. For in-development code it can be useful to
check if new issues is added as there is a chance to spot real problems
before release. For systemd we are now down to 297 issues - the vast
majority are false positives because the tool does not understand the
cleanup attribute.

Running clang's static analyzer scan-build is a bit messy. You have to
run both configure and make "inside" the build-scan tool. To have an
easy shortcut from autogen.sh I thus call both directly from it. This
makes it different from the other options in autogen.sh. I chose 's'
for static analysis.

scan-build is in the package clang-analyzer on fedora.
2013-12-28 22:31:01 +01:00
Thomas Hindoe Paaboel Andersen bd3539b222 autogen: add shortcut for building with clang
For a while I have been cleaning up warnings when building with clang.
There are currently only two sources of warnings left: Wcast-align and Wgnu.
I am not convinced that fixing up those up is feasible so I run with them
disabled to spot regressions. E.g. clang is a bit more strict wrt to unused
variables with the cleanup attribute and I have fixed a number of those since.

Like the other options in autogen.sh I have a shortcut for clang as well. I use
'l' for llvm.
2013-12-28 21:24:25 +01:00
Marc-Antoine Perennou 08c51903fb gitignore: add back user@.service 2013-12-28 15:19:25 +01:00
Lennart Poettering d14ab08b29 bus: fix a couple of format string mistakes 2013-12-28 15:09:26 +01:00
Marc-Antoine Perennou 63b575175e bus: driverd; add missing format string parameter
This was causing a nasty coredump
2013-12-28 15:09:26 +01:00
Lennart Poettering 62ae757009 bus: correct a number of gcc format string attribute usages 2013-12-28 15:09:26 +01:00