Giter Site home page Giter Site logo

dnspod-sr's Issues

配置文件路径问题

默认运行方式是:

make
cd dnspod-sr/src
./dnspod-sr

在 src/config.h 中配置文件使用相对路径 ../*.z ,如果想使用 supervisor 来管理 dnspod-sr 进程是做不到的,因为不支持 cd dnspod-sr/src && ./dnspod-sr 的方式,如果想要使用全路径来运行 dnspod-sr :/full/path/to/dnspod-sr ,怎么做才比较好呢 ?

关于解析内部私有域名的问题

在我使用dnspod-sr用作内网解析服务器的时候,发现一个问题,当我在root.z中配置好A记录,比如:
www.aaa.com. 60 IN A 192.168.1.21
api.aaa.com. 60 IN A 192.168.1.22

启动后刚开始是可以正常解析的,但是当ttl时间,60秒过期后,就会解析到公网的
正式地址去了,除了设置超长的ttl时间能否让这个解析长期保留呢?

records.z 这个文件是起什么作用的?配置了并没有起作用,谢谢。

都开源项目了,就真的没有想认真写一写注释吗?

尝试修改源代码,发现注释的数量少的可怜,举步维艰。
尽管**的程序员不喜欢写注释,可毕竟这是开源项目了还在DNSPod官方博客做了宣传,多写一点注释好吗?
我看过BIND9的注释,很好,推荐参考

CPU一定要双核以上?

运行的时候显示
set affinity fetcher failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)

低配机器有没有办法跑?

如何在unix os上编译dnspod-sr?

dnspod-sr中使用了epoll,Google得知是Linux内核引入的I/O event notification facility,所以在非Linux系统中编译会出现下面的错误:

./net.h:36:10: fatal error: 'sys/epoll.h' file not found

不知道如何解决这个问题?望不吝赐教。

谢谢

只是一个DNS转发器?

1、只能做某一终端DNS的辅控DNS,仅支持转发,无法作为应用主DNS配置
2、若主DNS是基于IP来源(地域)的DNS服务器,则终端DNS仅可以解析到当前IP请求返回的DNS记录,若作为跨地域性质的DNS会造成主DNS的IP来源选择失效
3、启动时仅绑定在127.0.0.1上,且作为一个常量定义author.h:58 #define SRV_ADDR ("127.0.0.1"),为何不作为命令行参数在启动时传入?源码中的127.0.0.1是为了自己请求自己玩?

多 IP 问题

在同一个网卡配置 2 个 IP:

# ip addr show em1
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:a1:70:38 brd ff:ff:ff:ff:ff:ff
    inet 192.168.190.129/24 brd 192.168.190.255 scope global em1
       valid_lft forever preferred_lft forever
    inet 192.168.190.130/24 brd 192.168.190.255 scope global secondary em1:0
       valid_lft forever preferred_lft forever

当使用第二个 IP 来 dig @192.168.190.130 copybash.com,dig 失败,原因是请求从第一个 IP 返回来了,dig 认为这是欺骗行为:

;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53
;; reply from unexpected source: 192.168.190.129#53, expected 192.168.190.130#53

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7 <<>> @192.168.190.130 copybash.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

基于这样的原因,keepalive + LVS 的 VIP 无法正常提供域名解析服务。一个不够友好的解决方式就是在 /etc/resolv.conf 里面写多个 dnspod-sr 的 IP 作为 nameserver,来实现高可用。

event data 存贮fd超过其size

我看你这里面构造了
struct event {
int size;
int onexit;
struct iner_event *ie;
struct event_data data[0];
};
选择一个epoll收到一个fd的时间,会设置和读取 event.event_data[fd], 这个fd会越界吗,超过size的值吗

struct event对象中柔性数组成员data的使用方式是否会造成访问未申请的内存?

  您好,我对struct event对象中柔性数组成员data的使用方式有一个疑问,能否帮忙解答下?
  在run_sentinel()函数中,dnspod调用create_event()函数创建了元素个数为size个的struct event_data类型的柔性数组data[],如下:
struct event *
create_event(int size)
{
 struct event *ev =
  malloc(sizeof(struct event) + sizeof(struct event_data) * size);
 ……
 return ev;
}
  所以该柔性数组的索引范围应该是[0, size-1],但是在后续使用该数组的时候,其使用的索引值是socket描述符,如下:
int
add_event(struct event *ev, struct event_help *help)
{
 struct epoll_event e = {0};
 int ret = 0;
 int epfd = ev->ie->epfd;
 e.data.fd = help->fd;
 if (e.data.fd < 0)
  return -1;
 if (help->type == ET_READ)
  e.events = EPOLLIN; // | EPOLLET;
 if (help->type == ET_WRITE)
  e.events = EPOLLOUT; // | EPOLLET;

 /*
 * 这个地方是不是会有点问题,因为ev->data这个柔性数组的大小为size(create_event()
 * 中指定),那么索引这个柔性数组的索引范围应该是[0,size-1],但是这里却是用socket
 * fd来索引这个数组,而socket fd是有可能会大于size的。
 */
 ev->data[help->fd].cb = help->cb;
 if (help->ext != NULL)
  ev->data[help->fd].ext = help->ext;
 ret = epoll_ctl(epfd, EPOLL_CTL_ADD, help->fd, &e);
 if (ret < 0) {
  printf("fd is %d\n", help->fd);
  perror("epoll_ctl");
 }
 return ret;
}
  而socket fd大小是有可能会大于size的,这样是不是会造成访问了未申请的内存呢?

Why use pthread?

Why do you use pthread? It's poor performance in linux and not the linux culture.

请问如何配置转发DNS服务器查询为TCP方式?

首先感谢开源这个产品,在Linux下面配置转发比BIND之类的方便很多,我已经安装成功。
考虑到国内国情,如果转发支持TCP方式的话,应该是可以绕过污染问题的。
如我的:

[root@jiling dnspod-sr]# dig twitter.com @127.0.0.1

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> twitter.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37867
;; flags: qr ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;twitter.com. IN A

;; ANSWER SECTION:
twitter.com. 29492 IN A 203.98.7.65

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jun 1 14:12:04 2012
;; MSG SIZE rcvd: 45

sr.conf 无任何变动,默认的。

我看了下 hash table 中 ttl 字段相关代码,有点不清楚的地方

按我的理解,ttl 字段:

  • 如果是 MAX_TTL + 1,就永远不过期,返回时 TTL 字段为 MAX_TTL
  • 非 MAX_TTL 的,过期时间就为 ttl,返回时 TTL 字段为 ttl - global_now (当前时间)

每隔一秒请求,会减一,600, 599, 598 这样,直到下次刷新。

但我测试,你们服务器始终返回 dnspod 面板里配置的值 600 不变:

$ dig www.xd.com @ns1.dnsv5.com A
// removed
xd.com.         600 IN  NS  ns2.dnsv5.com.
// removed

难道你们线上服务器每秒都在刷新?

15W 的 QPS 是怎么测试出来的?

我测试服务器安装了 dnspod-sr,使用 queryperf 单机测试只有 2W 多,请问 15W QPS 是怎么测试出来的?求大神们解惑。

dnspod-sr 服务器信息

lscpu

Architecture:          x86_64
CPU(s):                12
Thread(s) per core:    2
Core(s) per socket:    6
厂商 ID:           GenuineIntel
型号名称:        Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz

free -g

              total        used        free      shared  buff/cache   available
Mem:             31           5           0           0          25          24
Swap:            15           0          15

uname -a

Linux localhost 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

测试语句

生成 10W 个测试域名

for i in {1..100000}; do echo "d${i}.test.com. A" >> test.d; done
for i in {1..100000}; do echo "d${i}.test.com. 172800 IN A 192.168.0.${i}" >> root.z; done
./src/dnspod-sr

使用 bind-9.10.4-P2/contrib/queryperf 测试

./queryperf -s 192.168.0.21 -d test.d

DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $

[Status] Processing input data
[Status] Sending queries (beginning with 192.168.0.21)
[Status] Testing complete

Statistics:

  Parse input file:     once
  Ended due to:         reaching end of file

  Queries sent:         100000 queries
  Queries completed:    100000 queries
  Queries lost:         0 queries
  Queries delayed(?):   0 queries

  RTT max:          0.002000 sec
  RTT min:              0.000055 sec
  RTT average:          0.000854 sec
  RTT std deviation:    0.000324 sec
  RTT out of range:     0 queries

  Percentage completed: 100.00%
  Percentage lost:        0.00%

  Started at:           Thu Sep 29 10:45:41 2016
  Finished at:          Thu Sep 29 10:45:45 2016
  Ran for:              4.502813 seconds

  Queries per second:   22208.339542 qps

DNSPod-sr解析过程出错

DNSPod-sr在使用的过程中出现这个错误:refused nonrec (cache snoop) query from ip4 10.10..* 到底是什么原因?怎么解决呢?

一些小建议

Hi,
我只是大体看了下, 呵呵, 提几个不专业的小建议..

  1. 缩进比较乱, 可以统一到空格上来

  2. 编码规范需要统一, 严格点, 比如 if都需要用{} 括起来, 参数列表的参数间应该有空格

  3. 还有一些小问题, 我看到一个在util.c的:
    int get_random_data(uchar *buffer,int len)
    {
    int fd = -1;
    if((buffer == NULL) || (len < 0))
    return -1;
    fd = open("/dev/urandom",O_RDONLY);
    if(fd <= 0)
    return fd;
    read(fd,buffer,len);
    close(fd);
    return 0;
    }

    fd <= 0 这个, 直接<0就可以了, 不会返回0的.

    anyway, 是一个优秀的开源作品, 赞 :)

thanks

使用gcc在arm5te cpu上编译的错误

其它模块都编译通过只有下面这个不行,出错
[/tmp/make/src] # make
gcc -g -Wall -c -o memory.o memory.c
memory.c: In function 'rte_atomic32_cmpset':
memory.c:90: error: impossible constraint in 'asm'
make: *** [memory.o] Error 1

问题出在:
asm volatile(
"lock ; "
"cmpxchgl %[src], %[dst];"
"sete %[res];"
: [res] "=a" (res), /* output _/
[dst] "=m" (_dst)
: [src] "r" (src), /* input _/
"a" (exp),
"m" (_dst)
: "memory"); /* no-clobber list */
return res;

请问要怎么修改?

有核心数限制?

单核虚机表示开不起来
set affinity fetcher failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
killed

是否支持dns反解?

在内网搞了一个私有域名,正向解析是OK的,但是反解不行。配置如下:

offline01.hz. 172800 IN A 10.165.12.6
6.12.165.10.in-addr.arpa. 3600 IN PTR offline01.hz.

已经重启过dnspod-sr,使用host 10.165.12.6反解不成功

不是说防污染么?

我自己在vps上搭了一个,确实很简单,运行也正常。问题是得到的域名解析还是被污染的啊,不是说防污染么??难道我理解错了。

两个小时挂一次,妥妥的,日志全部是0大小

两台ns服务器配置都是最简单的A记录,做了进程退出的检查,发现2小时会挂一次进程,求指导。
顺便求教有没有配置的参考或者guid之类的。。
btw,/var/log/message也没有什么log。。

ns1:
check dnspod process success at Fri Jul 25 12:42:01 CST 2014
check dnspod process success at Fri Jul 25 12:43:01 CST 2014
restart dnspod at Fri Jul 25 12:44:01 CST 2014
check dnspod process success at Fri Jul 25 12:45:01 CST 2014
check dnspod process success at Fri Jul 25 12:46:01 CST 2014
check dnspod process success at Fri Jul 25 14:42:01 CST 2014
check dnspod process success at Fri Jul 25 14:43:01 CST 2014
check dnspod process success at Fri Jul 25 14:44:01 CST 2014
restart dnspod at Fri Jul 25 14:45:02 CST 2014
check dnspod process success at Fri Jul 25 14:46:02 CST 2014
check dnspod process success at Fri Jul 25 14:47:01 CST 2014
check dnspod process success at Fri Jul 25 16:43:01 CST 2014
check dnspod process success at Fri Jul 25 16:44:01 CST 2014
check dnspod process success at Fri Jul 25 16:45:01 CST 2014
restart dnspod at Fri Jul 25 16:46:01 CST 2014
check dnspod process success at Fri Jul 25 16:47:01 CST 2014
check dnspod process success at Fri Jul 25 16:48:01 CST 2014
check dnspod process success at Fri Jul 25 16:49:01 CST 2014

ns2:
check dnspod process success at Fri Jul 25 12:44:01 CST 2014
check dnspod process success at Fri Jul 25 12:45:01 CST 2014
restart dnspod at Fri Jul 25 12:47:01 CST 2014
check dnspod process success at Fri Jul 25 12:48:01 CST 2014
check dnspod process success at Fri Jul 25 12:49:01 CST 2014
check dnspod process success at Fri Jul 25 14:46:01 CST 2014
check dnspod process success at Fri Jul 25 14:47:01 CST 2014
restart dnspod at Fri Jul 25 14:48:01 CST 2014
check dnspod process success at Fri Jul 25 14:49:01 CST 2014
check dnspod process success at Fri Jul 25 14:50:01 CST 2014
check dnspod process success at Fri Jul 25 14:51:01 CST 2014
check dnspod process success at Fri Jul 25 16:47:01 CST 2014
check dnspod process success at Fri Jul 25 16:48:01 CST 2014
restart dnspod at Fri Jul 25 16:49:01 CST 2014
check dnspod process success at Fri Jul 25 16:50:01 CST 2014
check dnspod process success at Fri Jul 25 16:51:01 CST 2014

编译出错了。求搭救~

[root@localhost src]# make
gcc -o dnspod-sr -lm -lc utils.o datas.o net.o storage.o dns.o io.o event.o author.o init.o update.o control.o memory.o -lpthread -g# -O3
event.o: In function run_sentinel': /var/soft/dnspod-sr/src/event.c:270: undefined reference toCPU_SET_S'
init.o: In function create_author': /var/soft/dnspod-sr/src/init.c:144: undefined reference toCPU_SET_S'
init.o: In function create_fetcher': /var/soft/dnspod-sr/src/init.c:197: undefined reference toCPU_SET_S'
collect2: ld returned 1 exit status
make: *** [all] Error 1
[root@localhost src]#

太容易挂掉了, 用一个固定端口查询,1000并发

set affinity quizzer failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
[DBG:] dnspod-sr is successfully running now!!
[DBG:] max_ele_size is 1000000 - 1808
[DBG:] server may contain 332730 useful records
[DBG:] hash_table_size is 65536
[DBG:] we have 10 hash tables
[DBG:] we have 2 fetchers,2 quizzers
answer set Q sign
answer set Q sign
answer set Q sign
answer set Q sign
dnspod-sr: storage.c:263: get_val_from_he: Assertion `he->count > 0' failed.

已放弃

set affinity quizzer failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
[DBG:] dnspod-sr is successfully running now!!
[DBG:] max_ele_size is 1000000 - 1808
[DBG:] server may contain 332730 useful records
[DBG:] hash_table_size is 65536
[DBG:] we have 10 hash tables
[DBG:] we have 2 fetchers,2 quizzers
answer set Q sign
answer set Q sign

sig number is 11

set affinity quizzer failed, may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)
[DBG:] dnspod-sr is successfully running now!!
[DBG:] max_ele_size is 1000000 - 1808
[DBG:] server may contain 332730 useful records
[DBG:] hash_table_size is 65536
[DBG:] we have 10 hash tables
[DBG:] we have 2 fetchers,2 quizzers

sig number is 11

answer set Q sign
answer set Q sign
answer set Q sign

sig number is 11

[DBG:] we have 2 fetchers,2 quizzers
type is 448
type is 1800
sig number is 11

无数次。。。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.