Commit 44522920 authored by Simon Kelley's avatar Simon Kelley

When advertising ONLY deleted IPv6 prefixes, set router lifetime to zero.

parent dd9d9ce5
...@@ -205,7 +205,7 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de ...@@ -205,7 +205,7 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de
struct dhcp_netid iface_id; struct dhcp_netid iface_id;
struct dhcp_opt *opt_cfg; struct dhcp_opt *opt_cfg;
struct ra_interface *ra_param = find_iface_param(iface_name); struct ra_interface *ra_param = find_iface_param(iface_name);
int done_dns = 0; int done_dns = 0, old_prefix = 0;
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK
FILE *f; FILE *f;
#endif #endif
...@@ -267,7 +267,7 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de ...@@ -267,7 +267,7 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de
struct in6_addr local = context->start6; struct in6_addr local = context->start6;
int do_slaac = 0; int do_slaac = 0;
parm.found_context = 1; old_prefix = 1;
/* zero net part of address */ /* zero net part of address */
setaddr6part(&local, addr6part(&local) & ~((context->prefix == 64) ? (u64)-1LL : (1LLU << (128 - context->prefix)) - 1LLU)); setaddr6part(&local, addr6part(&local) & ~((context->prefix == 64) ? (u64)-1LL : (1LLU << (128 - context->prefix)) - 1LLU));
...@@ -300,9 +300,14 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de ...@@ -300,9 +300,14 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de
up = &context->next; up = &context->next;
} }
if (!parm.found_context) /* If we're advertising only old prefixes, set router lifetime to zero. */
return; if (old_prefix && !parm.found_context)
ra->lifetime = htons(0);
/* No prefixes to advertise. */
if (!old_prefix && !parm.found_context)
return;
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK
/* Note that IPv6 MTU is not necessarilly the same as the IPv4 MTU /* Note that IPv6 MTU is not necessarilly the same as the IPv4 MTU
available from SIOCGIFMTU */ available from SIOCGIFMTU */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment