dns_client: use RAND_bytes instead getrandom for compatibility
This commit is contained in:
@@ -42,12 +42,12 @@
|
||||
#include <netinet/tcp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -3524,7 +3524,7 @@ int dns_client_query(const char *domain, int qtype, dns_client_callback callback
|
||||
query->qtype = qtype;
|
||||
query->send_tick = 0;
|
||||
query->has_result = 0;
|
||||
if (getrandom(&query->sid, sizeof(query->sid), GRND_NONBLOCK) != sizeof(query->sid)) {
|
||||
if (RAND_bytes((unsigned char *)&query->sid, sizeof(query->sid)) != 1) {
|
||||
query->sid = random();
|
||||
}
|
||||
query->server_group = _dns_client_get_dnsserver_group(group_name);
|
||||
|
||||
@@ -387,6 +387,11 @@ static int _dns_server_is_return_soa(struct dns_request *request)
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (_dns_server_has_bind_flag(request, BIND_FLAG_NO_RULE_SOA) == 0) {
|
||||
/* when both has no rule SOA and force AAAA soa, foce AAAA soa has high priority */
|
||||
if (request->qtype == DNS_T_AAAA && _dns_server_has_bind_flag(request, BIND_FLAG_FORCE_AAAA_SOA) == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4774,7 +4779,7 @@ static int _dns_server_tcp_recv(struct dns_server_conn_tcp_client *tcpclient)
|
||||
if (errno == EAGAIN) {
|
||||
return RECV_ERROR_AGAIN;
|
||||
}
|
||||
|
||||
|
||||
if (errno == ECONNRESET) {
|
||||
return RECV_ERROR_CLOSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user