From 8d030462695410290e24d6ab19f0f242f0debb6a Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Mon, 29 Jul 2013 15:41:26 +0100 Subject: [PATCH] Add --force-fast-ra option. --- CHANGELOG | 2 ++ man/dnsmasq.8 | 6 ++++++ src/dnsmasq.h | 3 ++- src/option.c | 3 +++ src/radv.c | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9322f8f..0454976 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -90,6 +90,8 @@ version 2.67 smallest valid dhcp-range is sent. Thanks to Uwe Schindler for suggesting this. + Add --force-fast-ra option. Another thanks to Uwe Schindler. + version 2.66 Add the ability to act as an authoritative DNS diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index 8e9137c..061c0ac 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -1487,6 +1487,12 @@ the relevant link-local address of the machine running dnsmasq is sent as recursive DNS server. If provided, the DHCPv6 options dns-server and domain-search are used for RDNSS and DNSSL. .TP +.B --force-fast-ra +Normally, dnsmasq advertises a new IPv6 prefix frequently (every 10 seconds or so) for the first minute, and then +drops back to sending "maintenance" advertisements every 10 minutes or so. This option forces dnsmasq to be always in +frequent RA mode. It's a bug workaround for mobile devices which go deaf to RAs during sleep and therefore +lose conectivity; with frequent RAs they recover in a reasonable time after wakeup. +.TP .B --enable-tftp Enable the TFTP server function. This is deliberately limited to that needed to net-boot a client. Only reading is allowed; the tsize and diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 268b1b4..38c8a4d 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -221,7 +221,8 @@ struct event_desc { #define OPT_TFTP_LC 38 #define OPT_CLEVERBIND 39 #define OPT_TFTP 40 -#define OPT_LAST 41 +#define OPT_FAST_RA 41 +#define OPT_LAST 42 /* extra flags for my_syslog, we use a couple of facilities since they are known not to occupy the same bits as priorities, no matter how syslog.h is set up. */ diff --git a/src/option.c b/src/option.c index 56735ae..1dc3753 100644 --- a/src/option.c +++ b/src/option.c @@ -132,6 +132,7 @@ struct myoption { #ifdef OPTION6_PREFIX_CLASS #define LOPT_PREF_CLSS 321 #endif +#define LOPT_FAST_RA 322 #ifdef HAVE_GETOPT_LONG static const struct option opts[] = @@ -269,6 +270,7 @@ static const struct myoption opts[] = #ifdef OPTION6_PREFIX_CLASS { "dhcp-prefix-class", 1, 0, LOPT_PREF_CLSS }, #endif + { "force-fast-ra", 0, 0, LOPT_FAST_RA }, { NULL, 0, 0, 0 } }; @@ -397,6 +399,7 @@ static struct { { LOPT_CONNTRACK, OPT_CONNTRACK, NULL, gettext_noop("Copy connection-track mark from queries to upstream connections."), NULL }, { LOPT_FQDN, OPT_FQDN_UPDATE, NULL, gettext_noop("Allow DHCP clients to do their own DDNS updates."), NULL }, { LOPT_RA, OPT_RA, NULL, gettext_noop("Send router-advertisements for interfaces doing DHCPv6"), NULL }, + { LOPT_FAST_RA, OPT_FAST_RA, NULL, gettext_noop("Always send frequent router-advertisements"), NULL }, { LOPT_DUID, ARG_ONE, ",", gettext_noop("Specify DUID_EN-type DHCPv6 server DUID"), NULL }, { LOPT_HOST_REC, ARG_DUP, ",
", gettext_noop("Specify host (A/AAAA and PTR) records"), NULL }, { LOPT_RR, ARG_DUP, ",,[]", gettext_noop("Specify arbitrary DNS resource record"), NULL }, diff --git a/src/radv.c b/src/radv.c index 9fbede4..32dc60d 100644 --- a/src/radv.c +++ b/src/radv.c @@ -652,7 +652,7 @@ static int iface_search(struct in6_addr *local, int prefix, static void new_timeout(struct dhcp_context *context, time_t now) { - if (difftime(now, context->ra_short_period_start) < 60.0) + if (difftime(now, context->ra_short_period_start) < 60.0 || option_bool(OPT_FAST_RA)) /* range 5 - 20 */ context->ra_time = now + 5 + (rand16()/4400); else