libbind: integrate "netresolv" patches from NetBSD.

libbind development was transferred to the NetBSD project at
http://wiki.netbsd.org/individual-software-releases/netresolv/

There isn't an official release yet, but they provide a set of patches
against the latest libbind release.

* Remove all files we don't use
* Merge the changes to the remaining files
* Add some new files we need
* Move getifaddrs implementation to libnetwork (instead of libbnetapi)
so it can be used by netresolv.

Fixes #8293 : netresolv uses getifaddrs to determine if there is a local
IPv6 address. If there is not, it will not return AAAA records.
This commit is contained in:
Adrien Destugues
2015-06-14 15:47:03 +02:00
parent 7c3d316b5d
commit 8d2aee6bc8
147 changed files with 29727 additions and 26889 deletions
+4 -4
View File
@@ -22,15 +22,15 @@ char* inet_cidr_ntop(int family, const void* source, int bits,
char* dest, size_t destSize);
int inet_cidr_pton(int family, const char* sourceString, void* dest,
int* _bits);
u_long inet_lnaof(struct in_addr address);
struct in_addr inet_makeaddr(u_long net, u_long host);
in_addr_t inet_lnaof(struct in_addr address);
struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host);
char* inet_net_ntop(int family, const void* source, int bits,
char* dest, size_t destSize);
int inet_net_pton(int family, const char* sourceString, void* dest,
size_t destSize);
char* inet_neta(u_long source, char* dest, size_t destSize);
u_long inet_netof(struct in_addr address);
u_long inet_network(const char* addressString);
in_addr_t inet_netof(struct in_addr address);
in_addr_t inet_network(const char* addressString);
char* inet_ntoa(struct in_addr address);
const char* inet_ntop(int family, const void* source, char* dest,
socklen_t destSize);
+4 -4
View File
@@ -586,10 +586,10 @@ extern "C" {
#endif
int ns_msg_getflag(ns_msg, int);
u_int ns_get16(const u_char *);
u_long ns_get32(const u_char *);
void ns_put16(u_int, u_char *);
void ns_put32(u_long, u_char *);
uint16_t ns_get16(const u_char *);
uint32_t ns_get32(const u_char *);
void ns_put16(uint16_t, u_char *);
void ns_put32(uint32_t, u_char *);
int ns_initparse(const u_char *, int, ns_msg *);
int ns_skiprr(const u_char *, const u_char *, ns_sect, int);
int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+17 -13
View File
@@ -95,6 +95,7 @@
#include <netinet/in.h>
#include <stdio.h>
#include <pthread.h>
#ifndef _PATH_NETWORKS
#define _PATH_NETWORKS "/etc/networks"
@@ -128,7 +129,7 @@ struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
unsigned long n_net; /* network # */
in_addr_t n_net; /* network # */
};
struct servent {
@@ -238,13 +239,13 @@ void endnetent(void);
void endprotoent(void);
void endservent(void);
void freehostent(struct hostent *host);
struct hostent *gethostbyaddr(const char *address, int length, int type);
struct hostent *gethostbyaddr(const char *address, socklen_t length, int type);
struct hostent *gethostbyname(const char *name);
struct hostent *gethostbyname2(const char *name, int type);
struct hostent *gethostent(void);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
struct netent *getnetbyaddr(unsigned long, int);
struct netent *getnetbyaddr(uint32_t, int);
struct netent *getnetbyname(const char *);
struct netent *getnetent(void);
struct protoent *getprotobyname(const char *);
@@ -264,6 +265,7 @@ int getaddrinfo(const char *, const char *,
const struct addrinfo *, struct addrinfo **);
int getnameinfo(const struct sockaddr *, socklen_t, char *,
socklen_t, char *, socklen_t, int);
struct addrinfo *allocaddrinfo(socklen_t);
void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
@@ -283,21 +285,23 @@ struct netent *getnetent_r(struct netent *, char *, int);
void setnetent_r(int);
void endnetent_r(void);
struct protoent_data;
struct protoent *getprotobyname_r(const char *,
struct protoent *, char *, int);
struct protoent *, struct protoent_data *);
struct protoent *getprotobynumber_r(int,
struct protoent *, char *, int);
struct protoent *getprotoent_r(struct protoent *, char *, int);
void setprotoent_r(int);
void endprotoent_r(void);
struct protoent *, struct protoent_data *);
struct protoent *getprotoent_r(struct protoent *, struct protoent_data *);
void setprotoent_r(int, struct protoent_data *);
void endprotoent_r(struct protoent_data *);
struct servent_data;
struct servent *getservbyname_r(const char *name, const char *,
struct servent *, char *, int);
struct servent *, struct servent_data *);
struct servent *getservbyport_r(int port, const char *,
struct servent *, char *, int);
struct servent *getservent_r(struct servent *, char *, int);
void setservent_r(int);
void endservent_r(void);
struct servent *, struct servent_data *);
struct servent *getservent_r(struct servent *, struct servent_data *);
void setservent_r(int, struct servent_data *);
void endservent_r(struct servent_data *);
__END_DECLS
#endif /* _NETDB_H_ */
+9
View File
@@ -31,6 +31,15 @@ struct sockaddr_in6 {
#define IN6ADDR_LOOPBACK_INIT {{ \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
#define IN6ADDR_NODELOCAL_ALLNODES_INIT {{ \
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT {{ \
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT {{ \
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
+9 -2
View File
@@ -272,9 +272,16 @@ union res_sockaddr_union {
/* Things involving an internal (static) resolver context. */
__BEGIN_DECLS
extern struct __res_state *__res_get_state(void);
extern void __res_put_state(struct __res_state *);
/*
* Source and Binary compatibility; _res will not work properly
* with multi-threaded programs.
*/
extern struct __res_state *__res_state(void);
__END_DECLS
#define _res (*__res_state())
__END_DECLS
#ifndef __BIND_NOSTATIC
#define fp_nquery __fp_nquery
@@ -409,7 +416,7 @@ const char * loc_ntoa(const u_char *, char *);
int dn_skipname(const u_char *, const u_char *);
void putlong(u_int32_t, u_char *);
void putshort(u_int16_t, u_char *);
#if !defined(__ultrix__) && !defined(__HAIKU__)
#if !defined(__ultrix__)
u_int16_t _getshort(const u_char *);
u_int32_t _getlong(const u_char *);
#endif