diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2016-05-12 21:17:48 +0500 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-12-05 13:05:17 +0300 |
commit | b2e5304764b10fb42bbd79ed16aa4ddede9662a3 (patch) | |
tree | a71ba41ff0d10cf8d8709afe14554d6003facb32 | |
parent | b10597339679e25037a8dca89cd094386a35081d (diff) | |
download | accel-ppp-b2e5304764b10fb42bbd79ed16aa4ddede9662a3.tar.gz accel-ppp-b2e5304764b10fb42bbd79ed16aa4ddede9662a3.zip |
ipv6: nd: add AdvOnLinkFlag option support
-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 d461c88..4049490 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 19a3d7d..a5557ec 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); @@ -488,6 +490,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; @@ -538,6 +541,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); |