1
0
mirror of https://github.com/systemd/systemd synced 2025-12-28 03:44:45 +01:00

Compare commits

..

No commits in common. "85b6a8110d21defb3d6cddace09ee21db4eb9766" and "2ac4d1d45b952b9d675ae7911de3fef0874d65a8" have entirely different histories.

13 changed files with 64 additions and 442 deletions

View File

@ -297,10 +297,9 @@
<listitem><para>Takes a boolean argument. If true, the time when the service unit was last triggered <listitem><para>Takes a boolean argument. If true, the time when the service unit was last triggered
is stored on disk. When the timer is activated, the service unit is triggered immediately if it is stored on disk. When the timer is activated, the service unit is triggered immediately if it
would have been triggered at least once during the time when the timer was inactive. Such triggering would have been triggered at least once during the time when the timer was inactive. This is useful
is nonetheless subject to the delay imposed by <varname>RandomizedDelaySec=</varname>. to catch up on missed runs of the service when the system was powered down. Note that this setting
This is useful to catch up on missed runs of the service when the system was powered down. Note that only has an effect on timers configured with <varname>OnCalendar=</varname>. Defaults to
this setting only has an effect on timers configured with <varname>OnCalendar=</varname>. Defaults to
<varname>false</varname>.</para> <varname>false</varname>.</para>
<para>Use <command>systemctl clean --what=state …</command> on the timer unit to remove the timestamp <para>Use <command>systemctl clean --what=state …</command> on the timer unit to remove the timestamp

View File

@ -261,13 +261,17 @@ static int get_max_brightness(sd_device *device, unsigned *ret) {
* max_brightness in case of 'backlight' subsystem. This avoids preserving * max_brightness in case of 'backlight' subsystem. This avoids preserving
* an unreadably dim screen, which would otherwise force the user to * an unreadably dim screen, which would otherwise force the user to
* disable state restoration. */ * disable state restoration. */
static int clamp_brightness(sd_device *device, bool saved, unsigned max_brightness, unsigned *brightness) { static int clamp_brightness(sd_device *device, char **value, unsigned max_brightness) {
unsigned new_brightness, min_brightness; unsigned brightness, new_brightness, min_brightness;
const char *subsystem; const char *subsystem;
int r; int r;
assert(device); assert(value);
assert(brightness); assert(*value);
r = safe_atou(*value, &brightness);
if (r < 0)
return log_device_warning_errno(device, r, "Failed to parse brightness \"%s\": %m", *value);
r = sd_device_get_subsystem(device, &subsystem); r = sd_device_get_subsystem(device, &subsystem);
if (r < 0) if (r < 0)
@ -278,16 +282,22 @@ static int clamp_brightness(sd_device *device, bool saved, unsigned max_brightne
else else
min_brightness = 0; min_brightness = 0;
new_brightness = CLAMP(*brightness, min_brightness, max_brightness); new_brightness = CLAMP(brightness, min_brightness, max_brightness);
if (new_brightness != *brightness) if (new_brightness != brightness) {
log_device_info(device, "%s brightness %u is %s to %u.", char *new_value;
saved ? "Saved" : "Current",
*brightness, r = asprintf(&new_value, "%u", new_brightness);
new_brightness > *brightness ? if (r < 0)
"too low; increasing" : "too high; decreasing", return log_oom();
new_brightness);
log_device_info(device, "Saved brightness %s %s to %s.", *value,
new_brightness > brightness ?
"too low; increasing" : "too high; decreasing",
new_value);
free_and_replace(*value, new_value);
}
*brightness = new_brightness;
return 0; return 0;
} }
@ -299,7 +309,6 @@ static bool shall_clamp(sd_device *d) {
r = sd_device_get_property_value(d, "ID_BACKLIGHT_CLAMP", &s); r = sd_device_get_property_value(d, "ID_BACKLIGHT_CLAMP", &s);
if (r < 0) { if (r < 0) {
if (r != -ENOENT)
log_device_debug_errno(d, r, "Failed to get ID_BACKLIGHT_CLAMP property, ignoring: %m"); log_device_debug_errno(d, r, "Failed to get ID_BACKLIGHT_CLAMP property, ignoring: %m");
return true; return true;
} }
@ -313,60 +322,31 @@ static bool shall_clamp(sd_device *d) {
return r; return r;
} }
static int read_brightness(sd_device *device, unsigned max_brightness, unsigned *ret_brightness) { static int read_brightness(sd_device *device, const char **ret) {
const char *subsystem, *value; const char *subsystem;
unsigned brightness;
int r; int r;
assert(device); assert(device);
assert(ret_brightness); assert(ret);
r = sd_device_get_subsystem(device, &subsystem); r = sd_device_get_subsystem(device, &subsystem);
if (r < 0) if (r < 0)
return log_device_debug_errno(device, r, "Failed to get subsystem: %m"); return log_device_debug_errno(device, r, "Failed to get subsystem: %m");
if (streq(subsystem, "backlight")) { if (streq(subsystem, "backlight")) {
r = sd_device_get_sysattr_value(device, "actual_brightness", &value); r = sd_device_get_sysattr_value(device, "actual_brightness", ret);
if (r == -ENOENT) { if (r >= 0)
log_device_debug_errno(device, r, "Failed to read 'actual_brightness' attribute, " return 0;
"fall back to use 'brightness' attribute: %m"); if (r != -ENOENT)
goto use_brightness;
}
if (r < 0)
return log_device_debug_errno(device, r, "Failed to read 'actual_brightness' attribute: %m"); return log_device_debug_errno(device, r, "Failed to read 'actual_brightness' attribute: %m");
r = safe_atou(value, &brightness); log_device_debug_errno(device, r, "Failed to read 'actual_brightness' attribute, fall back to use 'brightness' attribute: %m");
if (r < 0) {
log_device_debug_errno(device, r, "Failed to parse 'actual_brightness' attribute, "
"fall back to use 'brightness' attribute: %s", value);
goto use_brightness;
} }
if (brightness > max_brightness) { r = sd_device_get_sysattr_value(device, "brightness", ret);
log_device_debug(device, "actual_brightness=%u is larger than max_brightness=%u, "
"fall back to use 'brightness' attribute", brightness, max_brightness);
goto use_brightness;
}
*ret_brightness = brightness;
return 0;
}
use_brightness:
r = sd_device_get_sysattr_value(device, "brightness", &value);
if (r < 0) if (r < 0)
return log_device_debug_errno(device, r, "Failed to read 'brightness' attribute: %m"); return log_device_debug_errno(device, r, "Failed to read 'brightness' attribute: %m");
r = safe_atou(value, &brightness);
if (r < 0)
return log_device_debug_errno(device, r, "Failed to parse 'brightness' attribute: %s", value);
if (brightness > max_brightness)
return log_device_debug_errno(device, SYNTHETIC_ERRNO(EINVAL),
"brightness=%u is larger than max_brightness=%u",
brightness, max_brightness);
*ret_brightness = brightness;
return 0; return 0;
} }
@ -374,7 +354,7 @@ static int run(int argc, char *argv[]) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL; _cleanup_(sd_device_unrefp) sd_device *device = NULL;
_cleanup_free_ char *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL; _cleanup_free_ char *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL;
const char *sysname, *path_id, *ss, *saved; const char *sysname, *path_id, *ss, *saved;
unsigned max_brightness, brightness; unsigned max_brightness;
int r; int r;
log_setup_service(); log_setup_service();
@ -451,50 +431,44 @@ static int run(int argc, char *argv[]) {
clamp = shall_clamp(device); clamp = shall_clamp(device);
r = read_one_line_file(saved, &value); r = read_one_line_file(saved, &value);
if (r < 0 && r != -ENOENT) if (IN_SET(r, -ENOENT, 0)) {
return log_error_errno(r, "Failed to read %s: %m", saved); const char *curval;
if (r > 0) {
r = safe_atou(value, &brightness);
if (r < 0) {
log_error_errno(r, "Failed to parse saved brightness '%s', removing %s.",
value, saved);
(void) unlink(saved);
} else {
if (clamp)
(void) clamp_brightness(device, true, max_brightness, &brightness);
/* Do not fall back to read current brightness below. */ /* Fallback to clamping current brightness or exit early if
r = 1; * clamping is not supported/enabled. */
}
}
if (r <= 0) {
/* Fallback to clamping current brightness or exit early if clamping is not
* supported/enabled. */
if (!clamp) if (!clamp)
return 0; return 0;
r = read_brightness(device, max_brightness, &brightness); r = read_brightness(device, &curval);
if (r < 0) if (r < 0)
return log_device_error_errno(device, r, "Failed to read current brightness: %m"); return log_device_error_errno(device, r, "Failed to read current brightness: %m");
(void) clamp_brightness(device, false, max_brightness, &brightness); value = strdup(curval);
} if (!value)
return log_oom();
} else if (r < 0)
return log_error_errno(r, "Failed to read %s: %m", saved);
r = sd_device_set_sysattr_valuef(device, "brightness", "%u", brightness); if (clamp)
(void) clamp_brightness(device, &value, max_brightness);
r = sd_device_set_sysattr_value(device, "brightness", value);
if (r < 0) if (r < 0)
return log_device_error_errno(device, r, "Failed to write system 'brightness' attribute: %m"); return log_device_error_errno(device, r, "Failed to write system 'brightness' attribute: %m");
} else if (streq(argv[1], "save")) { } else if (streq(argv[1], "save")) {
const char *value;
if (validate_device(device) == 0) { if (validate_device(device) == 0) {
(void) unlink(saved); (void) unlink(saved);
return 0; return 0;
} }
r = read_brightness(device, max_brightness, &brightness); r = read_brightness(device, &value);
if (r < 0) if (r < 0)
return log_device_error_errno(device, r, "Failed to read current brightness: %m"); return log_device_error_errno(device, r, "Failed to read current brightness: %m");
r = write_string_filef(saved, WRITE_STRING_FILE_CREATE, "%u", brightness); r = write_string_file(saved, value, WRITE_STRING_FILE_CREATE);
if (r < 0) if (r < 0)
return log_device_error_errno(device, r, "Failed to write %s: %m", saved); return log_device_error_errno(device, r, "Failed to write %s: %m", saved);

View File

@ -181,47 +181,6 @@ static int generate_keydev_mount(
return 0; return 0;
} }
static int generate_keydev_umount(const char *name,
const char *keydev_mount,
char **ret_umount_unit) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *u = NULL, *name_escaped = NULL, *mount = NULL;
int r;
assert(name);
assert(ret_umount_unit);
name_escaped = cescape(name);
if (!name_escaped)
return -ENOMEM;
u = strjoin("keydev-", name_escaped, "-umount.service");
if (!u)
return -ENOMEM;
r = unit_name_from_path(keydev_mount, ".mount", &mount);
if (r < 0)
return r;
r = generator_open_unit_file(arg_dest, NULL, u, &f);
if (r < 0)
return r;
fprintf(f,
"[Unit]\n"
"DefaultDependencies=no\n"
"After=%s\n\n"
"[Service]\n"
"ExecStart=-" UMOUNT_PATH " %s\n\n", mount, keydev_mount);
r = fflush_and_check(f);
if (r < 0)
return r;
*ret_umount_unit = TAKE_PTR(u);
return 0;
}
static int print_dependencies(FILE *f, const char* device_path) { static int print_dependencies(FILE *f, const char* device_path) {
int r; int r;
@ -355,16 +314,12 @@ static int create_disk(
fprintf(f, "Conflicts=umount.target\n"); fprintf(f, "Conflicts=umount.target\n");
if (keydev) { if (keydev) {
_cleanup_free_ char *unit = NULL, *umount_unit = NULL; _cleanup_free_ char *unit = NULL;
r = generate_keydev_mount(name, keydev, keyfile_timeout_value, keyfile_can_timeout > 0, &unit, &keydev_mount); r = generate_keydev_mount(name, keydev, keyfile_timeout_value, keyfile_can_timeout > 0, &unit, &keydev_mount);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to generate keydev mount unit: %m"); return log_error_errno(r, "Failed to generate keydev mount unit: %m");
r = generate_keydev_umount(name, keydev_mount, &umount_unit);
if (r < 0)
return log_error_errno(r, "Failed to generate keydev umount unit: %m");
password_buffer = path_join(keydev_mount, password); password_buffer = path_join(keydev_mount, password);
if (!password_buffer) if (!password_buffer)
return log_oom(); return log_oom();
@ -376,15 +331,6 @@ static int create_disk(
fprintf(f, "Wants=%s\n", unit); fprintf(f, "Wants=%s\n", unit);
else else
fprintf(f, "Requires=%s\n", unit); fprintf(f, "Requires=%s\n", unit);
if (umount_unit) {
fprintf(f,
"Wants=%s\n"
"Before=%s\n",
umount_unit,
umount_unit
);
}
} }
if (!nofail) if (!nofail)
@ -448,6 +394,11 @@ static int create_disk(
"ExecStartPost=" ROOTLIBEXECDIR "/systemd-makefs swap '/dev/mapper/%s'\n", "ExecStartPost=" ROOTLIBEXECDIR "/systemd-makefs swap '/dev/mapper/%s'\n",
name_escaped); name_escaped);
if (keydev)
fprintf(f,
"ExecStartPost=-" UMOUNT_PATH " %s\n\n",
keydev_mount);
r = fflush_and_check(f); r = fflush_and_check(f);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to write unit file %s: %m", n); return log_error_errno(r, "Failed to write unit file %s: %m", n);

View File

@ -732,5 +732,4 @@ global:
sd_device_get_current_tag_first; sd_device_get_current_tag_first;
sd_device_get_current_tag_next; sd_device_get_current_tag_next;
sd_device_has_current_tag; sd_device_has_current_tag;
sd_device_set_sysattr_valuef;
} LIBSYSTEMD_246; } LIBSYSTEMD_246;

View File

@ -1979,26 +1979,3 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
return 0; return 0;
} }
_public_ int sd_device_set_sysattr_valuef(sd_device *device, const char *sysattr, const char *format, ...) {
_cleanup_free_ char *value = NULL;
va_list ap;
int r;
assert_return(device, -EINVAL);
assert_return(sysattr, -EINVAL);
if (!format) {
device_remove_sysattr_value(device, sysattr);
return 0;
}
va_start(ap, format);
r = vasprintf(&value, format, ap);
va_end(ap);
if (r < 0)
return -ENOMEM;
return sd_device_set_sysattr_value(device, sysattr, value);
}

View File

@ -158,7 +158,6 @@ static int dhcp6_pd_remove_old(Link *link, bool force) {
if (k < 0) if (k < 0)
r = k; r = k;
if (link->radv)
(void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64); (void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
dhcp6_pd_free(hashmap_get(link->manager->dhcp6_prefixes, &route->dst.in6)); dhcp6_pd_free(hashmap_get(link->manager->dhcp6_prefixes, &route->dst.in6));
} }
@ -199,7 +198,6 @@ int dhcp6_pd_remove(Link *link) {
if (k < 0) if (k < 0)
r = k; r = k;
if (link->radv)
(void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64); (void) sd_radv_remove_prefix(link->radv, &route->dst.in6, 64);
dhcp6_pd_free(hashmap_get(link->manager->dhcp6_prefixes, &route->dst.in6)); dhcp6_pd_free(hashmap_get(link->manager->dhcp6_prefixes, &route->dst.in6));
} }

View File

@ -681,9 +681,7 @@ int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_le
int r; int r;
assert(link); assert(link);
assert(link->radv);
if (!link->radv)
return 0;
r = sd_radv_prefix_new(&p); r = sd_radv_prefix_new(&p);
if (r < 0) if (r < 0)

View File

@ -79,7 +79,6 @@ int sd_device_get_property_value(sd_device *device, const char *key, const char
int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, const char **_value); int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, const char **_value);
int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, const char *value); int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, const char *value);
int sd_device_set_sysattr_valuef(sd_device *device, const char *sysattr, const char *format, ...) _sd_printf_(3, 4);
/* device enumerator */ /* device enumerator */

View File

@ -51,261 +51,3 @@ Peer=2001:db8:0:f103::10/128
[Address] [Address]
Address=::/64 Address=::/64
# test for ENOBUFS issue #17012
[Network]
Address=10.3.3.1/16
Address=10.3.3.2/16
Address=10.3.3.3/16
Address=10.3.3.4/16
Address=10.3.3.5/16
Address=10.3.3.6/16
Address=10.3.3.7/16
Address=10.3.3.8/16
Address=10.3.3.9/16
Address=10.3.3.10/16
Address=10.3.3.11/16
Address=10.3.3.12/16
Address=10.3.3.13/16
Address=10.3.3.14/16
Address=10.3.3.15/16
Address=10.3.3.16/16
Address=10.3.3.17/16
Address=10.3.3.18/16
Address=10.3.3.19/16
Address=10.3.3.20/16
Address=10.3.3.21/16
Address=10.3.3.22/16
Address=10.3.3.23/16
Address=10.3.3.24/16
Address=10.3.3.25/16
Address=10.3.3.26/16
Address=10.3.3.27/16
Address=10.3.3.28/16
Address=10.3.3.29/16
Address=10.3.3.30/16
Address=10.3.3.31/16
Address=10.3.3.32/16
Address=10.3.3.33/16
Address=10.3.3.34/16
Address=10.3.3.35/16
Address=10.3.3.36/16
Address=10.3.3.37/16
Address=10.3.3.38/16
Address=10.3.3.39/16
Address=10.3.3.40/16
Address=10.3.3.41/16
Address=10.3.3.42/16
Address=10.3.3.43/16
Address=10.3.3.44/16
Address=10.3.3.45/16
Address=10.3.3.46/16
Address=10.3.3.47/16
Address=10.3.3.48/16
Address=10.3.3.49/16
Address=10.3.3.50/16
Address=10.3.3.51/16
Address=10.3.3.52/16
Address=10.3.3.53/16
Address=10.3.3.54/16
Address=10.3.3.55/16
Address=10.3.3.56/16
Address=10.3.3.57/16
Address=10.3.3.58/16
Address=10.3.3.59/16
Address=10.3.3.60/16
Address=10.3.3.61/16
Address=10.3.3.62/16
Address=10.3.3.63/16
Address=10.3.3.64/16
Address=10.3.3.65/16
Address=10.3.3.66/16
Address=10.3.3.67/16
Address=10.3.3.68/16
Address=10.3.3.69/16
Address=10.3.3.70/16
Address=10.3.3.71/16
Address=10.3.3.72/16
Address=10.3.3.73/16
Address=10.3.3.74/16
Address=10.3.3.75/16
Address=10.3.3.76/16
Address=10.3.3.77/16
Address=10.3.3.78/16
Address=10.3.3.79/16
Address=10.3.3.80/16
Address=10.3.3.81/16
Address=10.3.3.82/16
Address=10.3.3.83/16
Address=10.3.3.84/16
Address=10.3.3.85/16
Address=10.3.3.86/16
Address=10.3.3.87/16
Address=10.3.3.88/16
Address=10.3.3.89/16
Address=10.3.3.90/16
Address=10.3.3.91/16
Address=10.3.3.92/16
Address=10.3.3.93/16
Address=10.3.3.94/16
Address=10.3.3.95/16
Address=10.3.3.96/16
Address=10.3.3.97/16
Address=10.3.3.98/16
Address=10.3.3.99/16
Address=10.3.3.100/16
Address=10.3.3.101/16
Address=10.3.3.101/16
Address=10.3.3.102/16
Address=10.3.3.103/16
Address=10.3.3.104/16
Address=10.3.3.105/16
Address=10.3.3.106/16
Address=10.3.3.107/16
Address=10.3.3.108/16
Address=10.3.3.109/16
Address=10.3.3.110/16
Address=10.3.3.111/16
Address=10.3.3.112/16
Address=10.3.3.113/16
Address=10.3.3.114/16
Address=10.3.3.115/16
Address=10.3.3.116/16
Address=10.3.3.117/16
Address=10.3.3.118/16
Address=10.3.3.119/16
Address=10.3.3.120/16
Address=10.3.3.121/16
Address=10.3.3.122/16
Address=10.3.3.123/16
Address=10.3.3.124/16
Address=10.3.3.125/16
Address=10.3.3.126/16
Address=10.3.3.127/16
Address=10.3.3.128/16
Address=10.3.3.129/16
Address=10.3.3.130/16
Address=10.3.3.131/16
Address=10.3.3.132/16
Address=10.3.3.133/16
Address=10.3.3.134/16
Address=10.3.3.135/16
Address=10.3.3.136/16
Address=10.3.3.137/16
Address=10.3.3.138/16
Address=10.3.3.139/16
Address=10.3.3.140/16
Address=10.3.3.141/16
Address=10.3.3.142/16
Address=10.3.3.143/16
Address=10.3.3.144/16
Address=10.3.3.145/16
Address=10.3.3.146/16
Address=10.3.3.147/16
Address=10.3.3.148/16
Address=10.3.3.149/16
Address=10.3.3.150/16
Address=10.3.3.151/16
Address=10.3.3.152/16
Address=10.3.3.153/16
Address=10.3.3.154/16
Address=10.3.3.155/16
Address=10.3.3.156/16
Address=10.3.3.157/16
Address=10.3.3.158/16
Address=10.3.3.159/16
Address=10.3.3.160/16
Address=10.3.3.161/16
Address=10.3.3.162/16
Address=10.3.3.163/16
Address=10.3.3.164/16
Address=10.3.3.165/16
Address=10.3.3.166/16
Address=10.3.3.167/16
Address=10.3.3.168/16
Address=10.3.3.169/16
Address=10.3.3.170/16
Address=10.3.3.171/16
Address=10.3.3.172/16
Address=10.3.3.173/16
Address=10.3.3.174/16
Address=10.3.3.175/16
Address=10.3.3.176/16
Address=10.3.3.177/16
Address=10.3.3.178/16
Address=10.3.3.179/16
Address=10.3.3.180/16
Address=10.3.3.181/16
Address=10.3.3.182/16
Address=10.3.3.183/16
Address=10.3.3.184/16
Address=10.3.3.185/16
Address=10.3.3.186/16
Address=10.3.3.187/16
Address=10.3.3.188/16
Address=10.3.3.189/16
Address=10.3.3.190/16
Address=10.3.3.191/16
Address=10.3.3.192/16
Address=10.3.3.193/16
Address=10.3.3.194/16
Address=10.3.3.195/16
Address=10.3.3.196/16
Address=10.3.3.197/16
Address=10.3.3.198/16
Address=10.3.3.199/16
Address=10.3.3.200/16
Address=10.3.3.201/16
Address=10.3.3.202/16
Address=10.3.3.203/16
Address=10.3.3.204/16
Address=10.3.3.205/16
Address=10.3.3.206/16
Address=10.3.3.207/16
Address=10.3.3.208/16
Address=10.3.3.209/16
Address=10.3.3.210/16
Address=10.3.3.211/16
Address=10.3.3.212/16
Address=10.3.3.213/16
Address=10.3.3.214/16
Address=10.3.3.215/16
Address=10.3.3.216/16
Address=10.3.3.217/16
Address=10.3.3.218/16
Address=10.3.3.219/16
Address=10.3.3.220/16
Address=10.3.3.221/16
Address=10.3.3.222/16
Address=10.3.3.223/16
Address=10.3.3.224/16
Address=10.3.3.225/16
Address=10.3.3.226/16
Address=10.3.3.227/16
Address=10.3.3.228/16
Address=10.3.3.229/16
Address=10.3.3.230/16
Address=10.3.3.231/16
Address=10.3.3.232/16
Address=10.3.3.233/16
Address=10.3.3.234/16
Address=10.3.3.235/16
Address=10.3.3.236/16
Address=10.3.3.237/16
Address=10.3.3.238/16
Address=10.3.3.239/16
Address=10.3.3.240/16
Address=10.3.3.241/16
Address=10.3.3.242/16
Address=10.3.3.243/16
Address=10.3.3.244/16
Address=10.3.3.245/16
Address=10.3.3.246/16
Address=10.3.3.247/16
Address=10.3.3.248/16
Address=10.3.3.249/16
Address=10.3.3.250/16
Address=10.3.3.251/16
Address=10.3.3.252/16
Address=10.3.3.253/16
Address=10.3.3.254/16

View File

@ -1767,10 +1767,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98') self.assertRegex(output, 'inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98')
self.assertRegex(output, 'inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98') self.assertRegex(output, 'inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98')
# test for ENOBUFS issue #17012
for i in range(1,254):
self.assertRegex(output, f'inet 10.3.3.{i}/16 brd 10.3.255.255')
# invalid sections # invalid sections
self.assertNotRegex(output, '10.10.0.1/16') self.assertNotRegex(output, '10.10.0.1/16')
self.assertNotRegex(output, '10.10.0.2/16') self.assertNotRegex(output, '10.10.0.2/16')
@ -1796,14 +1792,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'inet6 2001:db8:0:f103::20 peer 2001:db8:0:f103::10/128 scope global') self.assertRegex(output, 'inet6 2001:db8:0:f103::20 peer 2001:db8:0:f103::10/128 scope global')
self.assertRegex(output, 'inet6 fd[0-9a-f:]*1/64 scope global') self.assertRegex(output, 'inet6 fd[0-9a-f:]*1/64 scope global')
restart_networkd()
self.wait_online(['dummy98:routable'])
# test for ENOBUFS issue #17012
output = check_output('ip -4 address show dev dummy98')
for i in range(1,254):
self.assertRegex(output, f'inet 10.3.3.{i}/16 brd 10.3.255.255')
def test_address_preferred_lifetime_zero_ipv6(self): def test_address_preferred_lifetime_zero_ipv6(self):
copy_unit_to_networkd_unit_path('25-address-preferred-lifetime-zero.network', '12-dummy.netdev') copy_unit_to_networkd_unit_path('25-address-preferred-lifetime-zero.network', '12-dummy.netdev')
start_networkd(5) start_networkd(5)

View File

@ -20,7 +20,6 @@ Wants=systemd-networkd.socket network.target
[Service] [Service]
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW
BusName=org.freedesktop.network1
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW
DeviceAllow=char-* rw DeviceAllow=char-* rw
ExecStart=!!@rootlibexecdir@/systemd-networkd ExecStart=!!@rootlibexecdir@/systemd-networkd

View File

@ -21,7 +21,6 @@ Wants=nss-lookup.target
[Service] [Service]
AmbientCapabilities=CAP_SETPCAP CAP_NET_RAW CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_SETPCAP CAP_NET_RAW CAP_NET_BIND_SERVICE
BusName=org.freedesktop.resolve1
CapabilityBoundingSet=CAP_SETPCAP CAP_NET_RAW CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_SETPCAP CAP_NET_RAW CAP_NET_BIND_SERVICE
ExecStart=!!@rootlibexecdir@/systemd-resolved ExecStart=!!@rootlibexecdir@/systemd-resolved
LockPersonality=yes LockPersonality=yes

View File

@ -20,7 +20,6 @@ Wants=time-set.target time-sync.target
[Service] [Service]
AmbientCapabilities=CAP_SYS_TIME AmbientCapabilities=CAP_SYS_TIME
BusName=org.freedesktop.timesync1
CapabilityBoundingSet=CAP_SYS_TIME CapabilityBoundingSet=CAP_SYS_TIME
ExecStart=!!@rootlibexecdir@/systemd-timesyncd ExecStart=!!@rootlibexecdir@/systemd-timesyncd
LockPersonality=yes LockPersonality=yes