ipv4ll: do not reset conflict counter on restart

Don't reset the conflict counter when trying a new pseudo random
address, so that after trying 10 addresses the londer timeout is used in
accordance with the RFC

Fixes #14299.
This commit is contained in:
AJ Bagwell
2019-12-11 13:26:31 +09:00
committed by Yu Watanabe
parent bfb68540d5
commit e92b60b20f
5 changed files with 9 additions and 6 deletions
+4 -2
View File
@@ -441,7 +441,7 @@ int sd_ipv4acd_is_running(sd_ipv4acd *acd) {
return acd->state != IPV4ACD_STATE_INIT;
}
int sd_ipv4acd_start(sd_ipv4acd *acd) {
int sd_ipv4acd_start(sd_ipv4acd *acd, bool reset_conflicts) {
int r;
assert_return(acd, -EINVAL);
@@ -458,7 +458,9 @@ int sd_ipv4acd_start(sd_ipv4acd *acd) {
safe_close(acd->fd);
acd->fd = r;
acd->defend_window = 0;
acd->n_conflict = 0;
if (reset_conflicts)
acd->n_conflict = 0;
r = sd_event_add_io(acd->event, &acd->receive_message_event_source, acd->fd, EPOLLIN, ipv4acd_on_packet, acd);
if (r < 0)
+1 -1
View File
@@ -241,7 +241,7 @@ static int ipv4ll_start_internal(sd_ipv4ll *ll, bool reset_generation) {
picked_address = true;
}
r = sd_ipv4acd_start(ll->acd);
r = sd_ipv4acd_start(ll->acd, reset_generation);
if (r < 0) {
/* We couldn't start? If so, let's forget the picked address again, the user might make a change and
+1 -1
View File
@@ -47,7 +47,7 @@ static int client_run(int ifindex, const struct in_addr *pa, const struct ether_
log_info("starting IPv4ACD client");
assert_se(sd_ipv4acd_start(acd) >= 0);
assert_se(sd_ipv4acd_start(acd, true) >= 0);
assert_se(sd_event_loop(e) >= 0);
+1 -1
View File
@@ -670,7 +670,7 @@ int address_configure(
log_debug("Starting IPv4ACD client. Probing address %s", strna(pretty));
}
r = sd_ipv4acd_start(address->acd);
r = sd_ipv4acd_start(address->acd, true);
if (r < 0)
log_link_warning_errno(link, r, "Failed to start IPv4ACD client, ignoring: %m");
}
+2 -1
View File
@@ -20,6 +20,7 @@
#include <net/ethernet.h>
#include <netinet/in.h>
#include <stdbool.h>
#include "sd-event.h"
@@ -44,7 +45,7 @@ int sd_ipv4acd_set_mac(sd_ipv4acd *acd, const struct ether_addr *addr);
int sd_ipv4acd_set_ifindex(sd_ipv4acd *acd, int interface_index);
int sd_ipv4acd_set_address(sd_ipv4acd *acd, const struct in_addr *address);
int sd_ipv4acd_is_running(sd_ipv4acd *acd);
int sd_ipv4acd_start(sd_ipv4acd *acd);
int sd_ipv4acd_start(sd_ipv4acd *acd, bool reset_conflicts);
int sd_ipv4acd_stop(sd_ipv4acd *acd);
sd_ipv4acd *sd_ipv4acd_ref(sd_ipv4acd *acd);
sd_ipv4acd *sd_ipv4acd_unref(sd_ipv4acd *acd);