Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Dnsmasq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Dnsmasq
Commits
c5b2cbfe
Commit
c5b2cbfe
authored
Feb 08, 2015
by
Chen Wei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update doc
parent
1291b335
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
22 deletions
+49
-22
README.md
README.md
+4
-4
src/dict.c
src/dict.c
+45
-18
No files found.
README.md
View file @
c5b2cbfe
...
@@ -20,21 +20,21 @@ of --ipsets and --server entries.
...
@@ -20,21 +20,21 @@ of --ipsets and --server entries.
The lookup steps over domain name hierarchy top-down. All labels are stored in
The lookup steps over domain name hierarchy top-down. All labels are stored in
open addressing hash tables. Sub-level labels that belong to different parent
open addressing hash tables. Sub-level labels that belong to different parent
nodes are stored separately. e.g. yahoo, google, and twitter are in one hash
nodes are stored separately. e.g. yahoo, google, and twitter are in one hash
table, while debian and freebsd are in another.
table, while debian and freebsd are in another.
The hash table size is power of 2, two hash functions are used to compute hash
The hash table size is power of 2, two hash functions are used to compute hash
bucket. For locating a particular label from hash table, two hash values are
bucket. For locating a particular label from hash table, two hash values are
compared first, only if they are match, should the more expensive string
compared first, only if they are match, should the more expensive string
comparison be used to confirm the search.
comparison be used to confirm the search.
The search should take constant time regardless the size of --ipset and --server
The search should take constant time regardless the size of --ipset and --server
rules.
rules.
### Issues
### Issues
*
`tcp_request`
not working
[
Contact me
](
mailto:
weichen302@gmail.com)
[
Contact me
](
mailto:
weichen302@gmail.com)
src/dict.c
View file @
c5b2cbfe
/* dict.c is Copyright (c) 2015 Chen Wei <weichen302@gmail.com>
/* dict.c is Copyright (c) 2015 Chen Wei <weichen302@gmail.com>
Use a dictionary like structure to store config options for fast lookup
Use cascade of open addressing hash tables to store config options that
involve domain names.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
root
the Free Software Foundation; version 2 dated June, 1991, or
|
(at your option) version 3 dated 29 June, 2007.
+---------------------+
com org
This program is distributed in the hope that it will be useful,
| |
but WITHOUT ANY WARRANTY; without even the implied warranty of
+------------------+ +-------------+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
yahoo google twitter debian freebsd
GNU General Public License for more details.
| | | |
www mail +---------+ www
You should have received a copy of the GNU General Public License
cn jp uk us
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
ftp
The lookup steps over domain name hierarchy top-down. All labels are stored
in open addressing hash tables. Sub-level labels that belong to different
parent nodes are stored separately. e.g. yahoo, google, and twitter are in
one hash table, while debian and freebsd are in another.
The hash table size is power of 2, two hash functions are used to compute
hash bucket. For locating a particular label from hash table, two hash
values are compared first, only if they are match, should the more
expensive string comparison be used to confirm the search.
The search should take constant time regardless the size of --ipset and
--server rules.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991, or
(at your option) version 3 dated 29 June, 2007.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "dnsmasq.h"
#include "dnsmasq.h"
...
@@ -21,7 +49,6 @@
...
@@ -21,7 +49,6 @@
#define OPEN_ADDRESSING_MAXJUMP 7
/* no reason, just like 7 */
#define OPEN_ADDRESSING_MAXJUMP 7
/* no reason, just like 7 */
#define OPEN_ADDRESSING_DEFAULT_SLOT 4
#define OPEN_ADDRESSING_DEFAULT_SLOT 4
#define FNV1_32A_INIT ((uint32_t)0x811c9dc5)
#define FNV1_32A_INIT ((uint32_t)0x811c9dc5)
#define FNV_32_PRIME ((uint32_t)0x01000193)
#define max(A, B) ((A) > (B) ? (A) : (B))
#define max(A, B) ((A) > (B) ? (A) : (B))
static
char
buf
[
MAXDNAME
];
static
char
buf
[
MAXDNAME
];
...
@@ -497,7 +524,7 @@ void print_server_special_domains (struct dict_node *node,
...
@@ -497,7 +524,7 @@ void print_server_special_domains (struct dict_node *node,
}
}
buf
[
strlen
(
buf
)
-
1
]
=
'\0'
;
buf
[
strlen
(
buf
)
-
1
]
=
'\0'
;
port
=
prettyprint_addr
(
&
obj
->
server
->
addr
,
ip_buf
);
port
=
prettyprint_addr
(
&
obj
->
server
->
addr
,
ip_buf
);
my_syslog
(
LOG_INFO
,
_
(
"using nameserver %s#%d for domain %s"
),
my_syslog
(
LOG_INFO
,
_
(
"using nameserver %s#%d for domain %s"
),
ip_buf
,
port
,
buf
);
ip_buf
,
port
,
buf
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment