Skip to content
Snippets Groups Projects
Commit 4f84142c authored by Joshua Colp's avatar Joshua Colp Committed by Gerrit Code Review
Browse files

Merge "dns_srv: Fix SRV sorting when records with priority zero exist with non-zero."

parents 4da29345 f82bd76e
Branches
Tags
No related merge requests found
...@@ -112,13 +112,15 @@ void dns_srv_sort(struct ast_dns_result *result) ...@@ -112,13 +112,15 @@ void dns_srv_sort(struct ast_dns_result *result)
struct dns_records newlist = AST_LIST_HEAD_NOLOCK_INIT_VALUE; struct dns_records newlist = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
while (AST_LIST_FIRST(&result->records)) { while (AST_LIST_FIRST(&result->records)) {
unsigned short cur_priority = 0; unsigned short cur_priority = ((struct ast_dns_srv_record *)(AST_LIST_FIRST(&result->records)))->priority;
struct dns_records temp_list = AST_LIST_HEAD_NOLOCK_INIT_VALUE; struct dns_records temp_list = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
/* Find the lowest current priority to work on */ /* Find the lowest current priority to work on, but if the priority is already zero there is no lower priority */
AST_LIST_TRAVERSE(&result->records, current, list) { if (cur_priority) {
if (!cur_priority || ((struct ast_dns_srv_record *)current)->priority < cur_priority) { AST_LIST_TRAVERSE(&result->records, current, list) {
cur_priority = ((struct ast_dns_srv_record *)current)->priority; if (((struct ast_dns_srv_record *)current)->priority < cur_priority) {
cur_priority = ((struct ast_dns_srv_record *)current)->priority;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment