Compare commits

..

No commits in common. "4047a411f45e5e015126538902562416ed5aa5d3" and "a22e8850a8f2886f434d901f7923fe69e80a5d29" have entirely different histories.

16 changed files with 141 additions and 272 deletions

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: systemd master\n"
"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
"POT-Creation-Date: 2020-03-22 04:04+0000\n"
"PO-Revision-Date: 2020-03-25 18:40+0200\n"
"POT-Creation-Date: 2020-01-30 15:31+0000\n"
"PO-Revision-Date: 2020-02-07 12:37+0200\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <kde-i18n-uk@kde.org>\n"
"Language: uk\n"
@ -119,8 +119,7 @@ msgid "Change password of a home area"
msgstr "Зміна пароля до домашньої теки"
#: src/home/org.freedesktop.home1.policy:64
msgid ""
"Authentication is required to change the password of a user's home area."
msgid "Authentication is required to change the password of a user's home area."
msgstr ""
"Для зміни пароля для доступу до домашньої теки користувача слід пройти"
" розпізнавання."
@ -346,7 +345,8 @@ msgid "Flush device to seat attachments"
msgstr "Очисний пристрій для під'єднань до місця"
#: src/login/org.freedesktop.login1.policy:149
msgid "Authentication is required to reset how devices are attached to seats."
msgid ""
"Authentication is required to reset how devices are attached to seats."
msgstr ""
"Потрібна автентифікація, щоб перезапустити спосіб під'єднання до місць."
@ -375,8 +375,8 @@ msgstr "Вимкнути систему, коли програми намага
#: src/login/org.freedesktop.login1.policy:181
msgid ""
"Authentication is required to power off the system while an application is "
"inhibiting this."
"Authentication is required to power off the system while an application "
"is inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб вимкнути систему, коли програми намагаються "
"перешкодити цьому."
@ -395,8 +395,8 @@ msgstr "Перезавантажити, якщо інші користувачі
#: src/login/org.freedesktop.login1.policy:203
msgid ""
"Authentication is required to reboot the system while other users are logged "
"in."
"Authentication is required to reboot the system while other users are "
"logged in."
msgstr ""
"Потрібна автентифікація, щоб перезапустити систему, коли інші користувачі в "
"ній."
@ -407,8 +407,8 @@ msgstr "Перезапустити систему, коли програми н
#: src/login/org.freedesktop.login1.policy:214
msgid ""
"Authentication is required to reboot the system while an application is "
"inhibiting this."
"Authentication is required to reboot the system while an application "
"is inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб перезапустити систему, коли програми "
"намагаються перешкодити цьому."
@ -427,8 +427,8 @@ msgstr "Зупинити систему, коли інші користувач
#: src/login/org.freedesktop.login1.policy:236
msgid ""
"Authentication is required to halt the system while other users are logged "
"in."
"Authentication is required to halt the system while other users are "
"logged in."
msgstr ""
"Потрібна автентифікація, щоб зупинити систему, коли інші користувачі в ній."
@ -438,11 +438,10 @@ msgstr "Зупинити систему, коли програми намага
#: src/login/org.freedesktop.login1.policy:247
msgid ""
"Authentication is required to halt the system while an application is "
"inhibiting this."
"Authentication is required to halt the system while an application asked "
"to inhibit it."
msgstr ""
"Потрібна автентифікація, щоб зупинити систему, коли програма"
" намагається "
"Потрібна автентифікація, щоб зупинити систему, коли програми намагаються "
"перешкодити цьому."
#: src/login/org.freedesktop.login1.policy:257
@ -471,8 +470,8 @@ msgstr "Призупинити систему, коли програми нам
#: src/login/org.freedesktop.login1.policy:279
msgid ""
"Authentication is required to suspend the system while an application is "
"inhibiting this."
"Authentication is required to suspend the system while an application "
"is inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб призупинити систему, коли програми намагаються "
"перешкодити цьому."
@ -502,8 +501,8 @@ msgstr "Приспати систему, коли програми намага
#: src/login/org.freedesktop.login1.policy:311
msgid ""
"Authentication is required to hibernate the system while an application is "
"inhibiting this."
"Authentication is required to hibernate the system while an application "
"is inhibiting this."
msgstr ""
"Потрібна автентифікація, щоб приспати систему, коли програми намагаються "
"перешкодити цьому."
@ -513,7 +512,8 @@ msgid "Manage active sessions, users and seats"
msgstr "Керувати сеансами, користувачами і робочими місцями"
#: src/login/org.freedesktop.login1.policy:322
msgid "Authentication is required to manage active sessions, users and seats."
msgid ""
"Authentication is required to manage active sessions, users and seats."
msgstr ""
"Потрібна автентифікація, щоб керувати сеансами, користувачами і робочими "
"місцями."
@ -767,35 +767,26 @@ msgid "Authentication is required to reset DNS settings."
msgstr "Для скидання параметрів DNS до типових слід пройти розпізнавання."
#: src/network/org.freedesktop.network1.policy:143
msgid "DHCP server sends force renew message"
msgstr "Сервер DHCP надсилає повідомлення щодо примусового оновлення"
#: src/network/org.freedesktop.network1.policy:144
msgid "Authentication is required to send force renew message."
msgstr ""
"Потрібна автентифікація, щоб надіслати повідомлення щодо примусового оновлення"
#: src/network/org.freedesktop.network1.policy:154
msgid "Renew dynamic addresses"
msgstr "Оновлення динамічних адрес"
#: src/network/org.freedesktop.network1.policy:155
#: src/network/org.freedesktop.network1.policy:144
msgid "Authentication is required to renew dynamic addresses."
msgstr "Для оновлення динамічних адрес слід пройти розпізнавання."
#: src/network/org.freedesktop.network1.policy:165
#: src/network/org.freedesktop.network1.policy:154
msgid "Reload network settings"
msgstr "Перезавантаження параметрів мережі"
#: src/network/org.freedesktop.network1.policy:166
#: src/network/org.freedesktop.network1.policy:155
msgid "Authentication is required to reload network settings."
msgstr "Для перезавантаження параметрів мережі слід пройти розпізнавання."
#: src/network/org.freedesktop.network1.policy:176
#: src/network/org.freedesktop.network1.policy:165
msgid "Reconfigure network interface"
msgstr "Переналаштування інтерфейсу мережі"
#: src/network/org.freedesktop.network1.policy:177
#: src/network/org.freedesktop.network1.policy:166
msgid "Authentication is required to reconfigure network interface."
msgstr "Для зміни налаштувань інтерфейсу мережі слід пройти розпізнавання."
@ -894,38 +885,38 @@ msgstr ""
"Потрібна автентифікація, щоб контролювати, чи синхронізування часу через "
"мережу запущено."
#: src/core/dbus-unit.c:356
#: src/core/dbus-unit.c:355
msgid "Authentication is required to start '$(unit)'."
msgstr "Потрібна автентифікація, щоб запустити «$(unit)»."
#: src/core/dbus-unit.c:357
#: src/core/dbus-unit.c:356
msgid "Authentication is required to stop '$(unit)'."
msgstr "Потрібна автентифікація, щоб зупинити «$(unit)»."
#: src/core/dbus-unit.c:358
#: src/core/dbus-unit.c:357
msgid "Authentication is required to reload '$(unit)'."
msgstr "Потрібна автентифікація, щоб перезавантажити «$(unit)»."
#: src/core/dbus-unit.c:359 src/core/dbus-unit.c:360
#: src/core/dbus-unit.c:358 src/core/dbus-unit.c:359
msgid "Authentication is required to restart '$(unit)'."
msgstr "Потрібна автентифікація, щоб перезапустити «$(unit)»."
#: src/core/dbus-unit.c:532
#: src/core/dbus-unit.c:531
msgid ""
"Authentication is required to send a UNIX signal to the processes of "
"'$(unit)'."
msgstr ""
"Потрібна автентифікація, щоб надіслати сигнал UNIX до процесів «$(unit)»."
#: src/core/dbus-unit.c:563
#: src/core/dbus-unit.c:562
msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
msgstr "Потрібна автентифікація, щоб скинути «пошкоджений» стан з «$(unit)»."
#: src/core/dbus-unit.c:596
#: src/core/dbus-unit.c:595
msgid "Authentication is required to set properties on '$(unit)'."
msgstr "Потрібна автентифікація, щоб вказати властивості на «$(unit)»."
#: src/core/dbus-unit.c:705
#: src/core/dbus-unit.c:704
msgid ""
"Authentication is required to delete files and directories associated with "
"'$(unit)'."

View File

@ -37,7 +37,6 @@
#include "strv.h"
#include "unit-name.h"
#include "user-util.h"
#include "xattr-util.h"
static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
_cleanup_free_ char *fs = NULL;
@ -606,24 +605,6 @@ int cg_get_xattr(const char *controller, const char *path, const char *name, voi
return (int) n;
}
int cg_get_xattr_malloc(const char *controller, const char *path, const char *name, char **ret) {
_cleanup_free_ char *fs = NULL;
int r;
assert(path);
assert(name);
r = cg_get_path(controller, path, NULL, &fs);
if (r < 0)
return r;
r = getxattr_malloc(fs, name, ret, false);
if (r < 0)
return r;
return r;
}
int cg_remove_xattr(const char *controller, const char *path, const char *name) {
_cleanup_free_ char *fs = NULL;
int r;
@ -1658,32 +1639,6 @@ int cg_get_attribute(const char *controller, const char *path, const char *attri
return read_one_line_file(p, ret);
}
int cg_get_attribute_as_uint64(const char *controller, const char *path, const char *attribute, uint64_t *ret) {
_cleanup_free_ char *value = NULL;
uint64_t v;
int r;
assert(ret);
r = cg_get_attribute(controller, path, attribute, &value);
if (r == -ENOENT)
return -ENODATA;
if (r < 0)
return r;
if (streq(value, "max")) {
*ret = CGROUP_LIMIT_MAX;
return 0;
}
r = safe_atou64(value, &v);
if (r < 0)
return r;
*ret = v;
return 0;
}
int cg_get_keyed_attribute(
const char *controller,
const char *path,

View File

@ -184,13 +184,10 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret);
int cg_get_keyed_attribute(const char *controller, const char *path, const char *attribute, char **keys, char **values);
int cg_get_attribute_as_uint64(const char *controller, const char *path, const char *attribute, uint64_t *ret);
int cg_set_access(const char *controller, const char *path, uid_t uid, gid_t gid);
int cg_set_xattr(const char *controller, const char *path, const char *name, const void *value, size_t size, int flags);
int cg_get_xattr(const char *controller, const char *path, const char *name, void *value, size_t size);
int cg_get_xattr_malloc(const char *controller, const char *path, const char *name, char **ret);
int cg_remove_xattr(const char *controller, const char *path, const char *name);
int cg_install_release_agent(const char *controller, const char *agent);

View File

@ -120,9 +120,16 @@ uint64_t system_tasks_max(void) {
if (r < 0)
log_debug_errno(r, "Failed to determine cgroup root path, ignoring: %m");
else {
r = cg_get_attribute_as_uint64("pids", root, "pids.max", &b);
_cleanup_free_ char *value = NULL;
r = cg_get_attribute("pids", root, "pids.max", &value);
if (r < 0)
log_debug_errno(r, "Failed to read pids.max attribute of cgroup root, ignoring: %m");
else if (!streq(value, "max")) {
r = safe_atou64(value, &b);
if (r < 0)
log_debug_errno(r, "Failed to parse pids.max attribute of cgroup root, ignoring: %m");
}
}
return MIN3(TASKS_MAX,

View File

@ -74,7 +74,7 @@ int log_get_max_level_realm(LogRealm realm) _pure_;
*/
assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
#define PROJECT_FILE (&__FILE__[STRLEN(RELATIVE_SOURCE_PATH) + 1])
#define PROJECT_FILE (__FILE__ + STRLEN(RELATIVE_SOURCE_PATH) + 1)
int log_open(void);
void log_close(void);

View File

@ -215,12 +215,31 @@ void cgroup_context_done(CGroupContext *c) {
}
static int unit_get_kernel_memory_limit(Unit *u, const char *file, uint64_t *ret) {
_cleanup_free_ char *raw_kval = NULL;
uint64_t kval;
int r;
assert(u);
if (!u->cgroup_realized)
return -EOWNERDEAD;
return cg_get_attribute_as_uint64("memory", u->cgroup_path, file, ret);
r = cg_get_attribute("memory", u->cgroup_path, file, &raw_kval);
if (r < 0)
return r;
if (streq(raw_kval, "max")) {
*ret = CGROUP_LIMIT_MAX;
return 0;
}
r = safe_atou64(raw_kval, &kval);
if (r < 0)
return r;
*ret = kval;
return 0;
}
static int unit_compare_memory_limit(Unit *u, const char *property_name, uint64_t *ret_unit_value, uint64_t *ret_kernel_value) {
@ -3093,6 +3112,7 @@ int manager_notify_cgroup_empty(Manager *m, const char *cgroup) {
}
int unit_get_memory_current(Unit *u, uint64_t *ret) {
_cleanup_free_ char *v = NULL;
int r;
assert(u);
@ -3114,11 +3134,22 @@ int unit_get_memory_current(Unit *u, uint64_t *ret) {
r = cg_all_unified();
if (r < 0)
return r;
if (r > 0)
r = cg_get_attribute("memory", u->cgroup_path, "memory.current", &v);
else
r = cg_get_attribute("memory", u->cgroup_path, "memory.usage_in_bytes", &v);
if (r == -ENOENT)
return -ENODATA;
if (r < 0)
return r;
return cg_get_attribute_as_uint64("memory", u->cgroup_path, r > 0 ? "memory.current" : "memory.usage_in_bytes", ret);
return safe_atou64(v, ret);
}
int unit_get_tasks_current(Unit *u, uint64_t *ret) {
_cleanup_free_ char *v = NULL;
int r;
assert(u);
assert(ret);
@ -3135,10 +3166,17 @@ int unit_get_tasks_current(Unit *u, uint64_t *ret) {
if ((u->cgroup_realized_mask & CGROUP_MASK_PIDS) == 0)
return -ENODATA;
return cg_get_attribute_as_uint64("pids", u->cgroup_path, "pids.current", ret);
r = cg_get_attribute("pids", u->cgroup_path, "pids.current", &v);
if (r == -ENOENT)
return -ENODATA;
if (r < 0)
return r;
return safe_atou64(v, ret);
}
static int unit_get_cpu_usage_raw(Unit *u, nsec_t *ret) {
_cleanup_free_ char *v = NULL;
uint64_t ns;
int r;
@ -3174,8 +3212,17 @@ static int unit_get_cpu_usage_raw(Unit *u, nsec_t *ret) {
return r;
ns = us * NSEC_PER_USEC;
} else
return cg_get_attribute_as_uint64("cpuacct", u->cgroup_path, "cpuacct.usage", ret);
} else {
r = cg_get_attribute("cpuacct", u->cgroup_path, "cpuacct.usage", &v);
if (r == -ENOENT)
return -ENODATA;
if (r < 0)
return r;
r = safe_atou64(v, &ns);
if (r < 0)
return r;
}
*ret = ns;
return 0;

View File

@ -96,7 +96,6 @@ _public_ int sd_bus_call_method(
int r;
bus_assert_return(bus, -EINVAL, error);
bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(!bus_pid_changed(bus), -ECHILD, error);
if (!BUS_IS_OPEN(bus->state)) {
@ -284,7 +283,6 @@ _public_ int sd_bus_get_property(
int r;
bus_assert_return(bus, -EINVAL, error);
bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(reply, -EINVAL, error);
@ -296,10 +294,7 @@ _public_ int sd_bus_get_property(
goto fail;
}
r = sd_bus_call_method(bus, destination, path,
"org.freedesktop.DBus.Properties", "Get",
error, &rep,
"ss", strempty(interface), member);
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member);
if (r < 0)
return r;
@ -329,7 +324,6 @@ _public_ int sd_bus_get_property_trivial(
int r;
bus_assert_return(bus, -EINVAL, error);
bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(bus_type_is_trivial(type), -EINVAL, error);
@ -374,7 +368,6 @@ _public_ int sd_bus_get_property_string(
int r;
bus_assert_return(bus, -EINVAL, error);
bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(ret, -EINVAL, error);
@ -423,7 +416,6 @@ _public_ int sd_bus_get_property_strv(
int r;
bus_assert_return(bus, -EINVAL, error);
bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(ret, -EINVAL, error);
@ -466,7 +458,6 @@ _public_ int sd_bus_set_property(
int r;
bus_assert_return(bus, -EINVAL, error);
bus_assert_return(bus = bus_resolve(bus), -ENOPKG, error);
bus_assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL, error);
bus_assert_return(member_name_is_valid(member), -EINVAL, error);
bus_assert_return(signature_is_single(type, false), -EINVAL, error);

View File

@ -585,13 +585,14 @@ _public_ int sd_bus_message_new(
sd_bus_message **m,
uint8_t type) {
sd_bus_message *t;
assert_return(bus, -ENOTCONN);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(type < _SD_BUS_MESSAGE_TYPE_MAX, -EINVAL);
sd_bus_message *t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
if (!t)
return -ENOMEM;
@ -622,7 +623,6 @@ _public_ int sd_bus_message_new_signal(
int r;
assert_return(bus, -ENOTCONN);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(object_path_is_valid(path), -EINVAL);
assert_return(interface_name_is_valid(interface), -EINVAL);
@ -663,7 +663,6 @@ _public_ int sd_bus_message_new_method_call(
int r;
assert_return(bus, -ENOTCONN);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(!destination || service_name_is_valid(destination), -EINVAL);
assert_return(object_path_is_valid(path), -EINVAL);

View File

@ -504,6 +504,7 @@ static int synthesize_connected_signal(sd_bus *bus) {
}
void bus_set_state(sd_bus *bus, enum bus_state state) {
static const char * const table[_BUS_STATE_MAX] = {
[BUS_UNSET] = "UNSET",
[BUS_WATCH_BIND] = "WATCH_BIND",
@ -1898,10 +1899,9 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie) {
assert_return(m, -EINVAL);
if (bus)
assert_return(bus = bus_resolve(bus), -ENOPKG);
else
assert_return(bus = m->bus, -ENOTCONN);
if (!bus)
bus = m->bus;
assert_return(!bus_pid_changed(bus), -ECHILD);
if (!BUS_IS_OPEN(bus->state))
@ -1983,10 +1983,9 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat
assert_return(m, -EINVAL);
if (bus)
assert_return(bus = bus_resolve(bus), -ENOPKG);
else
assert_return(bus = m->bus, -ENOTCONN);
if (!bus)
bus = m->bus;
assert_return(!bus_pid_changed(bus), -ECHILD);
if (!BUS_IS_OPEN(bus->state))
@ -2049,10 +2048,9 @@ _public_ int sd_bus_call_async(
assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
assert_return(!m->sealed || (!!callback == !(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)), -EINVAL);
if (bus)
assert_return(bus = bus_resolve(bus), -ENOPKG);
else
assert_return(bus = m->bus, -ENOTCONN);
if (!bus)
bus = m->bus;
assert_return(!bus_pid_changed(bus), -ECHILD);
if (!BUS_IS_OPEN(bus->state))
@ -2156,10 +2154,9 @@ _public_ int sd_bus_call(
bus_assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL, error);
bus_assert_return(!bus_error_is_dirty(error), -EINVAL, error);
if (bus)
assert_return(bus = bus_resolve(bus), -ENOPKG);
else
assert_return(bus = m->bus, -ENOTCONN);
if (!bus)
bus = m->bus;
bus_assert_return(!bus_pid_changed(bus), -ECHILD, error);
if (!BUS_IS_OPEN(bus->state)) {
@ -2286,6 +2283,7 @@ fail:
}
_public_ int sd_bus_get_fd(sd_bus *bus) {
assert_return(bus, -EINVAL);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(bus->input_fd == bus->output_fd, -EPERM);
@ -3676,31 +3674,31 @@ _public_ int sd_bus_detach_event(sd_bus *bus) {
}
_public_ sd_event* sd_bus_get_event(sd_bus *bus) {
assert_return(bus = bus_resolve(bus), NULL);
assert_return(bus, NULL);
return bus->event;
}
_public_ sd_bus_message* sd_bus_get_current_message(sd_bus *bus) {
assert_return(bus = bus_resolve(bus), NULL);
assert_return(bus, NULL);
return bus->current_message;
}
_public_ sd_bus_slot* sd_bus_get_current_slot(sd_bus *bus) {
assert_return(bus = bus_resolve(bus), NULL);
assert_return(bus, NULL);
return bus->current_slot;
}
_public_ sd_bus_message_handler_t sd_bus_get_current_handler(sd_bus *bus) {
assert_return(bus = bus_resolve(bus), NULL);
assert_return(bus, NULL);
return bus->current_handler;
}
_public_ void* sd_bus_get_current_userdata(sd_bus *bus) {
assert_return(bus = bus_resolve(bus), NULL);
assert_return(bus, NULL);
return bus->current_userdata;
}
@ -4017,6 +4015,7 @@ _public_ int sd_bus_get_scope(sd_bus *bus, const char **scope) {
}
_public_ int sd_bus_get_address(sd_bus *bus, const char **address) {
assert_return(bus, -EINVAL);
assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(address, -EINVAL);

View File

@ -21,7 +21,6 @@
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-util.h"
#include "bridge-util.h"
#include "device-util.h"
#include "escape.h"
#include "ether-addr-util.h"
@ -29,7 +28,6 @@
#include "fd-util.h"
#include "format-table.h"
#include "format-util.h"
#include "geneve-util.h"
#include "glob-util.h"
#include "hwdb-util.h"
#include "local-addresses.h"
@ -162,14 +160,8 @@ typedef struct LinkInfo {
/* tunnel info */
uint8_t ttl;
uint8_t tos;
uint8_t inherit;
uint8_t df;
uint8_t csum;
uint8_t csum6_tx;
uint8_t csum6_rx;
uint16_t tunnel_port;
uint32_t vni;
uint32_t label;
union in_addr_union local;
union in_addr_union remote;
@ -293,14 +285,8 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
(void) sd_netlink_message_read_in6_addr(m, IFLA_GENEVE_REMOTE6, &info->remote.in6);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TTL, &info->ttl);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TTL_INHERIT, &info->inherit);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_TOS, &info->tos);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_DF, &info->df);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_CSUM, &info->csum);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, &info->csum6_tx);
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, &info->csum6_rx);
(void) sd_netlink_message_read_u16(m, IFLA_GENEVE_PORT, &info->tunnel_port);
(void) sd_netlink_message_read_u32(m, IFLA_GENEVE_LABEL, &info->label);
} else if (STR_IN_SET(received_kind, "gre", "gretap", "erspan")) {
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_LOCAL, &info->local.in);
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_REMOTE, &info->remote.in);
@ -1501,10 +1487,20 @@ static int link_status_one(
return table_log_add_error(r);
if (info->port_state <= BR_STATE_BLOCKING) {
static const struct {
const char *state;
} state_table[] = {
{ "disabled" },
{ "listening" },
{ "learning" },
{ "forwarding" },
{ "blocking" },
};
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Port State:",
TABLE_STRING, bridge_state_to_string(info->port_state));
TABLE_STRING, state_table[info->port_state]);
}
} else if (streq_ptr(info->netdev_kind, "bond")) {
static const struct {
@ -1673,52 +1669,6 @@ static int link_status_one(
TABLE_UINT16, info->tunnel_port);
if (r < 0)
return table_log_add_error(r);
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Inherit:",
TABLE_STRING, geneve_df_to_string(info->inherit));
if (r < 0)
return table_log_add_error(r);
if (info->df > 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "IPDoNotFragment:",
TABLE_UINT8, info->df);
if (r < 0)
return table_log_add_error(r);
}
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "UDPChecksum:",
TABLE_BOOLEAN, info->csum);
if (r < 0)
return table_log_add_error(r);
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "UDP6ZeroChecksumTx:",
TABLE_BOOLEAN, info->csum6_tx);
if (r < 0)
return table_log_add_error(r);
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "UDP6ZeroChecksumRx:",
TABLE_BOOLEAN, info->csum6_rx);
if (r < 0)
return table_log_add_error(r);
if (info->label > 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "FlowLabel:",
TABLE_UINT32, info->label);
if (r < 0)
return table_log_add_error(r);
}
}
if (info->has_wlan_link_info) {

View File

@ -1,13 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "bridge-util.h"
#include "string-table.h"
static const char* const bridge_state_table[_NETDEV_BRIDGE_STATE_MAX] = {
[NETDEV_BRIDGE_STATE_DISABLED] = "disabled",
[NETDEV_BRIDGE_STATE_LISTENING] = "listening",
[NETDEV_BRIDGE_STATE_LEARNING] = "learning",
[NETDEV_BRIDGE_STATE_FORWARDING] = "forwading",
};
DEFINE_STRING_TABLE_LOOKUP(bridge_state, BridgeState);

View File

@ -1,20 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <netinet/in.h>
#include <linux/if_bridge.h>
#include "conf-parser.h"
typedef enum BridgeState {
NETDEV_BRIDGE_STATE_DISABLED = BR_STATE_DISABLED,
NETDEV_BRIDGE_STATE_LISTENING = BR_STATE_LISTENING,
NETDEV_BRIDGE_STATE_LEARNING = BR_STATE_LEARNING,
NETDEV_BRIDGE_STATE_FORWARDING = BR_STATE_FORWARDING,
NETDEV_BRIDGE_STATE_BLOCKING = BR_STATE_BLOCKING,
_NETDEV_BRIDGE_STATE_MAX,
_NETDEV_BRIDGE_STATE_INVALID = -1,
} BridgeState;
const char *bridge_state_to_string(BridgeState d) _const_;
BridgeState bridge_state_from_string(const char *d) _pure_;

View File

@ -1,12 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "geneve-util.h"
#include "string-table.h"
static const char* const geneve_df_table[_NETDEV_GENEVE_DF_MAX] = {
[NETDEV_GENEVE_DF_UNSET] = "unset",
[NETDEV_GENEVE_DF_SET] = "set",
[NETDEV_GENEVE_DF_INHERIT] = "inherit",
};
DEFINE_STRING_TABLE_LOOKUP(geneve_df, GeneveDF);

View File

@ -1,17 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <linux/if_link.h>
#include "conf-parser.h"
typedef enum GeneveDF {
NETDEV_GENEVE_DF_UNSET = GENEVE_DF_UNSET,
NETDEV_GENEVE_DF_SET = GENEVE_DF_SET,
NETDEV_GENEVE_DF_INHERIT = GENEVE_DF_INHERIT,
_NETDEV_GENEVE_DF_MAX,
_NETDEV_GENEVE_DF_INVALID = -1,
} GeneveDF;
const char *geneve_df_to_string(GeneveDF d) _const_;
GeneveDF geneve_df_from_string(const char *d) _pure_;

View File

@ -21,8 +21,6 @@ shared_sources = files('''
bootspec.h
bpf-program.c
bpf-program.h
bridge-util.c
bridge-util.h
bus-unit-procs.c
bus-unit-procs.h
bus-unit-util.c
@ -89,8 +87,6 @@ shared_sources = files('''
fstab-util.h
generator.c
generator.h
geneve-util.c
geneve-util.h
gpt.c
gpt.h
group-record-nss.c

View File

@ -125,12 +125,11 @@ int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs) {
_cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL;
e = getenv("XDG_CONFIG_DIRS");
if (e)
if (e) {
config_dirs = strv_split(e, ":");
else
config_dirs = strv_new("/etc/xdg");
if (!config_dirs)
return -ENOMEM;
}
e = getenv("XDG_DATA_DIRS");
if (e)