1
0
mirror of https://github.com/systemd/systemd synced 2025-12-27 11:24:46 +01:00

Compare commits

..

No commits in common. "6d95e7d9b263c94e94704e3125cb790840b76ca2" and "ca19dedb566f18e3b7c455aec61d951f5d31ea18" have entirely different histories.

14 changed files with 28 additions and 36 deletions

View File

@ -1695,7 +1695,7 @@ int sd_dhcp6_client_is_running(sd_dhcp6_client *client) {
int sd_dhcp6_client_start(sd_dhcp6_client *client) {
enum DHCP6State state = DHCP6_STATE_SOLICITATION;
int r;
int r = 0;
assert_return(client, -EINVAL);
assert_return(client->event, -EINVAL);

View File

@ -477,7 +477,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **match_list = NULL;
uint32_t line_number = 0;
int r, err;
int r = 0, err;
f = fopen(filename, "re");
if (!f)

View File

@ -53,7 +53,7 @@ static int getnameinfo_handler(sd_resolve_query *q, int ret, const char *host, c
int main(int argc, char *argv[]) {
_cleanup_(sd_resolve_query_unrefp) sd_resolve_query *q1 = NULL, *q2 = NULL;
_cleanup_(sd_resolve_unrefp) sd_resolve *resolve = NULL;
int r;
int r = 0;
struct addrinfo hints = {
.ai_family = PF_UNSPEC,

View File

@ -478,7 +478,7 @@ int config_parse_n_autovts(
static int vt_is_busy(unsigned vtnr) {
struct vt_stat vt_stat;
int r;
int r = 0;
_cleanup_close_ int fd;
assert(vtnr >= 1);

View File

@ -202,7 +202,7 @@ static void session_save_devices(Session *s, FILE *f) {
int session_save(Session *s) {
_cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
int r = 0;
assert(s);

View File

@ -136,7 +136,7 @@ static int manager_add_host_machine(Manager *m) {
static int manager_enumerate_machines(Manager *m) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
int r;
int r = 0;
assert(m);

View File

@ -84,7 +84,7 @@ static int context_save(Context *context) {
NetDev *netdev;
Link *link;
Iterator i;
int k, r;
int k, r = 0;
const char *p;
p = prefix_roota(arg_root, NETWORKD_UNIT_DIRECTORY);

View File

@ -54,9 +54,6 @@
#include "user-util.h"
#include "xattr-util.h"
/* how many times to wait for the device nodes to appear */
#define N_DEVICE_NODE_LIST_ATTEMPTS 10
int probe_filesystem(const char *node, char **ret_fstype) {
/* Try to find device content type and return it in *ret_fstype. If nothing is found,
* 0/NULL will be returned. -EUCLEAN will be returned for ambiguous results, and an
@ -157,6 +154,9 @@ static int enumerator_for_parent(sd_device *d, sd_device_enumerator **ret) {
return 0;
}
/* how many times to wait for the device nodes to appear */
#define N_DEVICE_NODE_LIST_ATTEMPTS 10
static int wait_for_partitions_to_appear(
int fd,
sd_device *d,

View File

@ -8,7 +8,7 @@ int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool verbose)
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST;
struct kmod_list *itr;
_cleanup_(kmod_module_unref_listp) struct kmod_list *modlist = NULL;
int r;
int r = 0;
/* verbose==true means we should log at non-debug level if we
* fail to find or load the module. */

View File

@ -1941,7 +1941,7 @@ static int seccomp_restrict_sxid(scmp_filter_ctx seccomp, mode_t m) {
*
* Returns error if *everything* failed, and 0 otherwise.
*/
int r;
int r = 0;
bool any = false;
r = seccomp_rule_add_exact(

View File

@ -1064,7 +1064,7 @@ static int list_sockets(int argc, char *argv[], void *userdata) {
struct socket_info *s;
unsigned cs = 0;
size_t size = 0;
int r, n;
int r = 0, n;
sd_bus *bus;
r = acquire_bus(BUS_MANAGER, &bus);
@ -1333,7 +1333,7 @@ static int list_timers(int argc, char *argv[], void *userdata) {
int n, c = 0;
dual_timestamp nw;
sd_bus *bus;
int r;
int r = 0;
r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0)
@ -1731,7 +1731,7 @@ static int list_dependencies_one(
_cleanup_strv_free_ char **deps = NULL;
char **c;
int r;
int r = 0;
assert(bus);
assert(name);
@ -2397,7 +2397,7 @@ static int list_jobs(int argc, char *argv[], void *userdata) {
static int cancel_job(int argc, char *argv[], void *userdata) {
sd_bus *bus;
char **name;
int r;
int r = 0;
if (argc <= 1)
return trivial_method(argc, argv, userdata);
@ -6973,7 +6973,7 @@ static int add_dependency(int argc, char *argv[], void *userdata) {
UnitFileChange *changes = NULL;
size_t n_changes = 0;
UnitDependency dep;
int r;
int r = 0;
if (!argv[1])
return 0;

View File

@ -223,8 +223,7 @@ Gateway=192.168.250.1''')
subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
def tearDown(self):
subprocess.check_call(['systemctl', 'stop', 'systemd-networkd.socket'])
subprocess.check_call(['systemctl', 'stop', 'systemd-networkd.service'])
subprocess.check_call(['systemctl', 'stop', 'systemd-networkd'])
subprocess.check_call(['ip', 'link', 'del', 'mybridge'])
subprocess.check_call(['ip', 'link', 'del', 'port1'])
subprocess.check_call(['ip', 'link', 'del', 'port2'])
@ -310,8 +309,7 @@ class ClientTestBase(NetworkdTestingUtilities):
def tearDown(self):
self.shutdown_iface()
subprocess.call(['systemctl', 'stop', 'systemd-networkd.socket'])
subprocess.call(['systemctl', 'stop', 'systemd-networkd.service'])
subprocess.call(['systemctl', 'stop', 'systemd-networkd'])
subprocess.call(['ip', 'link', 'del', 'dummy0'],
stderr=subprocess.DEVNULL)
@ -989,8 +987,7 @@ class MatchClientTest(unittest.TestCase, NetworkdTestingUtilities):
def tearDown(self):
"""Stop networkd."""
subprocess.call(['systemctl', 'stop', 'systemd-networkd.socket'])
subprocess.call(['systemctl', 'stop', 'systemd-networkd.service'])
subprocess.call(['systemctl', 'stop', 'systemd-networkd'])
def test_basic_matching(self):
"""Verify the Name= line works throughout this class."""
@ -1040,8 +1037,7 @@ class UnmanagedClientTest(unittest.TestCase, NetworkdTestingUtilities):
def tearDown(self):
"""Stop networkd."""
subprocess.call(['systemctl', 'stop', 'systemd-networkd.socket'])
subprocess.call(['systemctl', 'stop', 'systemd-networkd.service'])
subprocess.call(['systemctl', 'stop', 'systemd-networkd'])
def create_iface(self):
"""Create temporary veth pairs for interface matching."""

View File

@ -328,7 +328,7 @@ def tearDownModule():
shutil.rmtree(networkd_ci_path)
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service']:
for u in ['systemd-networkd.service', 'systemd-resolved.service']:
check_output(f'systemctl stop {u}')
shutil.rmtree('/run/systemd/system/systemd-networkd.service.d')
@ -464,8 +464,7 @@ def remove_networkd_state_files():
def stop_networkd(show_logs=True, remove_state_files=True):
if show_logs:
invocation_id = check_output('systemctl show systemd-networkd -p InvocationID --value')
check_output('systemctl stop systemd-networkd.socket')
check_output('systemctl stop systemd-networkd.service')
check_output('systemctl stop systemd-networkd')
if show_logs:
print(check_output('journalctl _SYSTEMD_INVOCATION_ID=' + invocation_id))
if remove_state_files:
@ -2448,8 +2447,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'Search Domains: one')
def test_keep_configuration_static(self):
check_output('systemctl stop systemd-networkd.socket')
check_output('systemctl stop systemd-networkd.service')
check_output('systemctl stop systemd-networkd')
check_output('ip link add name dummy98 type dummy')
check_output('ip address add 10.1.2.3/16 dev dummy98')
@ -3612,8 +3610,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, r'192.168.5.*')
check_output('systemctl stop systemd-networkd.socket')
check_output('systemctl stop systemd-networkd.service')
check_output('systemctl stop systemd-networkd')
print('The lease address should be kept after networkd stopped')
output = check_output('ip address show dev veth99 scope global')
@ -3648,8 +3645,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
self.assertRegex(output, r'192.168.5.*')
stop_dnsmasq(dnsmasq_pid_file)
check_output('systemctl stop systemd-networkd.socket')
check_output('systemctl stop systemd-networkd.service')
check_output('systemctl stop systemd-networkd')
output = check_output('ip address show dev veth99 scope global')
print(output)

View File

@ -13,10 +13,10 @@ Documentation=man:systemd-networkd.service(8)
ConditionCapability=CAP_NET_ADMIN
DefaultDependencies=no
# systemd-udevd.service can be dropped once tuntap is moved to netlink
After=systemd-networkd.socket systemd-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service
After=systemd-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service
Before=network.target multi-user.target shutdown.target
Conflicts=shutdown.target
Wants=systemd-networkd.socket network.target
Wants=network.target
[Service]
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW