Use AF_UNSPEC etc. instead of PF_UNSPEC to comply with POSIX.

Closes #863.

Thanks to denigmus and Patrick TJ McPhee.

Signed-off-by: Roger A. Light <roger@atchoo.org>
pull/1600/head
Roger A. Light 7 years ago
parent 31c0dc4832
commit 2bb6ad41b9

@ -5,6 +5,7 @@ Broker:
- Fix plugin cleanup function not being called on exit of the broker.
Closes #900.
- Print more OpenSSL errors when loading certificates/keys fail.
- Use AF_UNSPEC etc. instead of PF_UNSPEC to comply with POSIX. Closes #863.
1.5 - 20180502

@ -248,9 +248,9 @@ int net__try_connect_step2(struct mosquitto *mosq, uint16_t port, mosq_sock_t *s
*sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if(*sock == INVALID_SOCKET) continue;
if(rp->ai_family == PF_INET){
if(rp->ai_family == AF_INET){
((struct sockaddr_in *)rp->ai_addr)->sin_port = htons(port);
}else if(rp->ai_family == PF_INET6){
}else if(rp->ai_family == AF_INET6){
((struct sockaddr_in6 *)rp->ai_addr)->sin6_port = htons(port);
}else{
COMPAT_CLOSE(*sock);
@ -310,7 +310,7 @@ int net__try_connect(struct mosquitto *mosq, const char *host, uint16_t port, mo
*sock = INVALID_SOCKET;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = PF_UNSPEC;
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
@ -333,9 +333,9 @@ int net__try_connect(struct mosquitto *mosq, const char *host, uint16_t port, mo
*sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if(*sock == INVALID_SOCKET) continue;
if(rp->ai_family == PF_INET){
if(rp->ai_family == AF_INET){
((struct sockaddr_in *)rp->ai_addr)->sin_port = htons(port);
}else if(rp->ai_family == PF_INET6){
}else if(rp->ai_family == AF_INET6){
((struct sockaddr_in6 *)rp->ai_addr)->sin6_port = htons(port);
}else{
COMPAT_CLOSE(*sock);

@ -114,7 +114,7 @@ static int conf__attempt_resolve(const char *host, const char *text, int log, co
int rc;
memset(&gai_hints, 0, sizeof(struct addrinfo));
gai_hints.ai_family = PF_UNSPEC;
gai_hints.ai_family = AF_UNSPEC;
gai_hints.ai_flags = AI_ADDRCONFIG;
gai_hints.ai_socktype = SOCK_STREAM;
gai_res = NULL;

@ -353,7 +353,7 @@ int net__socket_listen(struct mosquitto__listener *listener)
snprintf(service, 10, "%d", listener->port);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = PF_UNSPEC;
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;

Loading…
Cancel
Save