format code sytle
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "dns_cache.h"
|
||||
#include "tlog.h"
|
||||
#include "stringutil.h"
|
||||
#include "tlog.h"
|
||||
#include <pthread.h>
|
||||
|
||||
struct dns_cache_head {
|
||||
@@ -120,7 +120,7 @@ int dns_cache_replace(char *domain, char *cname, int cname_ttl, int ttl, dns_typ
|
||||
return 0;
|
||||
errout_unlock:
|
||||
pthread_mutex_unlock(&dns_cache_head.lock);
|
||||
//errout:
|
||||
// errout:
|
||||
if (dns_cache) {
|
||||
dns_cache_release(dns_cache);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ struct dns_cache {
|
||||
char domain[DNS_MAX_CNAME_LEN];
|
||||
char cname[DNS_MAX_CNAME_LEN];
|
||||
unsigned int cname_ttl;
|
||||
unsigned int ttl;;
|
||||
unsigned int ttl;
|
||||
int speed;
|
||||
atomic_t hitnum;
|
||||
int del_pending;
|
||||
|
||||
@@ -943,7 +943,8 @@ errout:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int _dns_client_add_server_pending(char *server_ip, char *server_host, int port, dns_server_type_t server_type, struct client_dns_server_flags *flags, int ispending)
|
||||
static int _dns_client_add_server_pending(char *server_ip, char *server_host, int port, dns_server_type_t server_type, struct client_dns_server_flags *flags,
|
||||
int ispending)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "tlog.h"
|
||||
#include "util.h"
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#define DEFAULT_DNS_CACHE_SIZE 512
|
||||
|
||||
@@ -39,7 +39,7 @@ int dns_conf_server_num;
|
||||
struct dns_domain_check_order dns_conf_check_order = {
|
||||
.order = {DOMAIN_CHECK_ICMP, DOMAIN_CHECK_TCP},
|
||||
.tcp_port = 80,
|
||||
};
|
||||
};
|
||||
|
||||
/* logging */
|
||||
int dns_conf_log_level = TLOG_ERROR;
|
||||
@@ -1169,7 +1169,7 @@ static int _config_log_level(void *data, int argc, char *argv[])
|
||||
dns_conf_log_level = TLOG_ERROR;
|
||||
} else if (strncmp("fatal", value, MAX_LINE_LEN) == 0) {
|
||||
dns_conf_log_level = TLOG_FATAL;
|
||||
}else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,8 +161,7 @@ struct dns_conf_address_rule {
|
||||
radix_tree_t *ipv6;
|
||||
};
|
||||
|
||||
struct dns_bind_ip
|
||||
{
|
||||
struct dns_bind_ip {
|
||||
DNS_BIND_TYPE type;
|
||||
uint32_t flags;
|
||||
char ip[DNS_MAX_IPLEN];
|
||||
|
||||
@@ -1205,7 +1205,6 @@ static int _dns_server_process_answer_A(struct dns_rrs *rrs, struct dns_request
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int _dns_server_process_answer_AAAA(struct dns_rrs *rrs, struct dns_request *request, char *domain, unsigned int result_flag, int ping_timeout)
|
||||
{
|
||||
unsigned char addr[16];
|
||||
@@ -1221,8 +1220,8 @@ static int _dns_server_process_answer_AAAA(struct dns_rrs *rrs, struct dns_reque
|
||||
_dns_server_request_get(request);
|
||||
dns_get_AAAA(rrs, name, DNS_MAX_CNAME_LEN, &ttl, addr);
|
||||
|
||||
tlog(TLOG_DEBUG, "domain: %s TTL: %d IP: %.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x", name, ttl, addr[0], addr[1],
|
||||
addr[2], addr[3], addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], addr[10], addr[11], addr[12], addr[13], addr[14], addr[15]);
|
||||
tlog(TLOG_DEBUG, "domain: %s TTL: %d IP: %.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x", name, ttl, addr[0], addr[1], addr[2],
|
||||
addr[3], addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], addr[10], addr[11], addr[12], addr[13], addr[14], addr[15]);
|
||||
|
||||
ip_check_result = _dns_server_ip_rule_check(request, addr, 16, DNS_T_AAAA, result_flag);
|
||||
if (ip_check_result == 0) {
|
||||
@@ -1266,8 +1265,8 @@ static int _dns_server_process_answer_AAAA(struct dns_rrs *rrs, struct dns_reque
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(ip, "%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
|
||||
addr[6], addr[7], addr[8], addr[9], addr[10], addr[11], addr[12], addr[13], addr[14], addr[15]);
|
||||
sprintf(ip, "%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x:%.2x%.2x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], addr[6],
|
||||
addr[7], addr[8], addr[9], addr[10], addr[11], addr[12], addr[13], addr[14], addr[15]);
|
||||
|
||||
/* start ping */
|
||||
if (_dns_server_check_speed(request, ip, 0, ping_timeout) != 0) {
|
||||
@@ -2695,7 +2694,8 @@ int dns_server_start(void)
|
||||
{
|
||||
struct dns_server_conn_head *conn = NULL;
|
||||
|
||||
list_for_each_entry(conn, &server.conn_list, list) {
|
||||
list_for_each_entry(conn, &server.conn_list, list)
|
||||
{
|
||||
if (conn->fd <= 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -2823,7 +2823,6 @@ errout:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int _dns_server_socket_tcp(struct dns_bind_ip *bind_ip)
|
||||
{
|
||||
const char *host_ip;
|
||||
|
||||
@@ -79,8 +79,7 @@ static void _show_version(void)
|
||||
#else
|
||||
struct tm tm;
|
||||
get_compiled_time(&tm);
|
||||
snprintf(str_ver, sizeof(str_ver), "1.%.4d%.2d%.2d-%.2d%.2d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
|
||||
tm.tm_min);
|
||||
snprintf(str_ver, sizeof(str_ver), "1.%.4d%.2d%.2d-%.2d%.2d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min);
|
||||
#endif
|
||||
printf("smartdns %s\n", str_ver);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user