diff options
-rw-r--r-- | accel-pppd/ipdb.h | 1 | ||||
-rw-r--r-- | accel-pppd/ipv6/nd.c | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/accel-pppd/ipdb.h b/accel-pppd/ipdb.h index f2a6cee7..2565c924 100644 --- a/accel-pppd/ipdb.h +++ b/accel-pppd/ipdb.h @@ -17,6 +17,7 @@ struct ipv6db_addr_t struct list_head entry; struct in6_addr addr; int prefix_len; + int flag_onlink:1; int flag_auto:1; int installed:1; }; diff --git a/accel-pppd/ipv6/nd.c b/accel-pppd/ipv6/nd.c index 1d70ae95..205aeefd 100644 --- a/accel-pppd/ipv6/nd.c +++ b/accel-pppd/ipv6/nd.c @@ -42,6 +42,7 @@ static int conf_AdvCurHopLimit = 64; static int conf_AdvDefaultLifetime; static int conf_AdvPrefixValidLifetime = 2592000; static int conf_AdvPrefixPreferredLifetime = 604800; +static int conf_AdvPrefixOnLinkFlag; static int conf_AdvPrefixAutonomousFlag; @@ -132,8 +133,9 @@ static void ipv6_nd_send_ra(struct ipv6_nd_handler_t *h, struct sockaddr_in6 *ad pinfo->nd_opt_pi_type = ND_OPT_PREFIX_INFORMATION; pinfo->nd_opt_pi_len = 4; pinfo->nd_opt_pi_prefix_len = a->prefix_len; - pinfo->nd_opt_pi_flags_reserved = ND_OPT_PI_FLAG_ONLINK | - (a->flag_auto || (conf_AdvPrefixAutonomousFlag && a->prefix_len == 64)) ? ND_OPT_PI_FLAG_AUTO : 0; + pinfo->nd_opt_pi_flags_reserved = + ((a->flag_onlink || conf_AdvPrefixOnLinkFlag) ? ND_OPT_PI_FLAG_ONLINK : 0) | + ((a->flag_auto || (conf_AdvPrefixAutonomousFlag && a->prefix_len == 64)) ? ND_OPT_PI_FLAG_AUTO : 0); pinfo->nd_opt_pi_valid_time = htonl(conf_AdvPrefixValidLifetime); pinfo->nd_opt_pi_preferred_time = htonl(conf_AdvPrefixPreferredLifetime); memcpy(&pinfo->nd_opt_pi_prefix, &a->addr, 8); @@ -489,6 +491,7 @@ static void load_config(void) conf_AdvManagedFlag = triton_module_loaded("ipv6_dhcp"); conf_AdvOtherConfigFlag = triton_module_loaded("ipv6_dhcp"); + conf_AdvPrefixOnLinkFlag = 1; conf_AdvPrefixAutonomousFlag = !conf_AdvManagedFlag; conf_rdnss_lifetime = conf_MaxRtrAdvInterval; @@ -539,6 +542,10 @@ static void load_config(void) if (opt) conf_AdvPrefixPreferredLifetime = atoi(opt); + opt = conf_get_opt("ipv6-nd", "AdvOnLinkFlag"); + if (opt) + conf_AdvPrefixOnLinkFlag = atoi(opt); + opt = conf_get_opt("ipv6-nd", "AdvAutonomousFlag"); if (opt) conf_AdvPrefixAutonomousFlag = atoi(opt); |