// client options
static unsigned int client_options = 0;
+// Minimum valid lifetime for IA_PD updates
+static unsigned int pd_safe_valid = 0;
+
static uint32_t ntohl_unaligned(const uint8_t *data)
{
uint32_t buf;
return "Unknown";
}
-int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout)
+int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout, unsigned int ia_pd_safe_valid)
{
client_options = options;
dhcpv6_retx[DHCPV6_MSG_SOLICIT].max_timeo = sol_timeout;
+ pd_safe_valid = ia_pd_safe_valid;
sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
if (sock < 0)
}
if (ok) {
- if (odhcp6c_update_entry(STATE_IA_PD, &entry, 0, 0))
+ if (odhcp6c_update_entry(STATE_IA_PD, &entry, pd_safe_valid, 0))
updated_IAs++;
syslog(LOG_INFO, "%s/%d preferred %d valid %d",
struct odhcp6c_opt *opt;
int ia_pd_iaid_index = 0;
int sol_timeout = DHCPV6_SOL_MAX_RT;
+ unsigned int ia_pd_safe_valid = 5;
int verbosity = 0;
bool help = false, daemonize = false;
int logopt = LOG_PID;
unsigned int ra_options = RA_RDNSS_DEFAULT_LIFETIME;
unsigned int ra_holdoff_interval = RA_MIN_ADV_INTERVAL;
- while ((c = getopt(argc, argv, "S::N:V:P:FB:c:i:r:Ru:Ux:s:kt:m:Lhedp:fav")) != -1) {
+ while ((c = getopt(argc, argv, "S::N:V:P:FB:c:i:r:Ru:Ux:s:kt:m:D:Lhedp:fav")) != -1) {
switch (c) {
case 'S':
allow_slaac_only = (optarg) ? atoi(optarg) : -1;
ra_holdoff_interval = atoi(optarg);
break;
+ case 'D':
+ ia_pd_safe_valid = atoi(optarg);
+ if (ia_pd_safe_valid > 60)
+ ia_pd_safe_valid = 60;
+ break;
+
case 'L':
ra_options &= ~RA_RDNSS_DEFAULT_LIFETIME;
break;
signal(SIGUSR2, sighandler);
if ((urandom_fd = open("/dev/urandom", O_CLOEXEC | O_RDONLY)) < 0 ||
- init_dhcpv6(ifname, client_options, sol_timeout) ||
+ init_dhcpv6(ifname, client_options, sol_timeout, ia_pd_safe_valid) ||
ra_init(ifname, &ifid, ra_options, ra_holdoff_interval) ||
script_init(script, ifname)) {
syslog(LOG_ERR, "failed to initialize: %s", strerror(errno));
" -k Don't send a RELEASE when stopping\n"
" -t <seconds> Maximum timeout for DHCPv6-SOLICIT (120)\n"
" -m <seconds> Minimum time between accepting RA updates (3)\n"
+ " -D <seconds> Minimum valid lifetime for IA_PD updates (5)\n"
" -L Ignore default lifetime for RDNSS records\n"
" -U Ignore Server Unicast option\n"
"\nInvocation options:\n"
const char *str;
};
-int init_dhcpv6(const char *ifname, unsigned int client_options, int sol_timeout);
+int init_dhcpv6(const char *ifname, unsigned int client_options, int sol_timeout, unsigned int ia_pd_safe_valid);
int dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd);
int dhcpv6_request(enum dhcpv6_msg type);
int dhcpv6_poll_reconfigure(void);