[OpenWrt-Devel] [PATCH RESEND] dnsmasq: add config option for ra_names

Felix Fietkau nbd at openwrt.org
Sun Jan 3 15:28:11 EST 2016

On 2015-12-29 17:58, Dominique Martinet wrote:
> Signed-off-by: Dominique Martinet <asmadeus at codewreck.org>
> ---
> I posted this quite another while ago:
> Dominique Martinet wrote on Sun, Jul 14, 2013:
>> I posted this quite a while ago:
>> Dominique Martinet wrote on Fri, Jul 06, 2012:
>>> ra_names is a feature introduced in dnsmasq 2.61, which is why I changed
>>> the rules to build something newer (and figured I might as well take it
>>> to 62)
>>> Basically, it:
>>>  - does router-advertisment (not dhcpv6)
>>>  - when it gets a request for RA, it looks up if there is an active ipv4
>>>  lease for the same host via its MAC address, and if there is it adds
>>>  the to-be ipv6 to the local dns (assuming the host will take the dns)
>>>  - when it gets a dhcpv4 release it takes off the ipv6 dns record as
>>>  well
>>> (since RA is stateless and doesn't give the host name, I couldn't figure
>>> any better way without dhcpv6; I was about to hack something (with a
>>> very large axe and radvd) when I found out they've done it already :D)
>>> There are also modes for router-advertisment only which I haven't looked
>>> at, and a dhcpv6 client implementation that I didn't try yet either.
>>> The option I added is in the dhcp field, a "ra_name" option with the
>>> prefix to announce in RAs, i.e.
>>> config dhcp 'lan'
>>> 	option interface 'lan'
>>> 	option ra_names '2001:dead:beef::'
>> Since I re-installed my router I looked to see if there was another way
>> to give dnsmasq a custom option, but couldn't find any - maybe I'm just
>> blind though.
>> That being said, I think this is a nice feature for anyone with a dual
>> stack ipv4/ipv6 at home, it "just works", and if there is no other clean
>> way to add this in the config I wouldn't mind getting this added.
>> If you have any suggestion/qualms about it, please tell me and I'm
>> willing to try to get these fixed before sending a new patch.
>> (unless of course it's a "we're not interested" - but if I just need to
>> add a checkbox to luci I'll consider it.)
>> The original patch inclued a dnsmasq version bump which isn't needed
>> anymore, so here's the short bit that would interest me:
>> (just checked it still applies to trunk one year later, I just had to
>> change the file path. This mail should apply with git am/git apply.)
> The patch didn't get any reply so I guess it's more of a "we're not interested"
> kind of answer, but I still like this option so trying my chance again...
> Maybe now more people (hopefully) have ipv6 this will get a new look.
>  package/network/services/dnsmasq/files/dnsmasq.init |    6 ++++++
>  1 file changed, 6 insertions(+)
> diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
> index 630c07d..a2f274e 100644
> --- a/package/network/services/dnsmasq/files/dnsmasq.init
> +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> @@ -375,6 +375,12 @@ dhcp_add() {
>  	xappend "--dhcp-range=$networkid,$START,$END,$NETMASK,$leasetime${options:+ $options}"
>  	dhcp_option_add "$cfg" "$networkid"
> +
> +	config_get ra_names "$cfg" ra_names
> +
> +	[ -n "$ra_names" ] && {
> +		xappend "--dhcp-range=$networkid,$ra_names,ra-names,$leasetime"
> +	}
It seems to me that configuring this manually limits its use. Wouldn't
it be better to integrate it with OpenWrt's prefix delegation support?
this would make it work with dynamically assigned prefixes.

When the init script runs, it could query netifd for assigned prefixes
belonging to that particular interface, and use those for ra_names.

- Felix
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list