summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-03 15:16:41 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-03 15:16:41 +0800
commite28f24a0c49768114d42cefa33ff79235b937d48 (patch)
tree64debb3969bccc0e35a0486651eed5dc141903a9
parent478ea9614468014b20f9c5d500f7b802c10f9f78 (diff)
downloadpttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.tar
pttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.tar.gz
pttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.tar.bz2
pttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.tar.lz
pttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.tar.xz
pttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.tar.zst
pttbbs-e28f24a0c49768114d42cefa33ff79235b937d48.zip
domain_name_query is changed to cidr format
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2176 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--include/pttstruct.h8
-rw-r--r--mbbsd/cache.c52
-rw-r--r--mbbsd/mbbsd.c23
-rw-r--r--mbbsd/stuff.c20
-rw-r--r--mbbsd/talk.c10
-rw-r--r--sample/etc/Makefile2
-rw-r--r--sample/etc/domain_name_query256
-rw-r--r--sample/etc/domain_name_query.cidr280
9 files changed, 354 insertions, 298 deletions
diff --git a/include/proto.h b/include/proto.h
index b13b6fca..0d66649f 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -462,6 +462,7 @@ void out_lines(const char *str, int line);
#define pressanykey() vmsg_lines(b_lines, NULL)
int vmsg_lines(int lines, const char *msg);
int log_user(const char *fmt, ...) GCC_CHECK_FORMAT(1,2);
+unsigned int ipstr2int(char *ip);
time_t gettime(int line, time_t dt, char* head);
void setcalfile(char *buf, char *userid);
void stand_title(char *title);
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 9d1b1935..8f00de01 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -444,9 +444,11 @@ typedef struct {
} GV2;
/* fromcache */
- char domain[MAX_FROM][50];
- char replace[MAX_FROM][50];
- int top;
+ unsigned int home_ip[MAX_FROM];
+ unsigned int home_mask[MAX_FROM];
+ char home_desc[MAX_FROM][32];
+ int home_num;
+
int max_user;
time_t max_time;
time_t Fuptime;
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 4c14dda5..4756b359 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -875,25 +875,45 @@ reload_fcache(void)
FILE *fp;
SHM->Fbusystate = 1;
- bzero(SHM->domain, sizeof(SHM->domain));
- if ((fp = fopen("etc/domain_name_query", "r"))) {
- char buf[256], *po;
+ bzero(SHM->home_ip, sizeof(SHM->home_ip));
+ if ((fp = fopen("etc/domain_name_query.cidr", "r"))) {
+ char buf[256], *ip, *mask;
- SHM->top = 0;
+ SHM->home_num = 0;
while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] && buf[0] != '#' && buf[0] != ' ' &&
- buf[0] != '\n') {
- sscanf(buf, "%s", SHM->domain[SHM->top]); // XXX check buffer size
- po = buf + strlen(SHM->domain[SHM->top]);
- while (*po == ' ' || *po == '\t')
- po++;
- strncpy(SHM->replace[SHM->top], po, 49);
- SHM->replace[SHM->top]
- [strlen(SHM->replace[SHM->top]) - 1] = 0;
- (SHM->top)++;
- if (SHM->top == MAX_FROM)
- break;
+ if (!buf[0] || buf[0] == '#' || buf[0] == ' ' || buf[0] == '\n')
+ continue;
+
+ if (buf[0] == '@') {
+ SHM->home_ip[0] = 0;
+ SHM->home_mask[0] = 0xFFFFFFFF;
+ SHM->home_num++;
+ continue;
+ }
+
+ ip = strtok(buf, " \t");
+ if ((mask = strchr(ip, '/')) != NULL) {
+ int shift = 32 - atoi(mask + 1);
+ SHM->home_ip[SHM->home_num] = ipstr2int(ip);
+ SHM->home_mask[SHM->home_num] = (0xFFFFFFFF >> shift ) << shift;
+ }
+ else {
+ SHM->home_ip[SHM->home_num] = ipstr2int(ip);
+ SHM->home_mask[SHM->home_num] = 0xFFFFFFFF;
}
+ ip = strtok(NULL, " \t");
+ if (ip == NULL) {
+ strncpy(SHM->home_desc[SHM->home_num], "¶³²`¤£ª¾³B",
+ sizeof(SHM->home_desc[SHM->home_num]));
+ }
+ else {
+ strncpy(SHM->home_desc[SHM->home_num], ip,
+ sizeof(SHM->home_desc[SHM->home_num]));
+ SHM->home_desc[SHM->home_num][strlen(SHM->home_desc[SHM->home_num]) - 1] = 0;
+ }
+ (SHM->home_num)++;
+ if (SHM->home_num == MAX_FROM)
+ break;
}
fclose(fp);
}
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 7736d92d..eb935696 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -689,25 +689,14 @@ del_distinct(char *fname, char *line)
static int
where(char *from)
{
- register int i = 0, count = 0, j;
-
- for (j = 0; j < SHM->top; j++) {
- char *token = strtok(SHM->domain[j], "&");
-
- i = 0;
- count = 0;
- while (token) {
- if (strstr(from, token))
- count++;
- token = strtok(NULL, "&");
- i++;
+ int i;
+
+ for (i = 0; i < SHM->home_num; i++) {
+ if ((SHM->home_ip[i] & SHM->home_mask[i]) == (ipstr2int(from) & SHM->home_mask[i])) {
+ return i;
}
- if (i == count)
- break;
}
- if (i != count)
- return 0;
- return j;
+ return 0;
}
#endif
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 8d70566d..d35be51b 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -317,6 +317,26 @@ belong(char *filelist, char *key)
return rc;
}
+unsigned int
+ipstr2int(char *ip)
+{
+ unsigned int i, val = 0;
+ char buf[32];
+ char *nil, *p;
+ strcpy(buf, ip);
+ p = buf;
+ for (i = 0; i < 4; i++) {
+ nil = strchr(p, '.');
+ if (nil != NULL)
+ *nil = 0;
+ val *= 256;
+ val += atoi(p);
+ if (nil != NULL)
+ p = nil + 1;
+ }
+ return val;
+}
+
#ifndef _BBS_UTIL_C_ /* getdata_buf */
time_t
gettime(int line, time_t dt, char*head)
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index b0c22f4c..20b6a6ac 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1614,7 +1614,7 @@ descript(int show_mode, userinfo_t * uentp, time_t diff)
return (((uentp->pager != 2 && uentp->pager != 3 && diff) ||
HAS_PERM(PERM_SYSOP)) ?
#ifdef WHERE
- uentp->from_alias ? SHM->replace[uentp->from_alias] :
+ uentp->from_alias ? SHM->home_desc[uentp->from_alias] :
uentp->from
#else
uentp->from
@@ -2980,14 +2980,14 @@ AngelNotOnline(){
outs("\nÍ¢¯d¨¥µ¹§A¡G\n");
outs("\033[1;31;44m¡ó¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢t\033[37m"
"¤p¤Ñ¨Ï¯d¨¥\033[31m¢u¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¡ó\033[m\n");
- outs("\033[1;31mùú¢t\033[32m ¤p¤Ñ¨Ï "
- " \033[31m¢uùû\033[m\n");
+ outs("\033[1;31m¢~¢t\033[32m ¤p¤Ñ¨Ï "
+ " \033[31m¢u¢¡\033[m\n");
while (fgets(buf, sizeof(buf), fp)) {
buf[strlen(buf) - 1] = 0;
prints("\033[1;31m¢x\033[m%-74.74s\033[1;31m¢x\033[m\n", buf);
}
- outs("\033[1;31mùü¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w"
- "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢sùý\033[m\n");
+ outs("\033[1;31m¢¢¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w"
+ "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¢£\033[m\n");
outs("\033[1;31;44m¡ó¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w"
"¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¡ó\033[m\n");
diff --git a/sample/etc/Makefile b/sample/etc/Makefile
index 6a2755ef..449fe284 100644
--- a/sample/etc/Makefile
+++ b/sample/etc/Makefile
@@ -2,7 +2,7 @@ SUBDIR=chickens
BBSHOME?=$(HOME)
TARGET=$(BBSHOME)/etc/
FILES= @five Welcome register today_boring \
- Welcome_birth domain_name_query registered \
+ Welcome_birth domain_name_query.cidr registered \
ve.hlp Logout Welcome_login expire.conf \
registeredmail MRT.map bad_host feast \
registermail Makefile banemail goodbye \
diff --git a/sample/etc/domain_name_query b/sample/etc/domain_name_query
deleted file mode 100644
index cc3a05f2..00000000
--- a/sample/etc/domain_name_query
+++ /dev/null
@@ -1,256 +0,0 @@
-# '#'¦Û¤§«á¥i¥H¥[µù¸Ñ
-#
-# ¤U­±³o'@'¦æ¤£¥i®³±¼
-# ¬dµL˽¦í§}
-@@@@@@@@@@@@@@ ----------
-
-# 255.255.255.255 ¦U¤H±MÄݽЩñ³oÃä
-
-# ¾Ç®Õ ©Î ¹ÎÅé
-# ¸s²Õ½Ð¥Ñ¤p¨ì¤j±Æ¦C
-
-pclab&csie bcªºpclab
-.ee.ntu. ¥x¤j¹q¾÷¾Ç°|
-jan.csie.ntu ¥x¤j¸ê°T¦a¤U¤@¤ë
-feb.csie.ntu ¥x¤j¸ê°T¦a¤U¤G¤ë
-mar.csie.ntu ¥x¤j¸ê°T¦a¤U¤T¤ë
-apr.csie.ntu ¥x¤j¸ê°T¦a¤U¥|¤ë
-may.csie.ntu ¥x¤j¸ê°T¦a¤U¤­¤ë
-jun.csie.ntu ¥x¤j¸ê°T¦a¤U¤»¤ë
-sep.csie.ntu ¥x¤j¸ê°T¦a¤U¤E¤ë
-snoopy.csie ¥v¥£¤ñ¤u§@¯¸
-csie.ntu ¥x¤j¸ê°T¨t
-140.112.28. ¥x¤j¸ê°T¨t
-140.112.29. ¥x¤j¸ê°T¨t
-140.112.30. ¥x¤j¸ê°T¨t
-140.112.31. ¥x¤j¸ê°T¨t
-#140.112.4 ¥x¤j¸ê°T¨t
-phys.ntu ¥x¤jª«²z¨t
-scorpio.im.ntu ¥x¤j¸êºÞscorpio
-im.ntu ¥x¤jºÞ°|
-ccnet1.ntu ¥x¤j±JªÙDNS
-cc.ntu. ¥x¤j­pºâÂû¤¤¤ß
-140.112.3. ¥x¤j­pºâÂû¤¤¤ß
-
-140.112.10. ¥x¤j¤g¤ì¨t
-140.112.11. ¥x¤j¤g¤ì¨t
-140.112.12. ¥x¤j¤g¤ì¨t
-140.112.13. ¥x¤j¤g¤ì¨t
-ce.ntu ¥x¤j¤g¤ì¨t
-
-140.112.15. ¥x¤j§ÓÂEÀ]
-
-140.112.16. ¥x¤j·s¤u¾Ç°|¤j¼Ó
-140.112.17. ¥x¤j¹q¾÷¾Ç°|
-140.112.18. ¥x¤j¹q¾÷¾Ç°|
-140.112.19. ¥x¤j¹q¾÷¾Ç°|
-140.112.20. ¥x¤j¹q¾÷¾Ç°|
-140.112.21. ¥x¤j¹q¾÷¾Ç°|
-
-140.112.22. ¥x¤j¤Æ¤u¨t
-140.112.23. ¥x¤j¤Æ¤u¨t
-140.112.26. ¥x¤j³y²î¨t
-
-140.112.169. ¥x¤j¬ã¤G¤p®M©Ð
-140.112.174. ¥x¤j¤k¤E¯½´Ö§{
-140.112.216. ¥x¤j¤k¤T²¢»eºÛ
-140.112.220. ¥x¤j¤k¤@¤j»Ó©Ð
-140.112.221. ¥x¤j¤k¤@¤j»Ó©Ð
-140.112.224. ¥x¤j¤k¤C¦¨¦ç³õ
-140.112.225. ¥x¤j¤k¤­°w´«Ç
-140.112.239. ¥x¤j¨k¤@ºÛ
-140.112.240. ¥x¤j¨k¤@ºÛ
-140.112.241. ¥x¤j¨k¤@ºÛ
-140.112.242. ¥x¤j¨k¤@ºÛ
-140.112.243. ¥x¤j¨k¤T«Î
-140.112.244. ¥x¤j¨k¤T«Î
-140.112.245. ¥x¤j¨k¤­©Ð
-140.112.246. ¥x¤j¨k¤­©Ð
-140.112.247. ¥x¤j¨k¤»²²
-140.112.248. ¥x¤j¨k¤»²²
-140.112.249. ¥x¤j¨k¤C½`
-140.112.250. ¥x¤j¨k¤C½`
-140.112.251. ¥x¤j¨k¤K§O¹Ö
-140.112.252. ¥x¤j¨k¤K§O¹Ö
-140.112.253. ¥x¤j¨k¤K§O¹Ö
-
-.m1.ntu ¥x¤j¨k¤@ºÛ
-.m2.ntu ¥x¤j¨k¤GÀ]
-.m3.ntu ¥x¤j¨k¤T«Î
-.m4.ntu ¥x¤j¨k¥|©Ò
-.m5.ntu ¥x¤j¨k¤­©Ð
-.m6.ntu ¥x¤j¨k¤»²²
-.m7.ntu ¥x¤j¨k¤C½`
-.m8.ntu ¥x¤j¨k¤K²ø
-.g2.ntu ¥x¤j¬ã¤G¤p®M©Ð
-.f1.ntu ¥x¤j¤k¤@¤j»Ó©Ð
-.f2.ntu ¥x¤j¤k¤G»e¤ë«Î
-.f3.ntu ¥x¤j¤k¤T²¢»eºÛ
-.f4.ntu ¥x¤j¤k¥|°ª±^«Î
-.f5.ntu ¥x¤j¤k¤­°w´«Ç
-.f6.ntu ¥x¤j¤k¤»±B¯½´Y
-.f7.ntu ¥x¤j¤k¤C¦¨¦ç³õ
-.f8.ntu ¥x¤j¤k¤K¬V¦ç¶í
-.f9.ntu ¥x¤j¤k¤E¯½´Ö§{
-
-green.ev.ntu. ¥x¤jÀô¤u©Ò
-.ie.ntu.edu.tw ¥x¤j¤u¤u©Ò
-140.112.36. ¥x¤j¤u¤u©Ò(·s¤u¼Ó)
-140.112.38. ¥x¤jÀ³¤O©Ò
-140.112.39. ¥x¤j«°¶m©Ò
-140.112.40. ¥x¤j¤ô¤u©Ò(·s¤u¼Ó)
-140.112.42. ¥x¤j¹q¾÷ÂÂÀ]
-140.112.43. ¥x¤j¾÷±ñ¨t
-140.112.44. ¥x¤j¾÷±ñ¨t
-140.112.46. ¥x¤j¾÷±ñ¨t
-math.ntu ¥x¤j¼Æ¾Ç¨t
-140.112.50. ¥x¤j¼Æ¾ÇÀ]
-140.112.52. ¥x¤jª«²z¨t
-140.112.54. ¥x¤j¤Æ¾Ç¨t
-140.112.56. ¥x¤j¦a½è¨t
-140.112.58. ¥x¤j°Êª«¨t
-140.112.60. ¥x¤j´Óª«¨t
-140.112.61. ¥x¤j´Ó¬ã¤j¼Ó
-psy.ntu ¥x¤j¤ß²z¨t
-140.112.62. ¥x¤j¤ß²z¨t
-140.112.64. ¥x¤j¦a²z¨t
-140.112.65. ¥x¤j¥þ²yÅܾE/¾®ºA¤¤¤ß
-140.112.66. ¥x¤j¤j®ð¨t
-140.112.67. ¥x¤j¤j®ð¨t
-140.112.68. ¥x¤j®ü¬v©Ò
-140.112.69. ¥x¤j®ü¬v©Ò
-140.112.70. ¥x¤jº®¬ì©Ò
-140.112.72. ¥x¤j¥Í¤Æ©Ò
-140.112.74. ¥x¤j¹AÃÀ¨t
-140.112.75. ¥x¤j¥Í²Î±Ð«Ç
-140.112.76. ¥x¤j¹A¤u¨t
-140.112.78. ¥x¤j¹A¤Æ¨t
-140.112.80. ¥x¤j´Ó¯f¨t
-140.112.81. ¥x¤j©øÂÎÀ]
-140.112.82. ¥x¤j´ËªL¨t
-140.112.84. ¥x¤j¯b²£¨t
-140.112.86. ¥x¤j¹A¸g¨t
-140.112.88. ¥x¤j¶éÃÀ¨t
-140.112.89. ¥x¤j¤u¼t
-140.112.92. ¥x¤j¹A±À¨t
-140.112.94. ¥x¤j¹A¾÷¨t
-140.112.96. ¥x¤jÃ~Âå¨t
-140.112.99. ¥x¤j½Ã¥Í²Õ
-140.112.111. ¥x¤j¬¡°Ê¤¤¤ß
-140.112.120. ¥x¤j¬¡°Ê¤¤¤ß
-140.112.100. ¥x¤j´Ó¯f¨t¾iÂÎÀ]
-140.112.106. ¥x¤j¸êºÞ¨t
-140.112.108. ¥x¤jºÞ°|­p¤¤
-140.112.110. ¥x¤jºÞ°|­p¤¤
-140.112.120. ¥x¤jÂå¾Ç®Õ°Ï
-140.112.136. ¥x¤j¤½½Ã¨t
-140.112.141. ¥x¤j¤¤¤å¨t/¥~¤å¨t
-140.112.142. ¥x¤j¾ú¥v¨t/ÃÀ³N¥v©Ò
-140.112.143. ¥x¤j­õ¾Ç¨t/¹A·~³¯¦C¼s
-140.112.145. ¥x¤jÁò³õ¤Î´¶³q±Ð«Ç
-140.112.146. ¥x¤j¤é¤å¨t/À¸¨è©Ò/»y¨¥©Ò
-140.112.150. ¥x¤jªk¾Ç°|,ªk¹Ï
-140.112.153. ¥x¤j·s»D©Ò
-140.112.155. ¥x¤j¤T¬ã©Ò
-140.112.156. ¥x¤jªÀ·|¨t
-140.112.157. ¥x¤jªÀ·|¨t
-140.112.160. ¥x¤j¦æ¬F¤j¼Ó
-140.112.178. ¥x¤j¾Ç¥Í¦í±JªA°È²Õ
-140.112.181. ¥x¤jºÞ²z¾Ç°|
-140.112.182. ¥x¤j·s¤u¼Ó
-140.112.183. ¥x¤j¹A·~¦Û°Ê¤Æ±Ð«Ç
-lib.ntu. ¥x¤jÁ`¹Ï
-
-.admin.yzu ¤¸´¼ºô±À
-.dorm.ccu.e ¤¤¥¿¤j®ÈªÀ
-.mayju.com ±ö¦Ë¤s²ø
-as.ntu. ¥x¤j¤j®ð¨t
-csie.nctu. ¥æ¤j¸ê¤u
-www.nia. °ê¥ßÃÀ³N¾Ç°|www
-nia.edu.tw °ê¥ßÃÀ³N¾Ç°|
-163.18. °ª¶¯¥Ì½©¶é
-203.64.3. °ê¥ßÃÀ³N¾Ç°|
-140.119. ¬Fªv¤j¾Ç
-cc.ntnu. ®v¤j­p¤¤
-140.122. ®v½d¤j¾Ç
-k2.dorm.nc ¦¨¤j¥ú¤G8ªÙ
-cc.nctu. ¥æ¤j­p¤¤
-php&cc.nctu. ¥æ¤j­p¤¤
-nchu ¤¤¿³¤j¾Ç
-linux.na.ntu. ¥x¤j³y²î¤¤¤ß
-140.112.8. ¥x¤j­pºâÂû¤¤¤ß
-140.112.7. ¥x¤j­p¤¤PC«Ç
-cc.ncku. ¦¨¤j­p¤¤
-stmail.fju. »²¤j­p¤¤
-IP&dialup.ntu. ­p¤¤¼·±µ¨t²Î
-im.ntu.edu. ¥x¤j¸êºÞ
-med.mc.ntu. ¥x¤jÂå°|ºô¸ô³¡
-mc.ntu. ¥x¤jÂå°|ºô¸ô³¡
-139.175. SeedNet
-.seed.net.tw SeedNet
-210.64. HiNet
-168.95. Hinet
-.ts.hin HiNet
-.hinet. HiNet
-cc.chpi. ¤¤µØ¤u¾Ç°|
-.nctu. ¥æ³q¤j¾Ç
-.cc.nccu.edu.tw ¬F¤j­p¤¤
-.nccu.edu.tw ¬Fªv¤j¾Ç
-.AB. ²M¤j±JªÙ
-.ncku. ¦¨¤j
-.seeder. ªüªiù¸ê°Tºô
-iis. ¤¤¬ã°|¸ê°T©Ò
-sinica. ¤¤¥¡¬ã¨s°|
-ntust. ¥x¬ì¤j
-scu. ªF§d¤j¾Ç
-fju. »²¤¯¤j¾Ç
-nthu. ²MµØ¤j¾Ç
-thu. ªF®ü¤j¾Ç
-ntu.edu ¥xÆW¤j¾Ç
-ntut.edu ¥x¥_¬ì§Þ¤j¾Ç
-140.112 ¥xÆW¤j¾Ç
-cgu. ªø©°¤j¾Ç
-ntou. ®ü¬v¤j¾Ç
-NTOU. ®ü¬v¤j¾Ç
-NCTU. ¥æ³q±JªÙ
-140.125 ¶³ªL¬ì§Þ¤j¾Ç
-tpml.edu.tw ¥x¥_¥«¥ß¹Ï®ÑÀ]
-ntnu. ®v½d¤j¾Ç
-ficnet.net ¤j²³ºô¸ô
-tku. ²H¦¿¤j¾Ç
-shu. ¥@·s¤j¾Ç
-ncue. ¹ü¤Æ®v½d¤j¾Ç
-ncu. ¤¤¥¡¤j¾Ç
-ntnu. ®v½d¤j¾Ç
-140.115 ¤¤¥¡¤j¾Ç
-ndhu. ªFµØ¤j¾Ç
-iii ¸êµ¦·|
-nsysu. ¤¤¤s¤j¾Ç
-ethome ªF´Ë¼eÀW
-tmc.edu.tw ¥x¥_Âå¾Ç°|
-ym.edu.tw ¶§©ú¤j¾Ç
-chu.edu.tw ¤¤µØ¤j¾Ç
-140.138 ¤¸´¼¤j¾Ç
-140.128 ªF®ü¤j¾Ç
-140.120 ¤¤¿³¤j¾Ç
-ntpu. ¥x¥_¤j¾Ç
-yzu.edu.tw ¤¸´¼¤j¾Ç
-cyut.edu.tw ´Â¶§¬ì§Þ¤j¾Ç
-fg.tp. ¥_¤@¤k
-nhltc. ªá½¬®v½d¾Ç°|
-tceb. ¥x¤¤¥«©²±Ð¨|§½
-ntcic. ¥x¤¤§Þ³N¾Ç°|
-jhnc.tp. ¥_¥«¸Û¥¿°ê¤¤
-dyu. ¤j¸­¤j¾Ç
-ilc.edu. ©yÄõ¿¤±Ð¨|¸ê°Tºô
-ks.edu. °ª¶¯¿¤±Ð¨|ºô
-cma. ³°­x©x®Õ
-ssvs.tp. ªQ¤s®a°Ó
-csmc. ¤¤¤sÂå¾Ç°|
-ttu. ¤j¦P¤j¾Ç
-cmc. ¤¤°êÂåÃľǰ|
-kmu. °ª¶¯Âå¾Ç¤j¾Ç
-tmtc. ¥_¥«®v½d¾Ç°|
-140.117. ¤¤¤s¤j¾Ç
-210.208. SayHiNetµL­­¼·±µ
-ck.tp.edu.tw «Ø°ê¤¤¾Ç
diff --git a/sample/etc/domain_name_query.cidr b/sample/etc/domain_name_query.cidr
new file mode 100644
index 00000000..92487e55
--- /dev/null
+++ b/sample/etc/domain_name_query.cidr
@@ -0,0 +1,280 @@
+# '#'¦Û¤§«á¥i¥H¥[µù¸Ñ
+#
+# ¤U­±³o'@'¦æ¤£¥i®³±¼
+# ¬dµL¦¹¦í§}
+@@@@@@@@@@@@@@ ----------
+
+# 255.255.255.255 ¦U¤H±MÄݽЩñ³oÃä
+127.0.0.1 ª¯ºÛ
+
+# ¾Ç®Õ ©Î ¹ÎÅé ¸s²Õ½Ð¥Ñ¤p¨ì¤j±Æ¦C
+140.112.28.0/22 ¥x¤j¸ê°T¨t
+140.112.3.0/23 ¥x¤j­pºâ¾÷¤¤¤ß
+140.112.6.0/24 ¥x¤j¼·±µ/ADSL
+140.112.7.0/24 ¥x¤j­p¤¤PC«Ç
+140.112.8.0/24 ¥x¤j­pºâ¾÷¤¤¤ß
+140.112.10.0/24 ¥x¤j¤g¤ì¨t
+140.112.11.0/24 ¥x¤j¤g¤ì¨t
+140.112.12.0/24 ¥x¤j¤g¤ì¨t
+140.112.13.0/24 ¥x¤j¤g¤ì¨t
+140.112.14.0/24 ¥x¤j¾÷±ñ¨t
+140.112.15.0/24 ¥x¤j§ÓÂEÀ]
+140.112.16.0/24 ¥x¤j¤uºî
+140.112.17.0/24 ¥x¤j¹q¾÷¨t
+140.112.18.0/24 ¥x¤j¹q¾÷¨t
+140.112.19.0/24 ¥x¤j¹q¾÷¨t
+140.112.20.0/24 ¥x¤j¹q¾÷¨t
+140.112.21.0/24 ¥x¤j¹q¾÷¨t
+140.112.41.0/24 ¥x¤j¹q¾÷¨t
+140.112.22.0/24 ¥x¤j¤Æ¤u¨t
+140.112.23.0/24 ¥x¤j¤Æ¤u¨t
+140.112.25.0/24 ¥x¤j¼·±µ/ADSL
+140.112.26.0/24 ¥x¤j¤u¬ì¨t
+140.112.27.0/24 ¥x¤j¤u¬ì¨t
+140.112.36.0/24 ¥x¤j¤u¤u©Ò(¤uºî)
+140.112.38.0/24 ¥x¤jÀ³¤O©Ò
+140.112.39.0/24 ¥x¤jÀ³¤O©Ò
+140.112.40.0/24 ¥x¤j«°¶m©Ò
+140.112.41.0/24 ¥x¤j¹q¾÷¨t
+140.112.42.0/24 ¥x¤j¹q¾÷ÂÂÀ]
+140.112.43.0/24 ¥x¤j¾÷±ñ¨t
+140.112.44.0/24 ¥x¤j¾÷±ñ¨t
+140.112.46.0/24 ¥x¤j¾÷±ñ¨t
+140.112.50.0/24 ¥x¤j¼Æ¾ÇÀ]
+140.112.52.0/24 ¥x¤jª«²z¨t
+140.112.54.0/24 ¥x¤j¤Æ¾Ç¨t
+140.112.56.0/24 ¥x¤j¦a½è¨t
+140.112.58.0/24 ¥x¤j°Êª«¨t
+140.112.60.255/25 ¥x¤j´Ó·L¨t
+140.112.60.0/24 ¥x¤j´Óª«¨t
+140.112.61.0/24 ¥x¤j´Ó¬ã¤j¼Ó
+140.112.62.0/24 ¥x¤j¤ß²z¨t
+140.112.64.0/24 ¥x¤j¦a²z¨t
+140.112.65.0/24 ¥x¤j¥þ²yÅܾE/¾®ºA¤¤¤ß
+140.112.66.0/24 ¥x¤j¤j®ð¨t
+140.112.67.0/24 ¥x¤j¤j®ð¨t
+140.112.68.0/24 ¥x¤j®ü¬v©Ò
+140.112.69.0/24 ¥x¤j®ü¬v©Ò
+140.112.70.0/24 ¥x¤jº®¬ì©Ò
+140.112.72.0/24 ¥x¤j¥Í¤Æ©Ò
+140.112.74.0/24 ¥x¤j¹AÃÀ¨t
+140.112.75.0/24 ¥x¤j¥Í²Î±Ð«Ç
+140.112.76.0/24 ¥x¤j¥Í¤u¨t
+140.112.78.0/24 ¥x¤j¹A¤Æ¨t
+140.112.80.0/24 ¥x¤j´Ó·L¨t
+140.112.81.0/24 ¥x¤j©øÂÎÀ]
+140.112.82.0/24 ¥x¤j´ËªL¨t
+140.112.84.0/24 ¥x¤j¯b²£¨t
+140.112.86.0/24 ¥x¤j¹A¸g¨t
+140.112.88.0/24 ¥x¤j¶éÃÀ¨t
+140.112.89.0/24 ¥x¤j¤u¼t
+140.112.92.0/24 ¥x¤j¹A±À¨t
+140.112.94.0/24 ¥x¤j¥Í¾÷¨t
+140.112.96.0/24 ¥x¤jÃ~Âå¨t
+140.112.99.0/24 ¥x¤j½Ã¥Í²Õ
+140.112.100.0/24 ¥x¤j´Ó¯f¨t¾iÂÎÀ]
+140.112.106.0/24 ¥x¤j¸êºÞ¨t
+140.112.108.0/24 ¥x¤jºÞ°|­p¤¤
+140.112.110.0/24 ¥x¤jºÞ°|­p¤¤
+140.112.120.0/24 ¥x¤jÂå¾Ç®Õ°Ï
+140.112.122.0/24 ¥x¤jÂå¾Ç°|
+140.112.136.0/24 ¥x¤j¤½½Ã¨t
+140.112.141.0/24 ¥x¤j¤¤¤å¨t/¥~¤å¨t
+140.112.142.0/24 ¥x¤j¾ú¥v¨t/ÃÀ³N¥v©Ò
+140.112.143.0/24 ¥x¤j­õ¾Ç¨t/¹A·~³¯¦CÀ]
+140.112.145.0/24 ¥x¤jÁò³õ¤Î´¶³q±Ð«Ç
+140.112.146.0/24 ¥x¤j¤é¤å¨t/À¸¼@©Ò/»y¨¥©Ò
+140.112.150.0/24 ¥x¤jªk¾Ç°|/ªk¹Ï
+140.112.153.0/24 ¥x¤j·s»D©Ò
+140.112.155.0/24 ¥x¤j°ê®aµo®i©Ò
+140.112.156.0/24 ¥x¤jªÀ·|¨t
+140.112.157.0/24 ¥x¤jªÀ·|¨t
+140.112.160.0/24 ¥x¤j¦æ¬F¤j¼Ó
+140.112.169.0/24 ¥x¤j¬ã¤G¤p®M©Ð
+140.112.170.0/24 ¥x¤j¬ã¤G¤¤®M©Ð
+140.112.171.0/24 ¥x¤j¬ã¤G¤j®M©Ð
+140.112.173.0/24 ¥x¤j¤k¤K§ÖÀ\©±
+140.112.178.0/24 ¥x¤j¾Ç¥Í¦í±JªA°È²Õ
+140.112.181.0/24 ¥x¤jºÞ²z¾Ç°|
+140.112.182.0/24 ¥x¤j¤uºî
+140.112.183.0/24 ¥x¤j¹A·~¦Û°Ê¤Æ±Ð«Ç
+140.112.193.0/24 ¥x¤j¤k¤E¯½´Ö§{
+140.112.195.0/24 ¥x¤j¼Æ¤ÆªÙ
+140.112.201.0/24 ¥x¤jªF¨È¤å©ú¬ã¨s¤¤¤ß
+140.112.204.0/24 ¥x¤j¤k¥|¤p¤ì«Î
+140.112.205.0/24 ¥x¤jADSL
+140.112.211.0/24 ¥x¤j¨k¥|ªÙ
+140.112.212.0/24 ¥x¤j¨k¤GÀ]
+140.112.213.0/24 ¥x¤j¨k¤GÀ]
+140.112.214.0/24 ¥x¤j¨k¥|ªÙ
+140.112.215.0/24 ¥x¤j¨k16ªÙ
+140.112.216.0/24 ¥x¤j¤k¤T²¢»eºÛ
+140.112.217.0/24 ¥x¤j¤ô·½±JªÙ
+140.112.218.0/24 ¥x¤j¤ô·½±JªÙ
+140.112.220.0/24 ¥x¤j¤k¤@¤p»Ó©Ð
+140.112.221.0/24 ¥x¤j¤k¤@¤j»Ó©Ð
+140.112.222.0/24 ¥x¤j¤k¤G¤â¤uçE
+140.112.223.0/24 ¥x¤j¤k¤T²¢»eºÛ
+140.112.224.0/24 ¥x¤j¤k¤C¦¨¦ç³õ
+140.112.225.0/24 ¥x¤j¤k¤­°w´«Ç
+140.112.226.0/24 ¥x¤j¤k¤»±B¯½´Y
+140.112.227.0/24 ¥x¤j¤k¤C¦¨¦ç³õ
+140.112.228.0/24 ¥x¤j¤k¤G¤â¤uçE
+140.112.229.0/24 ¥x¤j°ê«C±JªÙ
+140.112.231.0/24 ¥x¤j°ê«C±JªÙ
+140.112.232.0/24 ¥x¤j°ê«C±JªÙ
+140.112.233.0/24 ¥x¤j¬ã¤@ªÙ
+140.112.234.0/24 ¥x¤j¬ã¤@ªÙ
+140.112.239.0/24 ¥x¤j¨k¤@ºÛ
+140.112.240.0/24 ¥x¤j¨k¤@ºÛ
+140.112.241.0/24 ¥x¤j¨k¤@ºÛ
+140.112.242.0/24 ¥x¤j¨k¤@ºÛ
+140.112.243.0/24 ¥x¤j¨k¤T«Î
+140.112.244.0/24 ¥x¤j¨k¤T«Î
+140.112.245.0/24 ¥x¤j¨k¤­©Ð
+140.112.246.0/24 ¥x¤j¨k¤­©Ð
+140.112.247.0/24 ¥x¤j¨k¤»²²
+140.112.248.0/24 ¥x¤j¨k¤»²²
+140.112.249.0/24 ¥x¤j¨k¤C½`
+140.112.250.0/24 ¥x¤j¨k¤C½`
+140.112.251.0/24 ¥x¤j¨k¤K§O¹Ö
+140.112.252.0/24 ¥x¤j¨k¤K§O¹Ö
+140.112.253.0/24 ¥x¤j¨k¤K§O¹Ö
+140.112.0.0/16 ¥xÆW¤j¾Ç
+
+# ¨S¤p¼ÆÂI¬O¬G·Nªº¡A¨Ò¦p140.127.3¬O140.127.3x.xxx
+140.109.0.0/16 ¤¤¥¡¬ã¨s°|
+140.111.0.0/16 ±Ð¨|³¡
+140.113.0.0/16 ¥æ³q¤j¾Ç
+140.114.0.0/16 ²MµØ¤j¾Ç
+140.115.81.0/24 ¤¤¥¡¤j¾ÇºÞ²z¾Ç°|
+140.115.83.0/24 ¤¤¥¡¤j¾ÇºÞ²z¾Ç°|
+140.115.84.0/24 ¤¤¥¡¤j¾ÇºÞ²z¾Ç°|
+140.115.85.0/24 ¤¤¥¡¤j¾Ç²£¸g©Ò
+140.115.201.0/24 ¤¤¥¡¤j¾Ç¤k¤@ªÙ
+140.115.202.0/24 ¤¤¥¡¤j¾Ç¤k¤GªÙ
+140.115.203.0/24 ¤¤¥¡¤j¾Ç¤k¤TªÙ
+140.115.204.0/24 ¤¤¥¡¤j¾Ç¤k¥|ªÙ
+140.115.205.0/24 ¤¤¥¡¤j¾Ç¤k¥|ªÙ
+140.115.206.0/24 ¤¤¥¡¤j¾Ç¤k¤Q¥|ªÙ
+140.115.207.0/24 ¤¤¥¡¤j¾Ç¤k¤Q¥|ªÙ
+140.115.208.0/24 ¤¤¥¡¤j¾Ç¤k¤Q¥|ªÙ
+140.115.209.0/24 ¤¤¥¡¤j¾Ç¤k¤Q¥|ªÙ
+140.115.213.0/24 ¤¤¥¡¤j¾Ç¨k¤TªÙ
+140.115.214.0/24 ¤¤¥¡¤j¾Ç¨k¥|ªÙ
+140.115.215.0/24 ¤¤¥¡¤j¾Ç¨k¤­ªÙ
+140.115.216.0/24 ¤¤¥¡¤j¾Ç¨k¤»ªÙ
+140.115.217.0/24 ¤¤¥¡¤j¾Ç¨k¤CªÙ
+140.115.219.0/24 ¤¤¥¡¤j¾Ç¨k¤EªÙ
+140.115.220.0/24 ¤¤¥¡¤j¾Ç¨k¤EªÙ
+140.115.221.0/24 ¤¤¥¡¤j¾Ç¨k¤EªÙ
+140.115.222.0/24 ¤¤¥¡¤j¾Ç¨k¤EªÙ
+140.115.224.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤@ªÙ
+140.115.225.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤@ªÙ
+140.115.226.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤GªÙ
+140.115.227.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤GªÙ
+140.115.228.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤TªÙ
+140.115.229.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤TªÙ
+140.115.230.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤TªÙ
+140.115.231.0/24 ¤¤¥¡¤j¾Ç¨k¤Q¤TªÙ
+140.115.232.0/24 ¤¤¥¡¤j¾Ç¬ãªÙ
+140.115.233.0/24 ¤¤¥¡¤j¾Ç¬ãªÙ
+140.115.234.0/24 ¤¤¥¡¤j¾Ç¬ãªÙ
+140.115.235.0/24 ¤¤¥¡¤j¾Ç¬ãªÙ
+140.115.0.0/16 ¤¤¥¡¤j¾Ç
+140.116.0.0/16 ¦¨¥\¤j¾Ç
+140.117.0.0/16 ¤¤¤s¤j¾Ç
+140.118.0.0/16 ¥xÆW¬ì§Þ¤j¾Ç
+140.119.0.0/16 ¬Fªv¤j¾Ç
+140.120.0.0/16 ¤¤¿³¤j¾Ç
+140.121.0.0/16 ®ü¬v¤j¾Ç
+140.122.0.0/16 ¥xÆW®v½d¤j¾Ç
+140.123.0.0/16 ¤¤¥¿¤j¾Ç
+140.116.0.0/16 ¥x¥_¬ì§Þ¤j¾Ç
+140.125.0.0/16 ¶³ªL¬ì§Þ¤j¾Ç
+140.126.2.0/23 ¤¤µØ¤j¾Ç
+140.126.32.0/20 ·s¦Ë®v½d¾Ç°|
+140.127.64.0/18 °ª¶¯®v½d¤j¾Ç
+140.127.80.0/24 °ª¶¯®v½d¤j¾Ç
+140.127.192.0/18 ¸q¦u¤j¾Ç
+140.127.0.0/16 °ª¶¯¤j¾Ç
+140.128.61.0/24 ¤¤°êÂåÃĤj¾Ç
+140.128.136.0/24 ¤¤¤sÂå¾Ç¤j¾Ç
+140.128.138.0/24 ¤¤¤sÂå¾Ç¤j¾Ç
+140.128.0.0/16 ªF®ü¤j¾Ç
+140.129.37.0/24 ¤j¦P¤j¾Ç
+140.129.38.0/24 ¤j¦P¤j¾Ç
+140.129.39.0/24 ¤j¦P¤j¾Ç
+140.129.40.0/24 ¤j¦P¤j¾Ç
+140.129.41.0/24 ¤j¦P¤j¾Ç
+140.129.42.0/24 ¤j¦P¤j¾Ç
+140.129.56.0/24 ¶§©ú¤j¾Ç
+140.129.57.0/24 ¶§©ú¤j¾Ç
+140.129.58.0/24 ¶§©ú¤j¾Ç
+140.129.59.0/24 ¶§©ú¤j¾Ç
+140.129.60.0/24 ¶§©ú¤j¾Ç
+140.129.61.0/24 ¶§©ú¤j¾Ç
+140.129.62.0/24 ¶§©ú¤j¾Ç
+140.129.63.0/24 ¶§©ú¤j¾Ç
+140.129.68.0/24 ¶§©ú¤j¾Ç¤úÂåÀ]
+140.129.79.0/24 ¶§©ú¤j¾Ç
+140.129.164.0/24 ¶§©ú¤j¾Ç
+140.129.165.0/24 ¶§©ú¤j¾Ç
+140.130.0.0/16 ¹Å¸q¤j¾Ç
+140.131.30.0/24 ¥xÆWÃÀ³N¤j¾Ç
+140.131.0.0/16 »Ê¶Ç¤j¾Ç
+140.132.0.0/16 ¤¤¥¿²z¤u¾Ç°|
+140.134.0.0/16 ³{¥Ò¤j¾Ç
+140.135.0.0/16 ¤¤­ì¤j¾Ç
+140.136.0.0/16 »²¤¯¤j¾Ç
+140.137.0.0/16 ¤å¤Æ¤j¾Ç
+140.138.0.0/16 ¤¸´¼¤j¾Ç
+163.13.0.0/16 ²H¦¿¤j¾Ç
+163.14.0.0/16 ªF§d¤j¾Ç
+163.25.0.0/16 ªø©°¤j¾Ç
+192.83.191.0/24 ¸q¦u¤j¾Ç
+192.192.35.0/24 ¥x¥_¤j¾Ç
+192.192.36.0/24 ¥x¥_¤j¾Ç
+203.64.3.0/24 °ê¥ßÃÀ³N¾Ç°|
+203.68.128.0/17 ¥x¥_¤j¾Ç
+210.60.180.0/20 ¸q¦u¤j¾Ç
+210.240.172.0/24 ¥xªF¤j¾Ç
+
+61.13.0.0/16 ­^´¶¹F¼eÀW
+61.16.0.0/16 ­^´¶¹F¼eÀW
+61.59.0.0/16 ºØ¤l¼eÀW
+61.30.0.0/16 ¥xÆW©Tºô
+61.31.0.0/16 ¥xÆW©Tºô
+61.64.0.0/16 So-net
+61.70.0.0/16 Giga¶Wºô¸ô
+61.71.0.0/16 Giga¶Wºô¸ô
+61.216.0.0/13 HiNet¼eÀW
+139.175.0.0/16 SeedNet
+163.30.0.0/16 HiNet
+163.31.0.0/16 HiNet
+163.32.0.0/16 HiNet
+168.95.0.0/16 HiNet
+202.178.0.0/16 ªF´Ë¼eÀW
+203.73.0.0/16 ºØ¤l¼eÀW
+203.133.0.0/16 Giga¶Wºô¸ô
+203.203.0.0/16 Giga¼eÀW
+203.204.0.0/16 Giga¼eÀW
+210.58.0.0/16 ªF´Ë¼eÀW
+210.64.0.0/16 ºØ¤l¼eÀW
+210.68.0.0/16 ºØ¤l¼eÀW
+211.78.0.0/16 ¥xÆW©Tºô
+210.85.0.0/16 ªF´Ë¼eÀW
+210.59.53.0/24 °ê¥ß¤¤©M°ª¤¤
+210.60.107.0/24 °ê¥ß¥x¤¤¤@¤¤
+210.201.0.0/16 ¨È¤Ó½u¤W
+210.202.0.0/16 ªF´Ë¼eÀW
+210.208.0.0/16 SayHiNetµL­­¼·±µ
+211.74.0.0/24 ºØ¤l¼eÀW
+218.168.0.0/13 HiNet¼eÀW
+218.32.0.0/16 ³t³Õºô
+211.78.0.0/16 ¥xÆW©Tºô
+218.184.0.0/16 ªF´Ë¼eÀW
+218.187.0.0/16 ¨È¤Ó½u¤W
+219.68.0.0/16 Giga¶Wºô¸ô
+219.80.0.0/16 ¥xÆW©Tºô
+219.81.0.0/16 ¥xÆW©Tºô