Commit graph

1085 commits

Author SHA1 Message Date
Umut Tezduyar Lindskog aba496a58a networkd: smooth transition from ipv4ll to dhcp address
Currently when both ipv4ll and dhcp are enabled, ipv4ll
address (if one has been claimed) is removed when dhcp
address is aquired. This is not the best thing to do
since there might be clients unaware of the removal
trying to communicate.

This patch provides a smooth transition between ipv4ll
and dhcp. If ipv4ll address was claimed [1] before dhcp,
address is marked as deprecated. Deprecated address is still
a valid address and packets can be received on it but address
cannot be selected as a source address. If dhcp lease cannot
be extended, then ipv4ll address is marked as valid again.

[1] If there is no collision, claiming IPv4LL takes between 4 to
7 seconds.
2014-04-03 16:00:25 +02:00
Tom Gundersen 689703f618 sd-rtnl: modernize a bit 2014-03-31 14:43:34 +02:00
Lukasz Skalski 5fa4ddb88c doc: fix items' names in PORTING-DBUS1 2014-03-31 14:23:49 +02:00
Steven Siloti c8a7165f58 sd-rtnl: fix off-by-one
Also fix type parameter passed to new0
2014-03-31 09:54:37 +02:00
Tom Gundersen 3cbbb3e678 sd-rtnl: types - hook up bond types
Reported by Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
2014-03-29 23:53:03 +01:00
Tom Gundersen 0834ff93c3 sd-rtnl: message - fix clang compile warning 2014-03-29 23:52:03 +01:00
Tom Gundersen aef0768e6c sd-rtnl: message - don't log about out-of-range attribute types
We will easily get these when running on newer kernels. However, we can safely ignore them as we
anyway don't know what to do with them.
2014-03-28 19:16:21 +01:00
Tom Gundersen d8e538ecd9 sd-rtnl: rework rtnl type system
Use a static table with all the typing information, rather than repeated
switch statements. This should make it a lot simpler to add new types.

We need to keep all the type info to be able to create containers
without exposing their implementation details to the users of the library.

As a freebee we verify the types of appended/read attributes.

The API is extended to nicely deal with unions of container types.
2014-03-28 19:11:59 +01:00
Tom Gundersen 9f5bbfe354 sd-rtnl: message - fix memory leak 2014-03-28 00:50:56 +01:00
Tom Gundersen 8c57830308 sd-rtnl: message - don't reference associated rtnl object
The object is not currently used, so just drop the refenence. If/when we end up
using the object in the future, we must make sure to deal with possible mutual
references between rtnl busses and their queued messages; as is done in sd-bus.
2014-03-28 00:50:50 +01:00
Thomas Hindoe Paaboel Andersen 9f2a50a300 silence warnings 2014-03-27 20:16:49 +01:00
Susant Sahani 9a6704a81f sd-rtnl: add support for tunnel attributes
Added support for tunneling netlink attrributes (ipip, gre, sit).
These works with kernel module ipip, gre and sit . The test cases are
moved to a separate file and manual test as well because they require
respective kernel modules as well.
2014-03-25 14:44:33 +01:00
Tom Gundersen 41ca2c206b sd-rtnl: message - don't try to enter unsupported containers
Currently we only support containers in RTM_*LINK messages.

Reported-by: "Thomas H.P. Andersen <phomes@gmail.com>"
2014-03-25 12:05:59 +01:00
Lennart Poettering 7514578081 sd-event: don't accidentally turn of watchdog timer event if we determine 0 2014-03-25 00:01:51 +01:00
Lennart Poettering 52444dc478 sd-event: initialization perturbation value right before we use it
That way, we don't forget to initialize it when the watchdog is
initialized before all event sources.
2014-03-24 23:54:21 +01:00
Lennart Poettering 56dc9aec21 sd-daemon: fix incorrect variable access 2014-03-24 23:54:14 +01:00
Lennart Poettering 79e16ce3bf networkd: fix a couple of memory leaks 2014-03-24 23:46:13 +01:00
Tom Gundersen 3caf0bc89b sd-rtnl: tests - drop redundant tests
These tests were both broken and redundant, so let's drop them.
2014-03-24 20:40:34 +01:00
Lennart Poettering 1cfc57e884 build-sys: add makefile link 2014-03-24 19:57:29 +01:00
Tom Gundersen e634cd4096 sd-rtnl: message parsing - log when ignoring message attributes 2014-03-24 16:59:31 +01:00
Tom Gundersen 3dd215e056 sd-rtnl: add sd_rtnl_message_enter_container()
Extend rta_offset_tb into a stack of offset tables, one for each parent of the
current container, and make sd_rtnl_message_{enter,exit}_container() pop/push
to this stack.

Also make sd_rtnl_message_rewind() parse the top-level container, and use this
when reading a message from the socket.

This changes the API by dropping the now redundant sd_rtnl_message_read()
method.
2014-03-24 16:59:30 +01:00
Daniel Mack e955c45881 sd-bus: invert bus->is_kernel check in sd_bus_get_peer_creds()
The bug was introducted in a3d59cd1 ("sd-bus: don't use assert_return()
to check for disconnected bus connections")
2014-03-24 14:45:34 +01:00
Lennart Poettering 3d94f76c99 util: replace close_pipe() with new safe_close_pair()
safe_close_pair() is more like safe_close(), except that it handles
pairs of fds, and doesn't make and misleading allusion, as it works
similarly well for socketpairs() as for pipe()s...
2014-03-24 03:22:44 +01:00
Lennart Poettering 6a0f1f6d5a sd-event: rework API to support CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM, too 2014-03-24 02:58:41 +01:00
Tom Gundersen f66eeb6bb6 sd-rtnl: message - protect against SEGFAULT when reading messages
Make sure the returned data fits the datatype we requested. Otherwise return -EIO.

Also fix a broken test that this exposed.
2014-03-23 21:54:16 +01:00
Tom Gundersen a212d0dadd sd-rtnl: message - don't skip parts of message when parsing
If a message type occurs repeatedly let the last one win.

Also, don't skip type == MAX.

Based on patch from: Susant Sahani <susant@redhat.com>
2014-03-23 17:51:23 +01:00
David Herrmann 374c356979 sd-bus: mark sd_bus_unref() as broken regarding self-refs
If you allocate a message with bus==NULL and then unref the main bus,
it will free your message underneath and your program will go boom!

To fix that, we really need to figure out what the semantics for
self-references (m->bus) should be and when/where/what accesses are
actually allowed.

Same is true for the pseudo-thread-safety we employ..
2014-03-22 19:35:25 +01:00
David Herrmann eb33a6f858 sd-bus: add note about sd_bus_unref() recursion
In sd_bus_unref() we check for self-reference loops and destruct our
queues in case we're the only reference holders. However, we do _not_
modify our own ref-count, thus effectively causing the
message-destructions to enter with the same reference count as we did.

The only reason this doesn't cause an endless recursion (or trigger
assert(m->n_ref > 0) in sd_bus_message_unref()) is the fact that we
decrease queue-counters _before_ calling _unref(). That's not obvious at
all, so add a big fat note in bus_reset_queues() to everyone touching that
code.
2014-03-22 18:06:38 +01:00
David Herrmann 22fdeadcc0 sd-rtnl: fix self-reference leaks
Like sd-bus, sd-rtnl can have self-references through queued messages. In
particular, each queued message has the following self-ref loop:
  rtnl->wqueue[i]->rtnl == rtnl
Same is true for "rqueue".

When sd_rtnl_unref() gets called, we must therefore make sure we correctly
consider each self-reference when deciding to destroy the object. For each
queued message, there _might_ be one ref. However, rtnl-messages can be
created _without_ a bus-reference, therefore we need to verify the
actually required ref-count.

Once we know exactly how many self-refs exist, and we verified none of the
queued messages has external references, we can destruct the object.
We must immediately drop our own reference, then flush all queues and
destroy the bus object. Otherwise, each sd_rtnl_message_unref() call would
recurse into the same destruction logic as they enter with the same
rtnl-refcnt.

Note: We really should verify _all_ queued messages have m->rtnl set to
      the bus they're queued on. If that's given, we can change:
        if (REFCNT_GET(rtnl->n_ref) <= refs)
      to
        if (REFCNT_GET(rtnl->n_ref) == refs)
      and thus avoid recalculating the required refs for each message we
      remove from the queue during destruction.
2014-03-22 18:00:03 +01:00
Lennart Poettering a3d59cd1b0 sd-bus: don't use assert_return() to check for disconnected bus connections
A terminated connection is a runtime error and not a developer mistake,
hence don't use assert_return() to check for it.
2014-03-19 21:41:21 +01:00
Lennart Poettering ae439c9f9b sd-bus: properly translate high-level attach flags into kdbus attach flags 2014-03-19 19:09:00 +01:00
Lennart Poettering d0ce77344b busctl: when monitoring the bus, enable all credentials 2014-03-19 16:25:11 +01:00
Lennart Poettering 0936559234 sd-bus: add proper monitoring API 2014-03-19 04:17:00 +01:00
Daniel Mack 5892a914d1 busname: introduce Activating directive
Add a new config 'Activating' directive which denotes whether a busname
is actually registered on the bus. It defaults to 'yes'.

If set to 'no', the .busname unit only uploads policy, which will remain
active as long as the unit is running.
2014-03-19 02:25:36 +01:00
Lennart Poettering d2e7b05f24 core: when creating an activating busname attach all metadata fields to the messages queued for it
This way we can be sure that the service the messages are ultimately
intended for finds all fields it might need.
2014-03-19 01:36:03 +01:00
Lennart Poettering f9d12d4439 update kdbus.h 2014-03-19 01:35:52 +01:00
Lennart Poettering 2ce97e2b04 sd-bus: if we got a message with fds attached even though we didn't negotiate it, refuse to take it
This makes sure we don't mishandle if developers specificy a different
AcceptFileDescriptors= setting in .busname units then they set for the
bus connection in the activated program.
2014-03-18 21:03:37 +01:00
Lennart Poettering 3f9da41645 core: add new AcceptFD= setting to .busname units
AcceptFD= defaults to true, thus making sure that by default fd passing
is enabled for all activatable names. Since for normal bus connections
fd passing is enabled too by default this makes sure fd passing works
correctly regardless whether a service is already activated or not.

Making this configurable on both busname units and in bus connections is
messy, but unavoidable since busnames are established and may queue
messages before the connection feature negotiation is done by the
service eventually activated. Conversely, feature negotiation on bus
connections takes place before the connection acquires its names.

Of course, this means developers really should make sure to keep the
settings in .busname units in sync with what they later intend to
negotiate.
2014-03-18 20:54:32 +01:00
Lennart Poettering 6340559506 test 2014-03-18 19:31:44 +01:00
Lennart Poettering 03e334a1c7 util: replace close_nointr_nofail() by a more useful safe_close()
safe_close() automatically becomes a NOP when a negative fd is passed,
and returns -1 unconditionally. This makes it easy to write lines like
this:

        fd = safe_close(fd);

Which will close an fd if it is open, and reset the fd variable
correctly.

By making use of this new scheme we can drop a > 200 lines of code that
was required to test for non-negative fds or to reset the closed fd
variable afterwards.
2014-03-18 19:31:34 +01:00
Lennart Poettering 58dfc42ecf build-sys: move sd-login src/login → src/libsystemd/sd-login
After all, it is ultimately linked to libsystems.so anyway, thus belongs
there and shares very little with the rest of logind, hence let's move
this away.
2014-03-17 18:35:48 +01:00
Lennart Poettering bf34ab149f sd-login: add calls that retrieve credentials of peers connected to AF_UNIX peers
This is supposed to be an extension of SO_PEERCRED and SO_PEERSEC,
except for cgroup information.
2014-03-17 18:15:57 +01:00
Miklos Vajna 6f285378aa core, libsystemd, systemd, timedate, udev: spelling fixes 2014-03-17 02:35:35 -04:00
Lennart Poettering 1238ee09b7 systemctl: introduce -r switch to show units running in local containers in addition to the host 2014-03-17 04:00:44 +01:00
Josh Triplett f8294e4175 Use strlen even for constant strings
GCC optimizes strlen("string constant") to a constant, even with -O0.
Thus, replace patterns like sizeof("string constant")-1 with
strlen("string constant") where possible, for clarity.  In particular,
for expressions intended to add up the lengths of components going into
a string, this often makes it clearer that the expression counts the
trailing '\0' exactly once, by putting the +1 for the '\0' at the end of
the expression, rather than hidden in a sizeof in the middle of the
expression.
2014-03-16 09:52:56 -04:00
Tom Gundersen 1f0db3ed88 sd-rtnl: never treat broadcasts as replies
Otherwise the sequence number of a broadcast may match the sequence number of a
pending unicast message and cause confusion.
2014-03-16 13:05:04 +01:00
Tom Gundersen 6a8402d956 sd-rtnl: make RTM_NEWLINK report EEXIST by default
Use RTM_SETLINK to update an existing link.
2014-03-15 20:04:42 +01:00
Lennart Poettering 5a4d665ad6 sd-bus: don't choke if somebody sends us a message with a unix fd count of 0
It's kinda pointless to include a unix fd header field in messages if it
carries the value 0, but let's do this anyway...
2014-03-14 21:17:14 +01:00
Lennart Poettering bbb6ff0216 sd-bus: don't access invalid memory if a signal matcher was freed from its own callback 2014-03-14 21:17:14 +01:00
Lennart Poettering 42c4ebcbd4 sd-bus: don't look for a 64bit value when we only have 32bit value on reply cookie hash table access
This broke hashtable lookups for the message cookies on s390x, which is
a 64bit BE machine where accessing 32bit values as 64bit and vice versa
will explode.

Also, while we are at it, be a bit more careful when dealing with the
64bit cookies we expose and the 32bit serial numbers dbus uses in its
payload.

Problem identified by Fridrich Strba.
2014-03-13 20:33:22 +01:00
Lennart Poettering 82923adfe5 bus: fix memory leak when kdbus is not enabled 2014-03-13 20:01:17 +01:00
Lennart Poettering 0325941fff sd-login: add sd_machine_get_class() call 2014-03-12 20:54:29 +01:00
Lennart Poettering a6278b8830 bus: replace sd_bus_label_{escape,unescape}() by new sd_bus_path_{encode,decode}()
The new calls work similarly, but enforce a that a common, fixed bus
path prefix is used.

This follows discussions with Simon McVittie on IRC that it should be a
good idea to make sure that people don't use the escaping applied here
too wildly as anything other than the last label of a bus path.
2014-03-11 19:03:50 +01:00
Daniel Mack 088b51107a sd-bus: sync kdbus.h 2014-03-08 18:22:44 +01:00
Daniel Mack b629d09842 sd-bus: check for potential integer overflow in KDBUS_ITEM_FOREACH()
For large values of item->size, the 'part' pointer can wrap around,
which results in an illegal pointer, but currently passes the for-loop
condition.
2014-03-08 14:18:48 +01:00
Tom Gundersen 59a7a68422 sd-rtnl: increase default timeout to match sd-bus 2014-03-08 01:12:46 +01:00
Daniel Mack 1683342af1 sd-bus: add support for policy upload on activator connections
Activator connections may upload policy when registering to the bus.
This patch contains code to translate between BusNamePolicy objects and
the kdbus specific items.
2014-03-07 19:14:05 +01:00
Daniel Mack f7c7cd03d1 sd-bus: sync kdbus.h (ABI break)
Bring kdbus.h in sync with recent policy related changes. Most notably,
KDBUS_MAKE_POLICY_OPEN is now gone. The rest doesn't matter for systemd
at this point, as the policy functionality was not yet used.
2014-03-07 19:14:05 +01:00
Susant Sahani 4e9e7f1836 sd-rtnl: introduce read ether and ip address functions
This patch introduces reading ethernet address and IPV4/IPv6
as well which is based on table based look up.

[tomegun: rename read_ether() to read_ether_addr() to match the append function.]
2014-03-07 17:39:04 +01:00
Zbigniew Jędrzejewski-Szmek effbc8e4f7 man: describe functions for appending to messages 2014-03-06 23:24:20 -05:00
Tom Gundersen d22f1006a1 sd-rtnl/networkd: use new rtnl_message_read() API and drop helper
With the new sd_rtnl_message_read_string(), there is no longer a need for
rtnl_message_get_ifname().
2014-03-06 19:44:37 +01:00
Susant Sahani 44caa5e7df sd-rtnl:introduce table-based lookup and typesafe read() functions
This patch introduces new netlink attribute parsing logic
which is table based lookup and sd_rtnl_message_read_*
methods for reading attributes. By doing this user does not
have to loop for the attribute values . Only providing the
attribute type it gets the attribute values which is optimized
and sd_rtnl_message_read_* methods are simplified.
2014-03-06 19:30:09 +01:00
Tom Gundersen 3b35ade3fd sd-rtnl: do not blindly enter containers in message_read()
We need a separate container_enter() function, which will be part of a largerg
API change. For now, just fix message_read().
2014-03-05 11:52:32 +01:00
Lennart Poettering e567439ec6 systemd-run: support all currently exported properties with -p 2014-03-05 04:08:04 +01:00
Lennart Poettering d584f63894 core: make the LimitXYZ= properties settable for transient service units 2014-03-05 04:08:04 +01:00
Lennart Poettering df31a6c0fe systemd-run: add new --property= switch that can set arbitrary properties for the unit that is created
The code for parsing these properties is shared with "systemctl
set-property", which means all the resource control settings are
immediately available.
2014-03-05 03:36:22 +01:00
Zbigniew Jędrzejewski-Szmek 6e18964d3a Introduce strv_consume which takes ownership
This mirrors set_consume and makes the common use a bit nicer.
2014-03-04 10:04:50 -05:00
Umut Tezduyar Lindskog 5c1d3fc93d sd-network: IPv4 link-local support [v2]
Implements IPv4LL with respect to RFC 3927
(http://tools.ietf.org/rfc/rfc3927.txt) and integrates it
with networkd. Majority of the IPv4LL state machine is
taken from avahi (http://avahi.org/) project's autoip.

IPv4LL can be enabled by IPv4LL=yes under [Network]
section of .network file.

IPv4LL works independent of DHCP but if DHCP lease is
aquired, then LL address will be dropped.

[tomegun: removed a trailing newline and a compiler warning]
2014-03-03 23:24:34 +01:00
Thomas Hindoe Paaboel Andersen 4d46396131 silence warning 2014-03-03 22:39:55 +01:00
Lennart Poettering 8f8f05a919 bus: add sd_bus_track object for tracking peers, and port core over to it
This is primarily useful for services that need to track clients which
reference certain objects they maintain, or which explicitly want to
subscribe to certain events. Something like this is done in a large
number of services, and not trivial to do. Hence, let's unify this at
one place.

This also ports over PID 1 to use this to ensure that subscriptions to
job and manager events are correctly tracked. As a side-effect this
makes sure we properly serialize and restore the track list across
daemon reexec/reload, which didn't work correctly before.

This also simplifies how we distribute messages to broadcast to the
direct busses: we only track subscriptions for the API bus and
implicitly assume that all direct busses are subscribed. This should be
a pretty OK simplification since clients connected via direct bus
connections are shortlived anyway.
2014-03-03 02:34:13 +01:00
Zbigniew Jędrzejewski-Szmek 1ae383a8a3 Use /var/run/dbus/system_bus_socket for the D-Bus socket 2014-02-25 21:26:42 -05:00
Lennart Poettering df1e020461 Revert back to /var/run at a couple of problems
This partially reverts 41a55c46ab

Some specifications we want to stay compatibility actually document
/var/run, not /run, and we should stay compatible with that. In order to
make sure our D-Bus implementation works on any system, regardless if
running systemd or not, we should always use /var/run which is the
only path mandated by the D-Bus spec.

Similar, glibc hardcodes the utmp location to /var/run, and this is
exposed in _UTMP_PATH in limits.h, hence let's stay in sync with this
public API, too.

We simply do not support systems where /var/run is not a symlink → /run.
Hence both are equivalent. Staying compatible with upstream
specifications hence weighs more than cleaning up superficial
appearance.
2014-02-26 02:47:43 +01:00
Zbigniew Jędrzejewski-Szmek 41a55c46ab Replace /var/run with /run in remaining places
/run was already used almost everywhere, fix the remaining places
for consistency.
2014-02-25 20:41:24 -05:00
Lennart Poettering c74e630d0c nspawn: add new switch --network-macvlan= to add a macvlan device to the container 2014-02-25 02:37:59 +01:00
Zbigniew Jędrzejewski-Szmek bdd13f6be4 Remove dead lines in various places
As pointed-out by clang -Wunreachable-code.

No behaviour changes.
2014-02-24 19:24:14 -05:00
Kay Sievers f01de9656d src/shared/ cannot reference symbols from libraries
../src/shared/unit-name.c:462: error: undefined reference to 'sd_bus_label_escape'
../src/shared/unit-name.c:477: error: undefined reference to 'sd_bus_label_unescape'
collect2: error: ld returned 1 exit status
2014-02-23 01:53:40 +01:00
David Herrmann d8148cc59d build-sys: remove libsystemd.sym duplicate
sd_memfd_new is available twice. Remove the second one.
2014-02-23 00:26:29 +01:00
Kay Sievers 2cfcd95a4a build-sys: fix libsystemd --enable-kdbus symbol export 2014-02-22 23:54:38 +01:00
Tom Gundersen 12e0f830f5 test: always use assert_se in tests 2014-02-22 21:24:36 +01:00
Lennart Poettering 6e9feda30d event: add new kind of event source called "post"
This new event source is triggered by the dispatching of any non-post
event source. It can thus be used to do clean-up or recheck work,
triggered by any other event source having been executed.

This is different from "defer" event source which are unconditionally
triggered as long as they are enabled. A "defer" event source that does
nothing will result in the event loop busy looping unless it is turned
off eventually. This is different for "post" event sources that will be
only triggered when some other non-post ran, and will thus not keep the
event loop busy on its own.
2014-02-21 21:13:53 +01:00
Thomas Bächler 9ac441c0f4 sd-event: Fix systemd crash when using timer units.
There was a copy-paste error introduced in commit c2ba3ad660
which causes the following error when using timer units:

Assertion '(x->type == SOURCE_MONOTONIC && y->type == SOURCE_MONOTONIC) || (x->type == SOURCE_REALTIME && y->type == SOURCE_REALTIME)'
failed at src/libsystemd/sd-event/sd-event.c:264, function latest_time_prioq_compare(). Aborting.
2014-02-21 14:06:50 +01:00
Daniel Mack c94d7fc3ce libsystemd: fix compiler warning in property_get_set_callbacks_run()
gcc (4.8.2, arm) doesn't understand that vtable_property_get_userdata()
will always set 'u' when it returns > 0. Hence, the warning is bogus,
but anyway.

  src/libsystemd/sd-bus/bus-objects.c:510:19: warning: 'u' may be used uninitialized in this function [-Wmaybe-uninitialized]

(and yes, indeed, even the reported line numbers are bogus in this case)
2014-02-20 17:18:07 +01:00
Lennart Poettering 151b9b9662 api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:

1. The object the new object is derived from is put first, if there is any

2. The object we are creating will be returned in the next arguments

3. This is followed by any additional arguments

Rationale:

For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.

Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.

Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that.
2014-02-20 00:03:10 +01:00
Jason A. Donenfeld 3db729cb8e sd-bus: the bus returned should be the first arg
This matches the API of previous headers, such as sd-journal.h.
2014-02-20 00:03:09 +01:00
Kay Sievers 2b0a23e864 build-sys: export experimental symbols only with --enable-kdbus 2014-02-19 20:53:18 +01:00
Lennart Poettering 23abf5d582 bus: fix unreffing logic 2014-02-19 20:36:17 +01:00
Kay Sievers add00dfd1f build-sys: merge libsystemd-journal into libsystemd 2014-02-19 18:12:58 +01:00
Lennart Poettering 0f0e240cb8 sd-id128: use new dev_urandom() call 2014-02-19 17:53:50 +01:00
Lennart Poettering 39883f622f make gcc shut up
If -flto is used then gcc will generate a lot more warnings than before,
among them a number of use-without-initialization warnings. Most of them
without are false positives, but let's make them go away, because it
doesn't really matter.
2014-02-19 17:53:50 +01:00
Thomas Hindoe Paaboel Andersen 17d47d8d2d busctl: add --no-legend and use in bash completion 2014-02-19 17:35:35 +01:00
Tom Gundersen 5723e1760f sd-rtnl: test - include missing.h to build on old kernels 2014-02-19 16:46:58 +01:00
Tom Gundersen d5eff74097 missing.h: add some IFLA_* constants
These were added to the kernel between 3.5 and 3.9, let's not require such
recent kernels (yet).
2014-02-19 15:50:24 +01:00
David Herrmann 7a0d4a3d16 event: fix crash on child-source state modifications
Setting a child-source state to anything but SD_EVENT_OFF currently does
nothing. The condition logic is flawed. Move the state update *below* the
test for the previous state.

Fixes a crash if you call:
  sd_event_source_set_enabled(source, SD_EVENT_ON);
  sd_event_source_unref(source);
on a child-source in its own callback.
2014-02-19 13:24:38 +01:00
Kay Sievers 0ebee88184 build-sys: merge libsystemd-daemon into libsystemd 2014-02-19 01:09:19 +01:00
Tom Gundersen 4fb7242cbb sd-rtnl-message: store reference to the bus in the message
This mimics the sd-bus api, as we may need it in the future.
2014-02-18 11:21:22 +01:00
Lennart Poettering 9f5650aecb util: generalize code that checks whether PIDs are alive or unwaited for 2014-02-18 02:51:47 +01:00
Jan Engelhardt 73e231abde doc: update punctuation
Resolve spotted issues related to missing or extraneous commas, dashes.
2014-02-17 19:03:07 -05:00
Tom Gundersen 489e4fbb8c sd-rtnl: do not require ifindex to be set for SETLINK messages
The kernel will then look up the ifindex itself based on the name.
This should be used very carefully as it is racey.

[This was a left-over hunk from my previous nspawn patch.]
2014-02-16 23:17:19 +01:00
Simon Peeters a3e648ccbb bus: fix match_parse for unquoted matches 2014-02-16 11:24:15 -05:00
Tom Gundersen 818dc5e72a sd-rtnl: always include linux/rtnetlink.h 2014-02-15 12:14:45 +01:00
Tom Gundersen ee3a6a51e5 sd-rtnl: message_open_container - don't take a 'size' argument
We can always know the size based on the type, so let's do this inside the library.
2014-02-15 12:14:45 +01:00
Tom Gundersen a7b74db6e7 sd-rtnl: link flags - don't allow change = 0
The kernel will happily treat 0x0 as 0xffffffff, but it is for backwards
compatibility only, so let's not perpetuate this.
2014-02-15 12:14:45 +01:00
Lennart Poettering 31a4e15384 rtnl: support adding VETH_INFO_PEER containers into rtnl messages 2014-02-13 18:47:53 +01:00
Lennart Poettering d595c5cc9e rtnl: rename constructors from the form sd_rtnl_xxx_yyy_new() to sd_rtnl_xxx_new_yyy()
So far we followed the rule to always indicate the "flavour" of
constructors after the "_new_" or "_open_" in the function name, so
let's keep things in sync here for rtnl and do the same.
2014-02-13 13:53:25 +01:00
Lennart Poettering cf6a891173 rtnl: drop "sd_" prefix from cleanup macros
The "sd_" prefix is supposed to be used on exported symbols only, and
not in the middle of names. Let's drop it from the cleanup macros hence,
to make things simpler.

The bus cleanup macros don't carry the "sd_" either, so this brings the
APIs a bit nearer.
2014-02-13 03:44:14 +01:00
David Herrmann a020c2a013 sd-bus: export sd_bus_call{,_async,_async_cancel}
The .sym file somehow lacks these declarations, so add these. You have to
run "make clean" to make sure the sym-test runs fine afterwards.
2014-02-10 23:25:10 +01:00
Susant Sahani 108e131ece sd-rtnl: added support for a few more attributes 2014-02-10 14:53:19 +01:00
Tom Gundersen 11fc2e833e sd-rtnl: test - improve test of MTU a bit
We are more likely to catch errors if we don't use '0' as test value.
2014-02-10 14:53:19 +01:00
Susant Sahani eedee64522 sd-rtnl: add test cases for link 2014-02-10 14:53:19 +01:00
Lennart Poettering f4d140e9a6 bus: properly unset default bus pointer when destroying last reference 2014-02-05 23:06:13 +01:00
Susant Sahani 7b1796403a Added attribute support for sd-rtnl
Added sd_rtnl_message_append_u8 and
  few attribute support in sd_rtnl_message_append_u32
       IFLA_GROUP, IFLA_TXQLEN, IFLA_NUM_TX_QUEUES, IFLA_NUM_RX_QUEUES
2014-02-05 00:07:29 +01:00
Lennart Poettering f389bf15d0 bus: when closing the bus don't end up in a recursive destruction deadlock 2014-02-03 19:59:18 +01:00
Kay Sievers 486e99a387 bus: update kdbus.h (ABI break) 2014-02-01 17:21:36 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Tom Gundersen 3815f36f05 sd-rtnl: beef up rtnl-util a bit 2014-01-30 14:30:39 +01:00
Kay Sievers cbe72e30eb bus: update kdbus.h (ABI break) 2014-01-28 12:07:20 +01:00
Lennart Poettering 847657c769 bus: update bloom filter description a bit 2014-01-28 01:05:32 +01:00
Lennart Poettering b28ff39f42 bus: rework bloom filter logic to operate with variable bloom filter
sizes and numbers of hash functions

In order to make the bloom filter logic more future proof communicate
bloom filter parameters from the original bus creator to the clients,
and allow them to be variable within certain ranges.
2014-01-28 00:57:38 +01:00
Lennart Poettering af08d2f9cd bus: add API calls for connecting to starter bus
Add new calls sd_bus_open() and sd_bus_default() for connecting to the
starter bus a service was invoked for, or -- if the process is not a
bus-activated service -- the appropriate bus for the scope the process
has been started in.
2014-01-27 21:34:54 +01:00
Lennart Poettering 968d3d242c resolve: update sd-resolve to match the other APIs in style and functionality 2014-01-27 20:12:59 +01:00
Lennart Poettering ff975efb2e bus: when we cannot bus activate a service because we go down, drop one
message from the queue
2014-01-27 20:12:59 +01:00
Zbigniew Jędrzejewski-Szmek 0a75bc612d build-sys: update .pc.in files 2014-01-25 18:55:58 -05:00
Zbigniew Jędrzejewski-Szmek be12791331 build-sys: merge libsystemd-id128 into libsystemd 2014-01-25 18:10:08 -05:00
Zbigniew Jędrzejewski-Szmek 0bba8d6eb7 build-sys: merge libsystemd-login into libsystemd
A compatibility libsystemd-login library is created which uses
.symver and ifunc magic proposed by Lennart to make programs linked
to the old library name continue to work seamlessly.

Unfortunately the bfd linker crashes:
  https://sourceware.org/bugzilla/show_bug.cgi?id=16467
This will be fixed in binutils 2.25.

As a work-around, gold can be used:
  LDFLAGS=-Wl,-fuse-ld=gold

Unfortunately the switch to pick the linker appeared in gcc 4.8.

This also doesn't work with LLVM:
  http://llvm.org/bugs/show_bug.cgi?id=11897
2014-01-25 18:10:08 -05:00
Tom Gundersen 168a3f602f sd-rtnl: extend tests a bit 2014-01-25 01:22:54 +01:00
Tom Gundersen e5c4350b0d sd-rtnl: add support for reading containers
Also insist on messages being sealed before reading them. In other
words we don't allow interleaving of reading and appending to messages.
2014-01-24 22:20:34 +01:00
Kay Sievers 1fa132931a bus: bump memfd vs. copy limit to 512k to reflect recent benchmarks 2014-01-24 21:16:37 +01:00
Tom Gundersen 5a081409c5 sd-rtnl: add support for nested containers 2014-01-24 19:56:01 +01:00
Kay Sievers c552d2e18b bus: update kdbus.h (ABI break) 2014-01-24 19:26:16 +01:00
Kay Sievers 18a281479d bus: update kdbus.h (ABI break) 2014-01-24 17:49:32 +01:00
Lennart Poettering eee9ec0e28 bus: change API to expose "inverted" no_reply and no_auto_start message flags non-inverted 2014-01-22 20:45:05 +01:00
Lennart Poettering 766c580959 bus: add sd_bus_process_priority() to support prioq mode of kdbus 2014-01-22 20:26:58 +01:00
Lennart Poettering ca7b42c816 bus: expose priority field of messages, in preparation for prioq support 2014-01-22 20:01:23 +01:00
Lennart Poettering 14008e4e9c busctl: include connection name in busctl output 2014-01-22 18:51:49 +01:00
Lennart Poettering 2578d51ebd bus: unescape connection name when reading it from credentials 2014-01-22 18:51:49 +01:00
Tom Gundersen 5a72317435 sd-rtnl: simplify sd_rtnl_message_addr_new()
Split out into sd_rtnl_message_addr_set_{prefixlen,flags,scope}().
2014-01-22 18:01:45 +01:00
Tom Gundersen 01b36069cc sd-rtnl: add sd_rtnl_message_append_u16() 2014-01-22 17:56:49 +01:00
Tom Gundersen 5d4795f372 sd-rtnl: link - allow setting the change mask 2014-01-22 17:56:49 +01:00
Lennart Poettering 41add995cf bus: pass timestamp info only to caller if he asked for it 2014-01-22 16:44:32 +01:00
Lennart Poettering cccb0b2cdb bus: include connection name in credentials structure 2014-01-22 16:40:40 +01:00
Lennart Poettering 8d1db1d154 bus: when allocating a memfd for usage in a bus connection, name the memfd after the bus connection 2014-01-22 16:16:04 +01:00
Lennart Poettering 5972fe953e bus: add support for attaching name to bus connections for debugging purposes 2014-01-22 16:09:59 +01:00
Lennart Poettering 7f96b1d814 bus: extend memfd api so that we can label memfds for debugging purposes 2014-01-22 13:06:04 +01:00
Lennart Poettering 1fedcf59e0 bus: rename sd_bus_get_realtime_timestamp() to sd_bus_get_realtime_usec()
This brings the calls into similar style as the respective functions in
libsystemd-journal, and also is a bi shorter and more descriptive since
it clarifies the time unit used.
2014-01-22 11:25:39 +01:00
Lennart Poettering 4fc319887e bus: simplify naming of feature negotation calls
Two verbs in a function name suck, so let's simplify this a bit.
2014-01-22 11:21:51 +01:00
Lennart Poettering 6a0e376c1c bus: add API for querying the kdbus message sequence number 2014-01-22 11:19:26 +01:00
Lennart Poettering 069f5e61eb bus: implement synchronous message calls via kernel ioctl 2014-01-21 21:42:49 +01:00
Tom Gundersen 607553f930 libsystemd: split up into subdirs
We still only produce on .so, but let's keep the sources separate to make things a bit
less messy.
2014-01-21 14:41:35 +01:00
Tom Gundersen c61be55d23 libsystemd-dhcp: revert merge into libsystemd
Unlike the other merged libs, the rest of libsystemd will never depend on
sd-dhcp-client, so there is no reason not to keep it separate.
2014-01-21 00:04:53 +01:00
Kay Sievers 97f82db325 Revert "sd-bus: let sd_bus_call() use the synchronous kdbus method"
This reverts commit 021b89861d.

Something is not quite right, "KillUnit" sent from systemctl is not
handled correctly and shutdown has problems.
2014-01-20 23:45:36 +01:00
Umut Tezduyar Lindskog 8c8f0fb968 sd-dhcp-client: refactor state machine check 2014-01-20 14:01:14 +01:00
Daniel Mack 021b89861d sd-bus: let sd_bus_call() use the synchronous kdbus method 2014-01-19 22:57:35 +01:00
Daniel Mack cb67f7184e bus-kernel: move bus_kernel_make_message
This makes future commits more readable.
2014-01-19 22:05:43 +01:00
Tom Gundersen b25ef18b33 sd-dhcp-client: refactor client_{free,new}
Make them more simiar to sd_bus and friends. Also factor out the event attachment. In the future,
we will likely want to support external main-loops, so this is a first step. For the time being,
we are still requiring an sd_event to be attached though.
2014-01-18 19:32:45 +01:00
Daniel Buch 35bbea48dc sd-resolv: declare functions from .h public 2014-01-18 17:52:10 +01:00
Daniel Buch 127b55d5a4 sd-resolve: rename get_next() and get_n_queries() + cleanup 2014-01-18 17:52:10 +01:00
Daniel Buch 885d1c80d9 sd-resolve: Allocate objects with new() 2014-01-18 17:52:10 +01:00
Daniel Buch 65883c9108 sd-resolve: get rid of sd_resolve_freeanswer() 2014-01-18 17:52:10 +01:00
Tom Gundersen 039ebe6aeb sd-dhcp-client/networkd: add domainname support 2014-01-18 17:52:10 +01:00
Daniel Mack e4ecabd0a4 libsystemd: sync kdbus.h 2014-01-18 00:50:37 +01:00
Daniel Buch 5599e86621 sd-resolve: rename structs to fit coding-style e.g 'struct MixedCase'
lets get this right once, and if not for all, atleast for now :)

So comments and input about nameing is very welcome.

Cheers
2014-01-17 19:51:28 +01:00
Daniel Buch 4f80925636 sd-resolve: get rid of _t post-fixes for sd_ objects
We dont want _t prefixes, right?
2014-01-17 19:51:24 +01:00
Lukasz Skalski 1ffee377ee bus: Fix read_word_le() function 2014-01-17 18:34:40 +01:00
Tom Gundersen b4b5212d31 libsystemd: rename LIBSYSTEMD_BUS to LIBSYSTEMD 2014-01-17 13:53:05 +01:00
Kay Sievers 9ff1897bb5 bus: update kdbus.h (ABI break) 2014-01-17 01:42:35 +01:00
Tom Gundersen 5ee482dfd3 sd-dhcp-client: minor style fixes
Also introduce a cleanup macro for DHCPLease
2014-01-16 20:32:09 +01:00
Tom Gundersen 7ae4ef6d23 sd-dhcp-client: refactor DNS support
Rather than keeping an array of pointers to addresses, just keep an array of addresses.
2014-01-16 20:32:08 +01:00
Tom Gundersen 1346b1f038 sd-dhcp-client/networkd: add transient hostname support 2014-01-16 20:32:08 +01:00
Zbigniew Jędrzejewski-Szmek c4e6e24255 bus: fix issue with reference counting
b7fc42e03 introduced a regression.
2014-01-16 01:15:17 -05:00
Zbigniew Jędrzejewski-Szmek b7fc42e03a bus: break reference cycle between bus and messages
Previously (6ee4f99 bus: break reference cycle between bus and
messages) I committed the test code, but not the actual fix :)
2014-01-16 00:16:02 -05:00
Tom Gundersen 4f882b2a50 sd-dhcp-client/networkd: add interface MTU support 2014-01-16 01:44:19 +01:00
Tom Gundersen eb2f9b1802 sd-rtnl: only alter link flags when reqeusted to 2014-01-16 01:41:12 +01:00
Tom Gundersen b087416f97 sd-dhcp-client: fix memory corruption 2014-01-16 01:41:12 +01:00
Lennart Poettering 31927c16de event: extend priority raneg to 64bit
The kdbus prioq logic will use 64bit prios too, so let's keep this
similar in style. Using 64bit here has the advantage, that pointers and
pretty much anything else can be mapped naturally to priorities if so
desired.
2014-01-15 20:16:20 +01:00
Tom Gundersen 3bedba4ae1 sd-resolv: rename to sd-resolve
Lennart pointed out that we were misspelling 'resolve'. Let's not repeat the mistakes of 'umount'
and 'resolv.conf'.
2014-01-14 18:25:16 +01:00
Tom Gundersen 8c56c8bd31 sd-resolv: remove left-over comment
We are anyway breaking the API by renaming everything, so that is not a concern.
2014-01-14 14:09:01 +01:00
Tom Gundersen 8a6233fb65 sd-resolv: require SOCK_CLOEXEC 2014-01-14 14:09:01 +01:00
Daniel Buch 12f404c4d1 sd-resolv: rename old asyncns variables 2014-01-14 13:32:13 +01:00
Daniel Buch 2a4be8ad98 sd_resolv: Rename structs- and function names to sd_resolv 2014-01-14 13:31:33 +01:00
Kay Sievers 135a4eb434 bus: update kdbus.h (ABI break) 2014-01-14 20:17:24 +08:00
Kay Sievers 9597086027 bus: update kdbus.h (ABI break) 2014-01-14 16:10:08 +08:00
Tom Gundersen 5681d7fb8b libsystemd-dns: merge into libsystemd
Also rename sd-dns -> sd-resolv.
2014-01-13 21:06:13 +01:00
Tom Gundersen 0b54473e9b libsystemd-rtnl: merge into libsystemd 2014-01-13 21:06:13 +01:00
Tom Gundersen c813ca40c8 libsystemd-dhcp: merge into libsystemd 2014-01-13 21:06:08 +01:00
Tom Gundersen 6bb648a16a libsystemd-bus: rename to libsystemd
Documentation was updated to refer to either 'libsystemd' or 'sd-bus' in place
of libsystemd-bus.
2014-01-13 18:54:19 +01:00