Merge "Add search domain to dns interface data."

This commit is contained in:
Robert Greenwalt 2012-11-16 12:21:33 -08:00 committed by Android (Google) Code Review
commit 3269d63772
2 changed files with 6 additions and 2 deletions

View File

@ -1197,6 +1197,7 @@ typedef struct resolv_cache_info {
struct resolv_cache_info* next; struct resolv_cache_info* next;
char* nameservers[MAXNS +1]; char* nameservers[MAXNS +1];
struct addrinfo* nsaddrinfo[MAXNS + 1]; struct addrinfo* nsaddrinfo[MAXNS + 1];
char* domains;
} CacheInfo; } CacheInfo;
#define HTABLE_VALID(x) ((x) != NULL && (x) != HTABLE_DELETED) #define HTABLE_VALID(x) ((x) != NULL && (x) != HTABLE_DELETED)
@ -1989,7 +1990,8 @@ _resolv_set_default_iface(const char* ifname)
} }
void void
_resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers) _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers,
const char *domains)
{ {
int i, rt, index; int i, rt, index;
struct addrinfo hints; struct addrinfo hints;
@ -2023,6 +2025,7 @@ _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numser
cache_info->nsaddrinfo[index] = NULL; cache_info->nsaddrinfo[index] = NULL;
} }
} }
cache_info->domains = strdup(domains);
} }
pthread_mutex_unlock(&_res_cache_list_lock); pthread_mutex_unlock(&_res_cache_list_lock);
} }

View File

@ -48,7 +48,8 @@ __BEGIN_DECLS
extern void _resolv_set_default_iface(const char* ifname); extern void _resolv_set_default_iface(const char* ifname);
/* set name servers for an interface */ /* set name servers for an interface */
extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers); extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers,
const char *domains);
/* tell resolver of the address of an interface */ /* tell resolver of the address of an interface */
extern void _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr); extern void _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr);