MCPcopy Create free account
hub / github.com/apache/httpd / find_ipaddr

Function find_ipaddr

server/vhost.c:398–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396
397
398static 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
425static ipaddr_chain *find_default_server(apr_port_t port)
426{

Callers 2

ap_fini_vhost_configFunction · 0.85
ap_update_vhost_given_ipFunction · 0.85

Calls 1

hash_addrFunction · 0.85

Tested by

no test coverage detected