Skip to content

Commit

Permalink
IPv4LL: Don't start if already started
Browse files Browse the repository at this point in the history
It's just pointless noise.
A follow-on fix for #255.
  • Loading branch information
rsmarples committed Oct 23, 2023
1 parent d408e74 commit 2d07224
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/ipv4ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ ipv4ll_start(void *arg)
}
}

if (state->running)
return;
state->running = true;

/* RFC 3927 Section 2.1 states that the random number generator
* SHOULD be seeded with a value derived from persistent information
* such as the IEEE 802 MAC address so that it usually picks
Expand Down Expand Up @@ -435,11 +439,14 @@ ipv4ll_drop(struct interface *ifp)
return;

state = IPV4LL_STATE(ifp);
if (state && state->addr != NULL) {
if (ifp->options->options & DHCPCD_CONFIGURE)
ipv4_deladdr(state->addr, 1);
state->addr = NULL;
dropped = true;
if (state) {
state->running = false;
if (state->addr != NULL) {
if (ifp->options->options & DHCPCD_CONFIGURE)
ipv4_deladdr(state->addr, 1);
state->addr = NULL;
dropped = true;
}
}

/* Free any other link local addresses that might exist. */
Expand Down
1 change: 1 addition & 0 deletions src/ipv4ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct ipv4ll_state {
struct in_addr pickedaddr;
struct ipv4_addr *addr;
char randomstate[128];
bool running;
bool seeded;
bool down;
size_t conflicts;
Expand Down

0 comments on commit 2d07224

Please sign in to comment.