Update ReadMe.md add server SNI support

This commit is contained in:
Nick Peng
2019-04-25 00:04:29 +08:00
parent 01f94b4816
commit 04fbb51a7b
4 changed files with 6 additions and 32 deletions

View File

@@ -226,7 +226,7 @@ static struct addrinfo *_dns_client_getaddr(const char *host, char *port, int ty
ret = getaddrinfo(host, port, &hints, &result);
if (ret != 0) {
tlog(TLOG_ERROR, "get addr info failed. %s\n", gai_strerror(errno));
tlog(TLOG_ERROR, "get addr info failed. %s\n", gai_strerror(ret));
tlog(TLOG_ERROR, "host = %s, port = %s, type = %d, protocol = %d", host, port, type, protocol);
goto errout;
}
@@ -1453,14 +1453,6 @@ static int _dns_client_process_udp(struct dns_server_info *server_info, struct e
tlog(TLOG_DEBUG, "recv udp packet from %s, len: %d, ttl: %d", gethost_by_addr(from_host, sizeof(from_host), (struct sockaddr *)&from), len, ttl);
if ((ttl != server_info->ttl) && (server_info->ttl > 0) && (server_info->flags.result_flag & DNSSERVER_FLAG_CHECK_TTL)) {
/* If TTL check is enabled but the TTL is inconsistent, it is considered to be a fake dns packet */
if ((ttl < server_info->ttl - server_info->ttl_range) || (ttl > server_info->ttl + server_info->ttl_range)) {
/* tlog(TLOG_DEBUG, "TTL mismatch, from:%d, local %d, discard result", ttl, server_info->ttl); */
return 0;
}
}
/* update recv time */
time(&server_info->last_recv);

View File

@@ -170,7 +170,6 @@ static int _config_server(int argc, char *argv[], dns_server_type_t type, int de
{"blacklist-ip", no_argument, NULL, 'b'}, /* filtering with blacklist-ip */
{"check-edns", no_argument, NULL, 'e'}, /* check edns */
{"spki-pin", required_argument, NULL, 'p'}, /* check SPKI pin */
{"check-ttl", required_argument, NULL, 't'}, /* check ttl */
{"host-name", required_argument, NULL, 'h'}, /* host name */
{"http-host", required_argument, NULL, 'H'}, /* http host */
{"group", required_argument, NULL, 'g'}, /* add to group */
@@ -234,23 +233,6 @@ static int _config_server(int argc, char *argv[], dns_server_type_t type, int de
result_flag |= DNSSERVER_FLAG_CHECK_EDNS;
break;
}
case 't': {
if (DNS_SERVER_UDP != type) {
break;
}
ttl = atoi(optarg);
/* Greater than 0, exact match
Equal to 0, match after check
Less than 0, match in the -N range after inspection
*/
if (ttl < -255 || ttl > 255) {
tlog(TLOG_ERROR, "ttl value is invalid.");
goto errout;
}
result_flag |= DNSSERVER_FLAG_CHECK_TTL;
break;
}
case 'h': {
strncpy(server->hostname, optarg, DNS_MAX_CNAME_LEN);
break;