]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix rspamd nameserver round-robin when using /etc/resolv.conf 5721/head
authorCursor Agent <cursoragent@cursor.com>
Sat, 1 Nov 2025 12:56:18 +0000 (12:56 +0000)
committerCursor Agent <cursoragent@cursor.com>
Sat, 1 Nov 2025 12:56:18 +0000 (12:56 +0000)
When nameservers are parsed from /etc/resolv.conf, rspamd was setting
the upstream rotation strategy to RSPAMD_UPSTREAM_MASTER_SLAVE, which
caused it to only use the first nameserver unless it failed.

This behavior was inconsistent with the documented round-robin strategy
and with the behavior when nameservers are explicitly configured via
the configuration file.

Fixed by changing the rotation strategy to RSPAMD_UPSTREAM_ROUND_ROBIN
when parsing /etc/resolv.conf, matching the expected behavior.

Fixes RSP-284

src/libserver/dns.c

index b21ae9c8d6b5e3cae62455d51cf7a475023a8bb8..f448b2a32028f34cd5ca891fb51bfd432ceef634 100644 (file)
@@ -910,7 +910,7 @@ rspamd_dns_resolver_init(rspamd_logger_t *logger,
                        rspamd_upstreams_set_flags(dns_resolver->ups,
                                                                           RSPAMD_UPSTREAM_FLAG_DNS);
                        rspamd_upstreams_set_rotation(dns_resolver->ups,
-                                                                                 RSPAMD_UPSTREAM_MASTER_SLAVE);
+                                                                                 RSPAMD_UPSTREAM_ROUND_ROBIN);
 
                        if (!rdns_resolver_parse_resolv_conf_cb(dns_resolver->r,
                                                                                                        "/etc/resolv.conf",