Mercurial > hg > dhcpcd
changeset 5182:72d627ef016e draft
inet6: Mark temp addrs for regen
This solves an infinite loop where new temp addrs regened are
added at the tail and we loop endlessly.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 29 Apr 2020 22:41:35 +0100 |
| parents | 6788ac9191a7 |
| children | 09e3f731e43e |
| files | src/ipv6.c src/ipv6.h |
| diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ipv6.c Wed Apr 29 16:33:57 2020 +0100 +++ b/src/ipv6.c Wed Apr 29 22:41:35 2020 +0100 @@ -2073,10 +2073,22 @@ ipv6_regen_desync(ifp, true); clock_gettime(CLOCK_MONOTONIC, &tv); + + /* Mark addresses for regen so we don't infinite loop. */ TAILQ_FOREACH(ia, &state->addrs, next) { if (ia->flags & IPV6_AF_TEMPORARY && !(ia->flags & IPV6_AF_STALE)) + ia->flags |= IPV6_AF_REGEN; + else + ia->flags &= ~IPV6_AF_REGEN; + } + + /* Now regen temp addrs */ + TAILQ_FOREACH(ia, &state->addrs, next) { + if (ia->flags & IPV6_AF_REGEN) { ipv6_regentempaddr0(ia, &tv); + ia->flags &= ~IPV6_AF_REGEN; + } } } #endif /* IPV6_MANAGETEMPADDR */
--- a/src/ipv6.h Wed Apr 29 16:33:57 2020 +0100 +++ b/src/ipv6.h Wed Apr 29 22:41:35 2020 +0100 @@ -225,8 +225,9 @@ #define IPV6_AF_DELEGATEDLOG (1U << 11) #define IPV6_AF_RAPFX (1U << 12) #define IPV6_AF_EXTENDED (1U << 13) +#define IPV6_AF_REGEN (1U << 14) #ifdef IPV6_MANAGETEMPADDR -#define IPV6_AF_TEMPORARY (1U << 14) +#define IPV6_AF_TEMPORARY (1U << 15) #endif struct ll_callback {
