| 396 | |
| 397 | |
| 398 | static APR_INLINE ipaddr_chain *find_ipaddr(apr_sockaddr_t *sa) |
| 399 | { |
| 400 | unsigned bucket; |
| 401 | ipaddr_chain *trav = NULL; |
| 402 | ipaddr_chain *wild_match = NULL; |
| 403 | |
| 404 | /* scan the hash table for an exact match first */ |
| 405 | bucket = hash_addr(sa); |
| 406 | for (trav = iphash_table[bucket]; trav; trav = trav->next) { |
| 407 | server_addr_rec *sar = trav->sar; |
| 408 | apr_sockaddr_t *cur = sar->host_addr; |
| 409 | |
| 410 | if (cur->port == sa->port) { |
| 411 | if (apr_sockaddr_equal(cur, sa)) { |
| 412 | return trav; |
| 413 | } |
| 414 | } |
| 415 | if (wild_match == NULL && (cur->port == 0 || sa->port == 0)) { |
| 416 | if (apr_sockaddr_equal(cur, sa)) { |
| 417 | /* don't break, continue looking for an exact match */ |
| 418 | wild_match = trav; |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | return wild_match; |
| 423 | } |
| 424 | |
| 425 | static ipaddr_chain *find_default_server(apr_port_t port) |
| 426 | { |
no test coverage detected