]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add an option to disable the generation of autoconf addresses within a RA.
authorRoy Marples <roy@marples.name>
Thu, 8 Jan 2015 13:31:42 +0000 (13:31 +0000)
committerRoy Marples <roy@marples.name>
Thu, 8 Jan 2015 13:31:42 +0000 (13:31 +0000)
dhcpcd.conf.5.in
if-options.c
if-options.h
ipv6nd.c

index 2c4c8b9ce58ce252f9a2803979f547c0d669cfdf..778ee93262828f9b9acf6fdf7fed90eaa785335a 100644 (file)
@@ -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
index 8f57981ef87da39d8bf56797b8bc7acb876b7b65..904be4f648a7ed56f6f6a3b4c665b50ba19c4175 100644 (file)
@@ -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;
index b958a6ae4b964acd2d61c9d1d8a9141e4a919085..ec7d3191f21e83dd8e5c0fc1aad024a3761703b8 100644 (file)
 #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[];
 
index 88b224db2170f44886085d30281b7cf9cf6c4104..b7081537dba33d4ba44381cd73680ad6c5611153 100644 (file)
--- 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 =