// IA states
static enum odhcp6c_ia_mode na_mode = IA_MODE_NONE, pd_mode = IA_MODE_NONE;
+static bool stateful_only_mode = false;
static bool accept_reconfig = false;
// Server unicast address
static struct in6_addr server_addr = IN6ADDR_ANY_INIT;
IOV_TOTAL
};
-int dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd)
+int dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd, bool stateful_only)
{
int mode = DHCPV6_UNKNOWN;
na_mode = na;
pd_mode = pd;
+ stateful_only_mode = stateful_only;
if (na_mode == IA_MODE_NONE && pd_mode == IA_MODE_NONE)
mode = DHCPV6_STATELESS;
}
}
- if ((!have_na && na_mode == IA_MODE_FORCE) ||
+ if ((stateful_only_mode && !have_na && !have_pd) ||
+ (!have_na && na_mode == IA_MODE_FORCE) ||
(!have_pd && pd_mode == IA_MODE_FORCE)) {
/*
* RFC7083 states to process the SOL_MAX_RT and
uint16_t opttype;
enum odhcp6c_ia_mode ia_na_mode = IA_MODE_TRY;
enum odhcp6c_ia_mode ia_pd_mode = IA_MODE_NONE;
+ bool stateful_only_mode = 0;
struct odhcp6c_opt *opt;
int ia_pd_iaid_index = 0;
int sol_timeout = DHCPV6_SOL_MAX_RT;
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::DN:V:P:FB:c:i:r:Ru:Ux:s:kt:m:Lhedp:fav")) != -1) {
switch (c) {
case 'S':
allow_slaac_only = (optarg) ? atoi(optarg) : -1;
break;
+ case 'D':
+ stateful_only_mode = 1;
+ break;
+
case 'N':
if (!strcmp(optarg, "force")) {
ia_na_mode = IA_MODE_FORCE;
syslog(LOG_NOTICE, "(re)starting transaction on %s", ifname);
signal_usr1 = signal_usr2 = false;
- int mode = dhcpv6_set_ia_mode(ia_na_mode, ia_pd_mode);
+ int mode = dhcpv6_set_ia_mode(ia_na_mode, ia_pd_mode, stateful_only_mode);
if (mode != DHCPV6_STATELESS)
mode = dhcpv6_request(DHCPV6_MSG_SOLICIT);
"Usage: odhcp6c [options] <interface>\n"
"\nFeature options:\n"
" -S <time> Wait at least <time> sec for a DHCP-server (0)\n"
+ " -D Discard advertisements without any address or prefix proposed\n"
" -N <mode> Mode for requesting addresses [try|force|none]\n"
" -P <length> Request IPv6-Prefix (0 = auto)\n"
" -F Force IPv6-Prefix\n"
};
int init_dhcpv6(const char *ifname, unsigned int client_options, int sol_timeout);
-int dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd);
+int dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd, bool stateful_only);
int dhcpv6_request(enum dhcpv6_msg type);
int dhcpv6_poll_reconfigure(void);
int dhcpv6_promote_server_cand(void);