summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODING_STYLE28
-rw-r--r--TODO3
-rw-r--r--src/libsystemd/sd-bus/bus-objects.c22
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c10
4 files changed, 33 insertions, 30 deletions
diff --git a/CODING_STYLE b/CODING_STYLE
index a96ddd3598..f13f9becbc 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -295,25 +295,15 @@
EXIT_FAILURE and EXIT_SUCCESS as defined by libc.
- The order in which header files are included doesn't matter too
- much. However, please try to include the headers of external
- libraries first (these are all headers enclosed in <>), followed by
- the headers of our own public headers (these are all headers
- starting with "sd-"), internal utility libraries from src/shared/,
- followed by the headers of the specific component. Or in other
- words:
-
- #include <stdio.h>
- #include "sd-daemon.h"
- #include "util.h"
- #include "frobnicator.h"
-
- Where stdio.h is a public glibc API, sd-daemon.h is a public API of
- our own, util.h is a utility library header from src/shared, and
- frobnicator.h is an placeholder name for any systemd component. The
- benefit of following this ordering is that more local definitions
- are always defined after more global ones. Thus, our local
- definitions will never "leak" into the global header files, possibly
- altering their effect due to #ifdeffery.
+ much. systemd-internal headers must not rely on an include order, so
+ it is safe to include them in any order possible.
+ However, to not clutter global includes, and to make sure internal
+ definitions will not affect global headers, please always include the
+ headers of external components first (these are all headers enclosed
+ in <>), followed by our own exported headers (usually everything
+ that's prefixed by "sd-"), and then followed by internal headers.
+ Furthermore, in all three groups, order all includes alphabetically
+ so duplicate includes can easily be detected.
- To implement an endless loop, use "for (;;)" rather than "while
(1)". The latter is a bit ugly anyway, since you probably really
diff --git a/TODO b/TODO
index 0094285017..587f17bc5e 100644
--- a/TODO
+++ b/TODO
@@ -316,8 +316,6 @@ Features:
(throughout the codebase, not only PID1)
* networkd:
- - make DHCP server IP range configurable, including only with a single IP address
- - dhcp server: try to assign stable IP addresses based on client's MAC address
- add LLDP client side support
- the DHCP lease data (such as NTP/DNS) is still made available when
a carrier is lost on a link. It should be removed instantly.
@@ -332,6 +330,7 @@ Features:
support Name=foo*|bar*|baz ?
- duplicate address check for static IPs (like ARPCHECK in network-scripts)
- allow DUID/IAID to be customized, see issue #394.
+ - support configuration option for TSO (tcp segmentation offload)
- networkd: whenever uplink info changes, make DHCP server send out FORCERENEW
* resolved:
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
index 0593aa658a..1d061cb9cf 100644
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -169,11 +169,18 @@ static int add_enumerated_to_set(
return 0;
}
+enum {
+ /* if set, add_subtree() works recursively */
+ CHILDREN_RECURSIVE = (1U << 1),
+ /* if set, add_subtree() scans object-manager hierarchies recursively */
+ CHILDREN_SUBHIERARCHIES = (1U << 0),
+};
+
static int add_subtree_to_set(
sd_bus *bus,
const char *prefix,
struct node *n,
- bool skip_subhierarchies,
+ unsigned int flags,
Set *s,
sd_bus_error *error) {
@@ -205,8 +212,9 @@ static int add_subtree_to_set(
if (r < 0 && r != -EEXIST)
return r;
- if (!skip_subhierarchies || !i->object_managers) {
- r = add_subtree_to_set(bus, prefix, i, skip_subhierarchies, s, error);
+ if ((flags & CHILDREN_RECURSIVE) &&
+ ((flags & CHILDREN_SUBHIERARCHIES) || !i->object_managers)) {
+ r = add_subtree_to_set(bus, prefix, i, flags, s, error);
if (r < 0)
return r;
if (bus->nodes_modified)
@@ -221,7 +229,7 @@ static int get_child_nodes(
sd_bus *bus,
const char *prefix,
struct node *n,
- bool skip_subhierarchies,
+ unsigned int flags,
Set **_s,
sd_bus_error *error) {
@@ -237,7 +245,7 @@ static int get_child_nodes(
if (!s)
return -ENOMEM;
- r = add_subtree_to_set(bus, prefix, n, skip_subhierarchies, s, error);
+ r = add_subtree_to_set(bus, prefix, n, flags, s, error);
if (r < 0) {
set_free_free(s);
return r;
@@ -907,7 +915,7 @@ static int process_introspect(
assert(n);
assert(found_object);
- r = get_child_nodes(bus, m->path, n, false, &s, &error);
+ r = get_child_nodes(bus, m->path, n, 0, &s, &error);
if (r < 0)
return bus_maybe_reply_error(m, r, &error);
if (bus->nodes_modified)
@@ -1173,7 +1181,7 @@ static int process_get_managed_objects(
if (require_fallback || !n->object_managers)
return 0;
- r = get_child_nodes(bus, m->path, n, true, &s, &error);
+ r = get_child_nodes(bus, m->path, n, CHILDREN_RECURSIVE, &s, &error);
if (r < 0)
return r;
if (bus->nodes_modified)
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 4ed508427e..4a9181613a 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1241,6 +1241,8 @@ fail:
int bus_set_address_user(sd_bus *b) {
const char *e;
+ uid_t uid;
+ int r;
assert(b);
@@ -1248,6 +1250,10 @@ int bus_set_address_user(sd_bus *b) {
if (e)
return sd_bus_set_address(b, e);
+ r = cg_pid_get_owner_uid(0, &uid);
+ if (r < 0)
+ uid = getuid();
+
e = secure_getenv("XDG_RUNTIME_DIR");
if (e) {
_cleanup_free_ char *ee = NULL;
@@ -1256,9 +1262,9 @@ int bus_set_address_user(sd_bus *b) {
if (!ee)
return -ENOMEM;
- (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee);
+ (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, ee);
} else
- (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
+ (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, uid);
if (!b->address)
return -ENOMEM;