Compare commits
5 Commits
ca19dedb56
...
6d95e7d9b2
Author | SHA1 | Date |
---|---|---|
fangxiuning | 6d95e7d9b2 | |
Fabrice Fontaine | 28e2641a1a | |
Michael Biebl | 9654645b62 | |
Michael Biebl | 3aa645f0c0 | |
Michael Biebl | 2c0dffe82d |
|
@ -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 = 0;
|
||||
int r;
|
||||
|
||||
assert_return(client, -EINVAL);
|
||||
assert_return(client->event, -EINVAL);
|
||||
|
|
|
@ -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 = 0, err;
|
||||
int r, err;
|
||||
|
||||
f = fopen(filename, "re");
|
||||
if (!f)
|
||||
|
|
|
@ -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 = 0;
|
||||
int r;
|
||||
|
||||
struct addrinfo hints = {
|
||||
.ai_family = PF_UNSPEC,
|
||||
|
|
|
@ -478,7 +478,7 @@ int config_parse_n_autovts(
|
|||
|
||||
static int vt_is_busy(unsigned vtnr) {
|
||||
struct vt_stat vt_stat;
|
||||
int r = 0;
|
||||
int r;
|
||||
_cleanup_close_ int fd;
|
||||
|
||||
assert(vtnr >= 1);
|
||||
|
|
|
@ -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 = 0;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
|
|
|
@ -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 = 0;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static int context_save(Context *context) {
|
|||
NetDev *netdev;
|
||||
Link *link;
|
||||
Iterator i;
|
||||
int k, r = 0;
|
||||
int k, r;
|
||||
const char *p;
|
||||
|
||||
p = prefix_roota(arg_root, NETWORKD_UNIT_DIRECTORY);
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
#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
|
||||
|
@ -154,9 +157,6 @@ 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,
|
||||
|
|
|
@ -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 = 0;
|
||||
int r;
|
||||
|
||||
/* verbose==true means we should log at non-debug level if we
|
||||
* fail to find or load the module. */
|
||||
|
|
|
@ -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 = 0;
|
||||
int r;
|
||||
bool any = false;
|
||||
|
||||
r = seccomp_rule_add_exact(
|
||||
|
|
|
@ -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 = 0, n;
|
||||
int r, 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 = 0;
|
||||
int r;
|
||||
|
||||
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 = 0;
|
||||
int r;
|
||||
|
||||
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 = 0;
|
||||
int r;
|
||||
|
||||
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 = 0;
|
||||
int r;
|
||||
|
||||
if (!argv[1])
|
||||
return 0;
|
||||
|
|
|
@ -223,7 +223,8 @@ Gateway=192.168.250.1''')
|
|||
subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
|
||||
|
||||
def tearDown(self):
|
||||
subprocess.check_call(['systemctl', 'stop', 'systemd-networkd'])
|
||||
subprocess.check_call(['systemctl', 'stop', 'systemd-networkd.socket'])
|
||||
subprocess.check_call(['systemctl', 'stop', 'systemd-networkd.service'])
|
||||
subprocess.check_call(['ip', 'link', 'del', 'mybridge'])
|
||||
subprocess.check_call(['ip', 'link', 'del', 'port1'])
|
||||
subprocess.check_call(['ip', 'link', 'del', 'port2'])
|
||||
|
@ -309,7 +310,8 @@ class ClientTestBase(NetworkdTestingUtilities):
|
|||
|
||||
def tearDown(self):
|
||||
self.shutdown_iface()
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd'])
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd.socket'])
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd.service'])
|
||||
subprocess.call(['ip', 'link', 'del', 'dummy0'],
|
||||
stderr=subprocess.DEVNULL)
|
||||
|
||||
|
@ -987,7 +989,8 @@ class MatchClientTest(unittest.TestCase, NetworkdTestingUtilities):
|
|||
|
||||
def tearDown(self):
|
||||
"""Stop networkd."""
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd'])
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd.socket'])
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd.service'])
|
||||
|
||||
def test_basic_matching(self):
|
||||
"""Verify the Name= line works throughout this class."""
|
||||
|
@ -1037,7 +1040,8 @@ class UnmanagedClientTest(unittest.TestCase, NetworkdTestingUtilities):
|
|||
|
||||
def tearDown(self):
|
||||
"""Stop networkd."""
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd'])
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd.socket'])
|
||||
subprocess.call(['systemctl', 'stop', 'systemd-networkd.service'])
|
||||
|
||||
def create_iface(self):
|
||||
"""Create temporary veth pairs for interface matching."""
|
||||
|
|
|
@ -328,7 +328,7 @@ def tearDownModule():
|
|||
|
||||
shutil.rmtree(networkd_ci_path)
|
||||
|
||||
for u in ['systemd-networkd.service', 'systemd-resolved.service']:
|
||||
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service']:
|
||||
check_output(f'systemctl stop {u}')
|
||||
|
||||
shutil.rmtree('/run/systemd/system/systemd-networkd.service.d')
|
||||
|
@ -464,7 +464,8 @@ 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')
|
||||
check_output('systemctl stop systemd-networkd.socket')
|
||||
check_output('systemctl stop systemd-networkd.service')
|
||||
if show_logs:
|
||||
print(check_output('journalctl _SYSTEMD_INVOCATION_ID=' + invocation_id))
|
||||
if remove_state_files:
|
||||
|
@ -2447,7 +2448,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
|||
self.assertRegex(output, 'Search Domains: one')
|
||||
|
||||
def test_keep_configuration_static(self):
|
||||
check_output('systemctl stop systemd-networkd')
|
||||
check_output('systemctl stop systemd-networkd.socket')
|
||||
check_output('systemctl stop systemd-networkd.service')
|
||||
|
||||
check_output('ip link add name dummy98 type dummy')
|
||||
check_output('ip address add 10.1.2.3/16 dev dummy98')
|
||||
|
@ -3610,7 +3612,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
check_output('systemctl stop systemd-networkd')
|
||||
check_output('systemctl stop systemd-networkd.socket')
|
||||
check_output('systemctl stop systemd-networkd.service')
|
||||
|
||||
print('The lease address should be kept after networkd stopped')
|
||||
output = check_output('ip address show dev veth99 scope global')
|
||||
|
@ -3645,7 +3648,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
stop_dnsmasq(dnsmasq_pid_file)
|
||||
check_output('systemctl stop systemd-networkd')
|
||||
check_output('systemctl stop systemd-networkd.socket')
|
||||
check_output('systemctl stop systemd-networkd.service')
|
||||
|
||||
output = check_output('ip address show dev veth99 scope global')
|
||||
print(output)
|
||||
|
|
|
@ -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-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service
|
||||
After=systemd-networkd.socket systemd-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service
|
||||
Before=network.target multi-user.target shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
Wants=network.target
|
||||
Wants=systemd-networkd.socket network.target
|
||||
|
||||
[Service]
|
||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW
|
||||
|
|
Loading…
Reference in New Issue