From 0010b47439ba97e280a544f1dc8c2fe5f3bb315c Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Wed, 29 Feb 2012 12:18:30 +0000 Subject: [PATCH] RA configuration tweaks and documentation improvements. --- dnsmasq.conf.example | 12 ++++++++++-- man/dnsmasq.8 | 12 +++++++++--- src/radv.c | 9 +++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/dnsmasq.conf.example b/dnsmasq.conf.example index e293024..43d8d01 100644 --- a/dnsmasq.conf.example +++ b/dnsmasq.conf.example @@ -161,9 +161,13 @@ # and defaults to 64 if missing/ #dhcp-range=1234::2, 1234::500, 64, 12h -# Not Router Advertisements, BUT NOT DHCP for this subnet. +# Do Router Advertisements, BUT NOT DHCP for this subnet. #dhcp-range=1234::, ra-only +# Do Router Advertisements, BUT NOT DHCP for this subnet. +# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.) +#dhcp-range=1234::, ra-only, 48h + # Supply parameters for specified hosts using DHCP. There are lots # of valid alternatives, so we will give examples of each. Note that # IP addresses DO NOT have to be in the range given above, they just @@ -284,7 +288,11 @@ #dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5 # Send DHCPv6 option. Note [] around IPv6 addresses. -dhcp-option=option6:dns-server,[1234::77],[1234::88] +#dhcp-option=option6:dns-server,[1234::77],[1234::88] + +# Send DHCPv6 option for namservers as the machine running +# dnsmasq and another. +#dhcp-option=option6:dns-server,[::],[1234::88] # Set the NTP time server address to be the same machine as # is running dnsmasq diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index 8707360..1ce21f3 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -704,7 +704,7 @@ and to set the time-server address to 192.168.0.4, do .B --dhcp-option = 42,192.168.0.4 or .B --dhcp-option = option:ntp-server, 192.168.0.4 -The special address 0.0.0.0 is taken to mean "the address of the +The special address 0.0.0.0 (or [::] for DHCPv6) is taken to mean "the address of the machine running dnsmasq". Data types allowed are comma separated dotted-quad IP addresses, a decimal number, colon-separated hex digits and a text string. If the optional tags are given then @@ -1256,9 +1256,15 @@ existing DHCP configuration to provide most data. When RA is enabled, dnsmasq will advertise a prefix for each dhcp-range, with default router and recursive DNS server as the relevant link-local address on the machine running dnsmasq. The "managed address" bits are set, -except for a dhcp-range which is marked as "ra-only". In which case RA +except for a dhcp-range which is marked as "ra-only", in which case RA is provided by no DHCPv6 service and the managed address bits are -cleared. +cleared. +.B enable-ra +enables router advertisement for prefixes where dnsmasq is doing +DHCPv6. It is not needed to "ra-only" prefixes. Creating an "ra-only" +prefix and not setting +.B enable-ra +sends advertisements only to "ra-only" prefixes. .TP .B --enable-tftp[=] Enable the TFTP server function. This is deliberately limited to that diff --git a/src/radv.c b/src/radv.c index d8e522d..544d947 100644 --- a/src/radv.c +++ b/src/radv.c @@ -275,8 +275,13 @@ static int add_prefixes(struct in6_addr *local, int prefix, is_same_net6(local, &context->end6, prefix)) { if (!(context->flags & CONTEXT_RA_ONLY)) - param->managed = 1; - + { + /* don't do RA for non-ra-only unless --enable-ra is set */ + if (!option_bool(OPT_RA)) + continue; + param->managed = 1; + } + if (context->flags & CONTEXT_RA_DONE) continue;