Add TCP query
This commit is contained in:
@@ -222,7 +222,7 @@ static int _dns_reply(struct dns_request *request)
|
||||
head.qr = DNS_QR_ANSWER;
|
||||
head.opcode = DNS_OP_QUERY;
|
||||
head.rd = 1;
|
||||
head.ra = 0;
|
||||
head.ra = 1;
|
||||
head.aa = 0;
|
||||
head.tc = 0;
|
||||
head.rcode = request->rcode;
|
||||
@@ -945,6 +945,7 @@ int dns_server_socket(void)
|
||||
char ip[MAX_IP_LEN];
|
||||
int port;
|
||||
char *host = NULL;
|
||||
int optval = 1;
|
||||
|
||||
if (parse_ip(dns_conf_server_ip, ip, &port) == 0) {
|
||||
host = ip;
|
||||
@@ -967,6 +968,11 @@ int dns_server_socket(void)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) != 0) {
|
||||
tlog(TLOG_ERROR, "set socket opt failed.");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
if (bind(fd, gai->ai_addr, gai->ai_addrlen) != 0) {
|
||||
tlog(TLOG_ERROR, "bind failed.\n");
|
||||
goto errout;
|
||||
|
||||
Reference in New Issue
Block a user