mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-10-25 12:14:38 +00:00
Add --no-round-robin option.
This commit is contained in:
5 files changed
+22
-4
No files matched your search
@@ -32,7 +32,9 @@ version 2.88
|
|||||||
to an easily reproducible case which saved mucg labour in
|
to an easily reproducible case which saved mucg labour in
|
||||||
finding it.
|
finding it.
|
||||||
|
|
||||||
|
Add --no-round-robin option.
|
||||||
|
|
||||||
|
|
||||||
version 2.87
|
version 2.87
|
||||||
Allow arbitrary prefix lengths in --rev-server and
|
Allow arbitrary prefix lengths in --rev-server and
|
||||||
--domain=....,local
|
--domain=....,local
|
||||||
|
|||||||
@@ -816,6 +816,12 @@ Disable negative caching. Negative caching allows dnsmasq to remember
|
|||||||
"no such domain" answers from upstream nameservers and answer
|
"no such domain" answers from upstream nameservers and answer
|
||||||
identical queries without forwarding them again.
|
identical queries without forwarding them again.
|
||||||
.TP
|
.TP
|
||||||
|
.B --no-round-robin
|
||||||
|
Dnsmasq normally permutes the order of A or AAAA records for the same
|
||||||
|
name on successive queries, for load-balancing. This turns off that
|
||||||
|
behaviour, so that the records are always returned in the order
|
||||||
|
that they are received from upstream.
|
||||||
|
.TP
|
||||||
.B --use-stale-cache
|
.B --use-stale-cache
|
||||||
When set, if a DNS name exists in the cache, but its time-to-live has expired, dnsmasq will return the data anyway. (It attempts to refresh the
|
When set, if a DNS name exists in the cache, but its time-to-live has expired, dnsmasq will return the data anyway. (It attempts to refresh the
|
||||||
data with an upstream query after returning the stale data.) This can improve speed and reliability. It comes at the expense
|
data with an upstream query after returning the stale data.) This can improve speed and reliability. It comes at the expense
|
||||||
|
|||||||
+9
-3
@@ -233,7 +233,8 @@ static void cache_hash(struct crec *crecp)
|
|||||||
immortal entries are at the end of the hash-chain.
|
immortal entries are at the end of the hash-chain.
|
||||||
This allows reverse searches and garbage collection to be optimised */
|
This allows reverse searches and garbage collection to be optimised */
|
||||||
|
|
||||||
struct crec **up = hash_bucket(cache_get_name(crecp));
|
char *name = cache_get_name(crecp);
|
||||||
|
struct crec **up = hash_bucket(name);
|
||||||
|
|
||||||
if (!(crecp->flags & F_REVERSE))
|
if (!(crecp->flags & F_REVERSE))
|
||||||
{
|
{
|
||||||
@@ -244,6 +245,11 @@ static void cache_hash(struct crec *crecp)
|
|||||||
while (*up && !((*up)->flags & F_IMMORTAL))
|
while (*up && !((*up)->flags & F_IMMORTAL))
|
||||||
up = &((*up)->hash_next);
|
up = &((*up)->hash_next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Preserve order when inserting the same name multiple times. */
|
||||||
|
while (*up && hostname_isequal(cache_get_name(*up), name))
|
||||||
|
up = &((*up)->hash_next);
|
||||||
|
|
||||||
crecp->hash_next = *up;
|
crecp->hash_next = *up;
|
||||||
*up = crecp;
|
*up = crecp;
|
||||||
}
|
}
|
||||||
@@ -722,7 +728,7 @@ static struct crec *really_insert(char *name, union all_addr *addr, unsigned sho
|
|||||||
new->ttd = now + (time_t)ttl;
|
new->ttd = now + (time_t)ttl;
|
||||||
new->next = new_chain;
|
new->next = new_chain;
|
||||||
new_chain = new;
|
new_chain = new;
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +906,7 @@ int cache_find_non_terminal(char *name, time_t now)
|
|||||||
struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsigned int prot)
|
struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsigned int prot)
|
||||||
{
|
{
|
||||||
struct crec *ans;
|
struct crec *ans;
|
||||||
int no_rr = prot & F_NO_RR;
|
int no_rr = (prot & F_NO_RR) || option_bool(OPT_NORR);
|
||||||
|
|
||||||
prot &= ~F_NO_RR;
|
prot &= ~F_NO_RR;
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -280,7 +280,8 @@ struct event_desc {
|
|||||||
#define OPT_STRIP_ECS 69
|
#define OPT_STRIP_ECS 69
|
||||||
#define OPT_STRIP_MAC 70
|
#define OPT_STRIP_MAC 70
|
||||||
#define OPT_STALE_CACHE 71
|
#define OPT_STALE_CACHE 71
|
||||||
#define OPT_LAST 72
|
#define OPT_NORR 72
|
||||||
|
#define OPT_LAST 73
|
||||||
|
|
||||||
#define OPTION_BITS (sizeof(unsigned int)*8)
|
#define OPTION_BITS (sizeof(unsigned int)*8)
|
||||||
#define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
|
#define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ struct myoption {
|
|||||||
#define LOPT_RANDPORT_LIM 375
|
#define LOPT_RANDPORT_LIM 375
|
||||||
#define LOPT_FAST_RETRY 376
|
#define LOPT_FAST_RETRY 376
|
||||||
#define LOPT_STALE_CACHE 377
|
#define LOPT_STALE_CACHE 377
|
||||||
|
#define LOPT_NORR 378
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
static const struct option opts[] =
|
static const struct option opts[] =
|
||||||
@@ -236,6 +237,7 @@ static const struct myoption opts[] =
|
|||||||
{ "localmx", 0, 0, 'L' },
|
{ "localmx", 0, 0, 'L' },
|
||||||
{ "local-ttl", 1, 0, 'T' },
|
{ "local-ttl", 1, 0, 'T' },
|
||||||
{ "no-negcache", 0, 0, 'N' },
|
{ "no-negcache", 0, 0, 'N' },
|
||||||
|
{ "no-round-robin", 0, 0, LOPT_NORR },
|
||||||
{ "addn-hosts", 1, 0, 'H' },
|
{ "addn-hosts", 1, 0, 'H' },
|
||||||
{ "hostsdir", 1, 0, LOPT_HOST_INOTIFY },
|
{ "hostsdir", 1, 0, LOPT_HOST_INOTIFY },
|
||||||
{ "query-port", 1, 0, 'Q' },
|
{ "query-port", 1, 0, 'Q' },
|
||||||
@@ -567,6 +569,7 @@ static struct {
|
|||||||
{ LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL },
|
{ LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL },
|
||||||
{ LOPT_UMBRELLA, ARG_ONE, "[=<optspec>]", gettext_noop("Send Cisco Umbrella identifiers including remote IP."), NULL },
|
{ LOPT_UMBRELLA, ARG_ONE, "[=<optspec>]", gettext_noop("Send Cisco Umbrella identifiers including remote IP."), NULL },
|
||||||
{ LOPT_QUIET_TFTP, OPT_QUIET_TFTP, NULL, gettext_noop("Do not log routine TFTP."), NULL },
|
{ LOPT_QUIET_TFTP, OPT_QUIET_TFTP, NULL, gettext_noop("Do not log routine TFTP."), NULL },
|
||||||
|
{ LOPT_NORR, OPT_NORR, NULL, gettext_noop("Suppress round-robin ordering of DNS records."), NULL },
|
||||||
{ 0, 0, NULL, NULL, NULL }
|
{ 0, 0, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user