Skip to content

Commit

Permalink
pluto: in lease_an_address() do not handle lingering if we can't shar…
Browse files Browse the repository at this point in the history
…e lease anyway
  • Loading branch information
letoams committed Sep 5, 2018
1 parent 4bb09b3 commit 9ccfe20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion programs/pluto/addresspool.c
Expand Up @@ -347,6 +347,7 @@ err_t lease_an_address(const struct connection *c, const struct state *st,
struct lease_addr **pp;
struct lease_addr *p;
struct lease_addr *ll = NULL; /* longest lingerer */
bool can_share = can_share_lease(c);

for (pp = &c->pool->leases; (p = *pp) != NULL; pp = &p->next) {
/* check that list of leases is
Expand All @@ -357,7 +358,7 @@ err_t lease_an_address(const struct connection *c, const struct state *st,
break;
}
/* remember the longest lingering lease found */
if (p->refcnt == 0 &&
if (can_share && p->refcnt == 0 &&
(ll == NULL ||
monobefore(ll->lingering_since, p->lingering_since)))
ll = p;
Expand Down

0 comments on commit 9ccfe20

Please sign in to comment.