diff options
author | Dan Streetman <ddstreet@canonical.com> | 2020-05-02 15:56:33 +0200 |
---|---|---|
committer | Dan Streetman <ddstreet@canonical.com> | 2020-05-26 15:52:50 +0200 |
commit | 6b8a1aa6a37b59565e400a379a27ac60ce59f895 (patch) | |
tree | f4efdb3cabfeae319a378b917ef34c297565a5d2 /src | |
parent | network: Change IgnoreCarrierLoss default to value of ConfigureWithoutCarrier (diff) | |
download | systemd-6b8a1aa6a37b59565e400a379a27ac60ce59f895.tar.xz systemd-6b8a1aa6a37b59565e400a379a27ac60ce59f895.zip |
network: return 1 on start and 0 if ipv4ll is already started
Instead of -EBUSY, return 0 from sd_ipv4ll_start() if it's already started,
and change successful start return value to 1.
This matches sd_ndisc_start() behavior; 1 indicates successful start, and
0 indicates already started.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-network/sd-ipv4ll.c | 6 | ||||
-rw-r--r-- | src/libsystemd-network/test-ipv4ll.c | 4 | ||||
-rw-r--r-- | src/libsystemd-network/test-ndisc-rs.c | 1 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c index aa1ece41d2..4f4d9ebe87 100644 --- a/src/libsystemd-network/sd-ipv4ll.c +++ b/src/libsystemd-network/sd-ipv4ll.c @@ -252,12 +252,14 @@ static int ipv4ll_start_internal(sd_ipv4ll *ll, bool reset_generation) { return r; } - return 0; + return 1; } int sd_ipv4ll_start(sd_ipv4ll *ll) { assert_return(ll, -EINVAL); - assert_return(sd_ipv4ll_is_running(ll) == 0, -EBUSY); + + if (sd_ipv4ll_is_running(ll)) + return 0; return ipv4ll_start_internal(ll, true); } diff --git a/src/libsystemd-network/test-ipv4ll.c b/src/libsystemd-network/test-ipv4ll.c index 2f319bf7d9..6051e65820 100644 --- a/src/libsystemd-network/test-ipv4ll.c +++ b/src/libsystemd-network/test-ipv4ll.c @@ -159,10 +159,10 @@ static void test_basic_request(sd_event *e) { assert_se(sd_ipv4ll_start(ll) == -EINVAL); assert_se(sd_ipv4ll_set_ifindex(ll, 1) == 0); - assert_se(sd_ipv4ll_start(ll) == 0); + assert_se(sd_ipv4ll_start(ll) == 1); sd_event_run(e, (uint64_t) -1); - assert_se(sd_ipv4ll_start(ll) == -EBUSY); + assert_se(sd_ipv4ll_start(ll) == 0); assert_se(sd_ipv4ll_is_running(ll)); diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c index c8ee1ec31d..9fc902645c 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test-ndisc-rs.c @@ -297,6 +297,7 @@ static void test_rs(void) { assert_se(sd_ndisc_stop(nd) >= 0); assert_se(sd_ndisc_start(nd) >= 0); + assert_se(sd_ndisc_start(nd) >= 0); assert_se(sd_ndisc_stop(nd) >= 0); assert_se(sd_ndisc_start(nd) >= 0); |