mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
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.
This commit is contained in:
parent
bd0d471c8f
commit
6b8a1aa6a3
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user