(void)scope;
(void)flags;
+ (void)valid;
+ (void)preferred;
struct cparam *param = vparam;
log_context(AF_INET6, context);
}
-
- if (context)
- {
- if (valid == -1)
- context->valid = valid;
- else
- context->valid = valid + param->now;
-
- if (preferred == -1)
- context->preferred = preferred;
- else
- context->preferred = preferred + param->now;
- }
}
return 1;
struct ra_param *param = vparam;
(void)scope; /* warning */
- (void)flags;
- (void)preferred;
- (void)valid;
-
+
if (if_index == param->ind)
{
if (IN6_IS_ADDR_LINKLOCAL(local))
int do_prefix = 0;
int do_slaac = 0;
int deprecate = 0;
- int found_constructed = 0;
unsigned int time = 0xffffffff;
- int calc_valid = 0, calc_preferred = 0;
struct dhcp_context *context;
for (context = daemon->dhcp6; context; context = context->next)
param->other = 1;
}
- if (context->flags & CONTEXT_CONSTRUCTED)
- {
- found_constructed = 1;
- calc_valid = context->valid;
- calc_preferred = context->preferred;
- if (context->valid != -1)
- calc_valid -= (int)param->now;
- if (context->preferred != -1)
- calc_preferred -= (int)param->now;
- }
-
/* find floor time */
if (time > context->lease_time)
time = context->lease_time;
param->found_context = 1;
}
- if (!found_constructed)
+ /* configured time is ceiling */
+ if ((unsigned int)valid > time)
+ valid = time;
+
+ if ((flags & IFACE_DEPRECATED) || deprecate)
+ preferred = 0;
+ else
{
- calc_valid = time;
- calc_preferred = deprecate ? 0 : time;
+ /* configured time is ceiling */
+ if ((unsigned int)preferred > time)
+ preferred = time;
}
if (do_prefix)
opt->prefix_len = prefix;
/* autonomous only if we're not doing dhcp, always set "on-link" */
opt->flags = do_slaac ? 0xC0 : 0x80;
- opt->valid_lifetime = htonl(calc_valid);
- opt->preferred_lifetime = htonl(calc_preferred);
+ opt->valid_lifetime = htonl(valid);
+ opt->preferred_lifetime = htonl(preferred);
opt->reserved = 0;
opt->prefix = *local;