#7475 SRV lookup doesn't correctly sort results
Closed: fixed 5 years ago Opened 6 years ago by cheimes.

On multiple occasions, IPA code doesn't correctly sort SRV records.

ipadns_search_srv

The entries are sorted by priority. However that is not sufficient. RFC requires that a client randomly distributes load between servers with same priority. This can be easily archived by using (answer.priority, random.random()) as sort key. In theory we also have to obey the weight, but in practice IPA doesn't use weight.

The code should also remove duplicated names from the result.

get_url_list

https://pagure.io/freeipa/blob/master/f/ipalib/rpc.py#_889

The SRV records are not sorted at all. The set() operation even discards the sort order from the resolver.

other

There are more places that need additional attention.

IPA's SRV code has made some questionable decisions, too. For example it assumes that _ldap._tcp maps to port 389.


Yes, bug #5500 describes the same issue as get_url_list paragraph of this bug. The description isn't correct. The order isn't randomized. It's a fixed order that is influenced by hash randomization value in each server process. It's only enabled in Python 3 and only changes when the WSGI process is restarted.

(I'd rather close #5500 and keep this bug.)

Metadata Update from @fbarreto:
- Issue priority set to: low
- Issue set to the milestone: Future Releases
- Issue tagged with: easyfix

6 years ago

Metadata Update from @cheimes:
- Issue assigned to cheimes

5 years ago

Metadata Update from @cheimes:
- Issue untagged with: easyfix
- Issue priority set to: important (was: low)
- Issue set to the milestone: FreeIPA 4.5.5 (was: Future Releases)

5 years ago

Metadata Update from @cheimes:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/2032

5 years ago

master:

  • f90e137 Sort and shuffle SRV record by priority and weight

ipa-4-6:

  • 5a83e31 Sort and shuffle SRV record by priority and weight

ipa-4-5:

  • 76fb775 Sort and shuffle SRV record by priority and weight

Metadata Update from @tdudlak:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

5 years ago

Metadata Update from @pvoborni:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1594142

5 years ago

Login to comment on this ticket.

Metadata