Re: DHCPv6 without SLAAC
Roy Marples
Tue Jan 06 14:58:00 2015
Hi Joachim
On Tuesday 30 Dec 2014 10:04:49 Joachim Achtzehnter wrote:
> This is an answer only if one wanted to disable autonomous
> auto-configuration globally as a policy for the subnet, but this wasn't
> my question. Sorry, I should have made this clear.
>
> The question is about client-side configuration. On a subnet where the
> router allows both autonomous and managed address configuration we want
> to configure a host such that it only configures the address assigned by
> DHCP, but not generate addresses autonomously based on the hardware
> address or randomized (privacy extension).
It helps if I read messages like this if not concentrating on Christmas :)
OK, so basically if Auto is set AND Managed is set, you want an option to
ignore Auto.
Here is a patch which allows this, but before I commit it, a question.
If we set this new option and receive a RA with Managed set so DHCPv6 is
kicking off but a new RA appears without Managed set but with prefixes and auto
flags set, should dhcpcd ignore these also or generate SLAAC addresses for
them?
BTW, this patch I committed earlier may be of some use to you.
http://roy.marples.name/projects/dhcpcd/ci/107e7a1a749390472a7b13d8e23b896e1d0fffe5?sbs=0
Thanks
Roy
Index: dhcpcd.conf.5.in
==================================================================
--- dhcpcd.conf.5.in
+++ dhcpcd.conf.5.in
@@ -20,11 +20,11 @@
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 13, 2014
+.Dd January 6, 2015
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
.Nm dhcpcd.conf
.Nd dhcpcd configuration file
@@ -342,10 +342,13 @@
encodes the FQDN hostname as specified in
.Li RFC1035 .
.It Ic interface Ar interface
Subsequent options are only parsed for this
.Ar interface .
+.It Ic ipv6ra_dhcpnoauto
+Do not generate SLAAC addresses for each Prefix advertised by a
+Router Advertisement message with the Auto flag set if the Managed flag is set.
.It Ic ipv6ra_fork
By default, when
.Nm dhcpcd
receives an IPv6 RA,
.Nm dhcpcd
Index: if-options.c
==================================================================
--- if-options.c
+++ if-options.c
@@ -91,10 +91,11 @@
#define O_IPV6 O_BASE + 33
#define O_CONTROLGRP O_BASE + 34
#define O_SLAAC O_BASE + 35
#define O_GATEWAY O_BASE + 36
#define O_PFXDLGMIX O_BASE + 37
+#define O_IPV6RA_DHCPNOAUTO O_BASE + 38
const struct option cf_options[] = {
{"background", no_argument, NULL, 'b'},
{"script", required_argument, NULL, 'c'},
{"debug", no_argument, NULL, 'd'},
@@ -178,10 +179,11 @@
{"nodhcp6", no_argument, NULL, O_NODHCP6},
{"controlgroup", required_argument, NULL, O_CONTROLGRP},
{"slaac", required_argument, NULL, O_SLAAC},
{"gateway", no_argument, NULL, O_GATEWAY},
{"ia_pd_mix", no_argument, NULL, O_PFXDLGMIX},
+ {"ipv6ra_dhcpnoauto", no_argument, NULL, O_IPV6RA_DHCPNOAUTO},
{NULL, 0, NULL, '\0'}
};
static int
atoint(const char *s)
@@ -1214,10 +1216,13 @@
ifo->options |= DHCPCD_IPV6RA_OWN;
break;
case O_IPV6RA_OWN_D:
ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT;
break;
+ case O_IPV6RA_DHCPNOAUTO:
+ ifo->options |= DHCPCD_IPV6RA_DHCPNOAUTO;
+ break;
case O_NOALIAS:
ifo->options |= DHCPCD_NOALIAS;
break;
#ifdef INET6
case O_IA_NA:
Index: if-options.h
==================================================================
--- if-options.h
+++ if-options.h
@@ -104,10 +104,11 @@
#define DHCPCD_DHCP (1ULL << 49)
#define DHCPCD_DHCP6 (1ULL << 50)
#define DHCPCD_NOPFXDLG (1ULL << 51)
#define DHCPCD_PFXDLGONLY (1ULL << 52)
#define DHCPCD_PFXDLGMIX (1ULL << 53)
+#define DHCPCD_IPV6RA_DHCPNOAUTO (1ULL << 54)
extern const struct option cf_options[];
struct if_sla {
char ifname[IF_NAMESIZE];
Index: ipv6nd.c
==================================================================
--- ipv6nd.c
+++ ipv6nd.c
@@ -862,11 +862,15 @@
ap->iface = rap->iface;
ap->flags = IPV6_AF_NEW;
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
+ &&
+ !(rap->flags & ND_RA_FLAG_MANAGED &&
+ ifp->options->options &
+ DHCPCD_IPV6RA_DHCPNOAUTO))
{
ap->flags |= IPV6_AF_AUTOCONF;
ap->dadcounter =
ipv6_makeaddr(&ap->addr, ifp,
&ap->prefix,
Archive administrator: postmaster@marples.name