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
91120908
Commit
91120908
authored
Feb 05, 2015
by
Chen Wei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store all setname in daemon->dh_ipset_names
parent
73502fdc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
src/dict.c
src/dict.c
+9
-11
src/dnsmasq.h
src/dnsmasq.h
+2
-1
src/option.c
src/option.c
+7
-1
No files found.
src/dict.c
View file @
91120908
...
...
@@ -28,7 +28,6 @@
static
char
buf
[
MAXDNAME
];
/* prototypes */
static
struct
dict_node
*
add_or_lookup_dictnode
(
struct
dict_node
*
node
,
char
*
label
);
static
struct
dict_node
*
lookup_dictnode
(
struct
dict_node
*
node
,
char
*
label
);
static
void
add_dicttree
(
struct
dict_node
*
node
,
struct
dict_node
*
sub
);
static
void
upsize_dicttree
(
struct
dict_node
*
np
);
...
...
@@ -207,8 +206,7 @@ static void add_dicttree (struct dict_node *node, struct dict_node *sub)
/* add a new subnode to node, or update the attr of the subnode with same
* label
* return the subnode */
static
struct
dict_node
*
add_or_lookup_dictnode
(
struct
dict_node
*
node
,
char
*
label
)
struct
dict_node
*
add_or_lookup_dictnode
(
struct
dict_node
*
node
,
char
*
label
)
{
struct
dict_node
*
np
;
...
...
@@ -222,7 +220,6 @@ static struct dict_node *add_or_lookup_dictnode (struct dict_node *node,
add_dicttree
(
node
,
np
);
}
return
np
;
}
...
...
@@ -314,8 +311,8 @@ struct dict_node * match_domain(struct dict_node *root, char *domain)
}
/* look up the whole domain pattern by step over DNS name hierarchy top down.
* for example, if the pattern is c
ache.google.com
, the lookup will start with
*
com, then google, then cache
*/
* for example, if the pattern is c
n.debian.org
, the lookup will start with
*
org, then debian, then cn
*/
struct
dict_node
*
lookup_domain
(
struct
dict_node
*
root
,
char
*
domain
)
{
char
*
labels
[
MAXLABELS
];
...
...
@@ -351,7 +348,7 @@ struct dict_node * lookup_domain (struct dict_node *root, char *domain)
return
i
==
-
1
?
node
:
NULL
;
}
/* add a domain pattern in the form of
google.com
to root
/* add a domain pattern in the form of
debian.org
to root
* return the node with lowest hierarchy */
struct
dict_node
*
add_or_lookup_domain
(
struct
dict_node
*
root
,
char
*
domain
)
{
...
...
@@ -415,10 +412,6 @@ void free_dicttree (struct dict_node *node)
free
(
node
);
}
/* temp area * */
/* only compare addr, source_addr, interface, and flags */
static
inline
int
is_same_server
(
struct
server
*
s1
,
struct
server
*
s2
)
{
...
...
@@ -447,6 +440,11 @@ static inline struct server *serverdup(struct server *src)
return
dst
;
}
/* lookup server by compare addr, source_addr, interface, and flags with
* servers in daemon->servers link list. If no match found, then insert a new
* server
*
* Return the lookup result or the newly created server*/
struct
server
*
lookup_or_install_new_server
(
struct
server
*
serv
)
{
struct
server
*
res
;
...
...
src/dnsmasq.h
View file @
91120908
...
...
@@ -974,7 +974,7 @@ extern struct daemon {
struct
ipsets
*
ipsets
;
struct
dict_node
*
dh_ipsets
;
struct
dict_node
*
dh_ipset
s
_names
;
struct
dict_node
*
dh_ipset_names
;
struct
dict_node
*
dh_special_domains
;
int
log_fac
;
/* log facility */
...
...
@@ -1401,6 +1401,7 @@ int add_to_ipset(const char *setname, const struct all_addr *ipaddr, int flags,
/* dict.c */
struct
dict_node
*
new_dictnode
(
char
*
label
,
int
len
);
struct
dict_node
*
add_or_lookup_dictnode
(
struct
dict_node
*
node
,
char
*
label
);
struct
dict_node
*
lookup_domain
(
struct
dict_node
*
root
,
char
*
domain
);
struct
dict_node
*
match_domain
(
struct
dict_node
*
root
,
char
*
domain
);
struct
dict_node
*
add_or_lookup_domain
(
struct
dict_node
*
root
,
char
*
domain
);
...
...
src/option.c
View file @
91120908
...
...
@@ -2428,12 +2428,16 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
int
sets_count
=
0
;
unhide_metas
(
arg
);
struct
dict_node
*
np
=
NULL
;
struct
dict_node
*
setname
=
NULL
;
struct
ipsets_names
*
obj
;
char
*
domain
=
NULL
;
if
(
daemon
->
dh_ipsets
==
NULL
)
daemon
->
dh_ipsets
=
new_dictnode
(
NULL
,
0
);
if
(
daemon
->
dh_ipset_names
==
NULL
)
daemon
->
dh_ipset_names
=
new_dictnode
(
NULL
,
0
);
if
(
arg
&&
*
arg
==
'/'
)
{
arg
++
;
...
...
@@ -2472,7 +2476,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
do
{
end
=
split
(
arg
);
*
sets_pos
++
=
opt_string_alloc
(
arg
);
// only store one copy of setname in daemon->dh_ipset_names
setname
=
add_or_lookup_dictnode
(
daemon
->
dh_ipset_names
,
arg
);
*
sets_pos
++
=
setname
->
label
;
sets_count
++
;
arg
=
end
;
}
...
...
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