When spf_record_process_addr creates a new address node for subsequent
DNS replies (MX A/AAAA resolution), it copies the original addr via
memcpy, inheriting all flags including the address family flag from the
first reply. The new reply's flag was OR'd in without clearing the
inherited one, resulting in nodes with both IPV4 and IPV6 flags set.
Since spf_addr_mask_to_string checks IPV4 before IPV6, such nodes would
always display as IPv4, causing duplicate IPv4 addresses in output
instead of the correct IPv4 + IPv6 pair.
Issue: #5951
&reply->content.aaa.addr,
sizeof(addr->addr6));
naddr->flags |= RSPAMD_SPF_FLAG_IPV6;
+ naddr->flags &= ~RSPAMD_SPF_FLAG_IPV4;
}
else if (reply->type == RDNS_REQUEST_A) {
memcpy(naddr->addr4, &reply->content.a.addr, sizeof(addr->addr4));
naddr->flags |= RSPAMD_SPF_FLAG_IPV4;
+ naddr->flags &= ~RSPAMD_SPF_FLAG_IPV6;
}
else {
msg_err_spf(