diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2021-07-18 18:43:26 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2021-07-18 19:03:25 +0200 |
commit | bc9d317f2921ae6b529f2c9f8de79b75992e206f (patch) | |
tree | c32b4556bd9d090eabae72186f6659475beedb97 /src/dhcpv6-ia.c | |
parent | 564d25e53fad925fa3ed56e3004c107d40925fa4 (diff) |
dhcpv6-ia: fix invalid preferred lifetime
Preferred lifetime cannot be greater than the valid lifetime of an IA;
fix this by checking if the preferred lifetime does not exceed the
valid lifetime of an IA
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r-- | src/dhcpv6-ia.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 639e368..c378c09 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -896,6 +896,9 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, if (prefix_valid > leasetime) prefix_valid = leasetime; + if (prefix_pref > prefix_valid) + prefix_pref = prefix_valid; + if (a->flags & OAF_DHCPV6_PD) { struct dhcpv6_ia_prefix o_ia_p = { .type = htons(DHCPV6_OPT_IA_PREFIX), |