From: Roy Marples Date: Thu, 8 Jan 2015 13:31:42 +0000 (+0000) Subject: Add an option to disable the generation of autoconf addresses within a RA. X-Git-Tag: v6.7.0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62f12387ac7944e54d05a96cbb300165f064fb86;p=thirdparty%2Fdhcpcd.git Add an option to disable the generation of autoconf addresses within a RA. --- diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in index 2c4c8b9c..778ee932 100644 --- a/dhcpcd.conf.5.in +++ b/dhcpcd.conf.5.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 13, 2014 +.Dd January 8, 2015 .Dt DHCPCD.CONF 5 .Os .Sh NAME @@ -344,6 +344,12 @@ encodes the FQDN hostname as specified in .It Ic interface Ar interface Subsequent options are only parsed for this .Ar interface . +.It Ic ipv6ra_autoconf +Generate SLAAC addresses for each Prefix advertised by a +Router Advertisement message with the Auto flag set. +On by default. +.It Ic ipv6ra_noautoconf +Disables the above option. .It Ic ipv6ra_fork By default, when .Nm dhcpcd diff --git a/if-options.c b/if-options.c index 8f57981e..904be4f6 100644 --- a/if-options.c +++ b/if-options.c @@ -93,6 +93,8 @@ #define O_SLAAC O_BASE + 35 #define O_GATEWAY O_BASE + 36 #define O_PFXDLGMIX O_BASE + 37 +#define O_IPV6RA_AUTOCONF O_BASE + 38 +#define O_IPV6RA_NOAUTOCONF O_BASE + 39 const struct option cf_options[] = { {"background", no_argument, NULL, 'b'}, @@ -146,6 +148,8 @@ const struct option cf_options[] = { {"fallback", required_argument, NULL, O_FALLBACK}, {"ipv6rs", no_argument, NULL, O_IPV6RS}, {"noipv6rs", no_argument, NULL, O_NOIPV6RS}, + {"ipv6ra_autoconf", no_argument, NULL, O_IPV6RA_AUTOCONF}, + {"ipv6ra_noautoconf", no_argument, NULL, O_IPV6RA_NOAUTOCONF}, {"ipv6ra_fork", no_argument, NULL, O_IPV6RA_FORK}, {"ipv6ra_own", no_argument, NULL, O_IPV6RA_OWN}, {"ipv6ra_own_default", no_argument, NULL, O_IPV6RA_OWN_D}, @@ -1216,6 +1220,12 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, case O_IPV6RA_OWN_D: ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT; break; + case O_IPV6RA_AUTOCONF: + ifo->options |= DHCPCD_IPV6RA_AUTOCONF; + break; + case O_IPV6RA_NOAUTOCONF: + ifo->options &= ~DHCPCD_IPV6RA_AUTOCONF; + break; case O_NOALIAS: ifo->options |= DHCPCD_NOALIAS; break; @@ -2028,7 +2038,8 @@ read_config(struct dhcpcd_ctx *ctx, ifo->options |= DHCPCD_GATEWAY | DHCPCD_ARP; #endif #ifdef INET6 - ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS; + ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS; + ifo->options |= DHCPCD_IPV6RA_AUTOCONF | DHCPCD_IPV6RA_REQRDNSS; ifo->options |= DHCPCD_DHCP6; #endif ifo->timeout = DEFAULT_TIMEOUT; diff --git a/if-options.h b/if-options.h index b958a6ae..ec7d3191 100644 --- a/if-options.h +++ b/if-options.h @@ -106,6 +106,7 @@ #define DHCPCD_NOPFXDLG (1ULL << 51) #define DHCPCD_PFXDLGONLY (1ULL << 52) #define DHCPCD_PFXDLGMIX (1ULL << 53) +#define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54) extern const struct option cf_options[]; diff --git a/ipv6nd.c b/ipv6nd.c index 88b224db..b7081537 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -864,7 +864,9 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp, ap->prefix_len = pi->nd_opt_pi_prefix_len; ap->prefix = pi->nd_opt_pi_prefix; if (pi->nd_opt_pi_flags_reserved & - ND_OPT_PI_FLAG_AUTO) + ND_OPT_PI_FLAG_AUTO && + ap->iface->options->options & + DHCPCD_IPV6RA_AUTOCONF) { ap->flags |= IPV6_AF_AUTOCONF; ap->dadcounter =