diff options
Diffstat (limited to 'libc/private')
-rw-r--r-- | libc/private/resolv_cache.h | 10 | ||||
-rw-r--r-- | libc/private/resolv_iface.h | 26 | ||||
-rw-r--r-- | libc/private/resolv_private.h | 2 |
3 files changed, 33 insertions, 5 deletions
diff --git a/libc/private/resolv_cache.h b/libc/private/resolv_cache.h index d70857d..68a1180 100644 --- a/libc/private/resolv_cache.h +++ b/libc/private/resolv_cache.h @@ -28,6 +28,7 @@ #ifndef _RESOLV_CACHE_H_ #define _RESOLV_CACHE_H_ +#include <stddef.h> #include <sys/cdefs.h> struct __res_state; @@ -77,16 +78,17 @@ extern struct in_addr* _resolv_get_addr_of_default_iface(); __LIBC_HIDDEN__ extern struct in_addr* _resolv_get_addr_of_iface(const char* ifname); -/* Copy the name of the default interface to provided buffer. - * Return length of buffer on success on failure -1 is returned */ +/* Copy the name of the default interface to the provided buffer. + * Returns the string length of the default interface, + * be that less or more than the buffLen, or 0 if nothing had been written */ __LIBC_HIDDEN__ -extern int _resolv_get_default_iface(char* buff, int buffLen); + extern size_t _resolv_get_default_iface(char* buff, size_t buffLen); /* sets the name server addresses to the provided res_state structure. The * name servers are retrieved from the cache which is associated * with the interface to which the res_state structure is associated */ __LIBC_HIDDEN__ -extern int _resolv_populate_res_for_iface(struct __res_state* statp); +extern void _resolv_populate_res_for_iface(struct __res_state* statp); typedef enum { RESOLV_CACHE_UNSUPPORTED, /* the cache can't handle that kind of queries */ diff --git a/libc/private/resolv_iface.h b/libc/private/resolv_iface.h index bf5abad..ad42793 100644 --- a/libc/private/resolv_iface.h +++ b/libc/private/resolv_iface.h @@ -48,7 +48,7 @@ __BEGIN_DECLS extern void _resolv_set_default_iface(const char* ifname); /* 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, const char** servers, int numservers, const char *domains); /* tell resolver of the address of an interface */ @@ -66,6 +66,9 @@ extern void _resolv_set_iface_for_pid(const char* ifname, int pid); /* clear pid from being associated with an interface */ extern void _resolv_clear_iface_for_pid(int pid); +/* clear the entire mapping of pids to interfaces. */ +extern void _resolv_clear_iface_pid_mapping(); + /** Gets the name of the interface to which the pid is attached. * On error, -1 is returned. * If no interface is found, 0 is returned and buff is set to empty ('\0'). @@ -75,6 +78,27 @@ extern void _resolv_clear_iface_for_pid(int pid); * buffLen Length of buff. An interface is at most IF_NAMESIZE in length */ extern int _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen); + +/** set a uid range to use the name servers of the specified interface + * If [low,high] overlaps with an already existing rule -1 is returned */ +extern int _resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end); + +/* clear a uid range from being associated with an interface + * If the range given is not mapped -1 is returned. */ +extern int _resolv_clear_iface_for_uid_range(int uid_start, int uid_end); + +/* clear the entire mapping of uid ranges to interfaces. */ +extern void _resolv_clear_iface_uid_range_mapping(); + +/** Gets the name of the interface to which the uid is attached. + * On error, -1 is returned. + * If no interface is found, 0 is returned and buff is set to empty ('\0'). + * If an interface is found, the name is copied to buff and the length of the name is returned. + * Arguments: uid The uid to find an interface for + * buff A buffer to copy the result to + * buffLen Length of buff. An interface is at most IF_NAMESIZE in length */ +extern int _resolv_get_uids_associated_interface(int uid, char* buff, int buffLen); + #endif /* _BIONIC_RESOLV_IFACE_FUNCTIONS_DECLARED */ __END_DECLS diff --git a/libc/private/resolv_private.h b/libc/private/resolv_private.h index 9648a8f..c7bcb89 100644 --- a/libc/private/resolv_private.h +++ b/libc/private/resolv_private.h @@ -175,6 +175,7 @@ struct __res_state { res_send_qhook qhook; /* query hook */ res_send_rhook rhook; /* response hook */ int res_h_errno; /* last one set for this context */ + int _mark; /* If non-0 SET_MARK to _mark on all request sockets */ int _vcsock; /* PRIVATE: for res_send VC i/o */ u_int _flags; /* PRIVATE: see below */ u_int _pad; /* make _u 64 bit aligned */ @@ -490,6 +491,7 @@ int res_getservers(res_state, union res_sockaddr_union *, int); void res_setiface(); +void res_setmark(); u_int res_randomid(void); __END_DECLS |