Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
Knot Resolver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
Tomas Krizek
Knot Resolver
Commits
647803b3
Commit
647803b3
authored
Nov 30, 2018
by
Vladimír Čunát
Committed by
Tomas Krizek
Jan 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
treewide nitpick: fix -Wshadow
None of these seemed to be errors, but it seems better to clear these.
parent
d939dd33
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
88 additions
and
82 deletions
+88
-82
daemon/network.c
daemon/network.c
+6
-6
daemon/tls.c
daemon/tls.c
+2
-2
daemon/tls_ephemeral_credentials.c
daemon/tls_ephemeral_credentials.c
+6
-6
daemon/zimport.c
daemon/zimport.c
+21
-21
lib/cache/nsec3.c
lib/cache/nsec3.c
+4
-2
lib/cache/peek.c
lib/cache/peek.c
+9
-7
lib/dnssec.c
lib/dnssec.c
+5
-5
lib/dnssec/nsec3.c
lib/dnssec/nsec3.c
+4
-4
lib/zonecut.c
lib/zonecut.c
+3
-3
modules/hints/hints.c
modules/hints/hints.c
+20
-20
tests/test_queue.c
tests/test_queue.c
+8
-6
No files found.
daemon/network.c
View file @
647803b3
...
...
@@ -26,12 +26,12 @@
#if (__linux__ && SO_REUSEPORT)
#define handle_init(type, loop, handle, family) do { \
uv_ ## type ## _init_ex((loop), (handle), (family)); \
uv_os_fd_t fd = 0; \
if (uv_fileno((uv_handle_t *)(handle), &fd) == 0) { \
int on = 1; \
int
ret = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(
on)); \
if (ret) { \
return ret; \
uv_os_fd_t
hi_
fd = 0; \
if (uv_fileno((uv_handle_t *)(handle), &
hi_
fd) == 0) { \
int
hi_
on = 1; \
int
hi_ret = setsockopt(hi_fd, SOL_SOCKET, SO_REUSEPORT, &hi_on, sizeof(hi_
on)); \
if (
hi_
ret) { \
return
hi_
ret; \
} \
} \
} while (0)
...
...
daemon/tls.c
View file @
647803b3
...
...
@@ -1079,8 +1079,8 @@ static int client_verify_certificate(gnutls_session_t tls_session)
}
DEBUG_MSG
(
"[tls_client] received pin : %s
\n
"
,
cert_pin
);
for
(
size_t
i
=
0
;
i
<
ctx
->
params
->
pins
.
len
;
++
i
)
{
const
char
*
pin
=
ctx
->
params
->
pins
.
at
[
i
];
for
(
size_t
j
=
0
;
j
<
ctx
->
params
->
pins
.
len
;
++
j
)
{
const
char
*
pin
=
ctx
->
params
->
pins
.
at
[
j
];
bool
match
=
(
strcmp
(
cert_pin
,
pin
)
==
0
);
DEBUG_MSG
(
"[tls_client] configured pin: %s matches? %s
\n
"
,
pin
,
match
?
"yes"
:
"no"
);
...
...
daemon/tls_ephemeral_credentials.c
View file @
647803b3
...
...
@@ -35,15 +35,15 @@
* lock based on a filename. At the moment it's POSIX-only, but it
* should be abstract enough of an interface to make an implementation
* for non-posix systems if anyone cares. */
typedef
int
lock
;
static
bool
_lock_is_invalid
(
lock
lock
)
typedef
int
lock
_t
;
static
bool
_lock_is_invalid
(
lock
_t
lock
)
{
return
lock
==
-
1
;
}
/* a blocking lock on a given filename */
static
lock
_lock_filename
(
const
char
*
fname
)
static
lock
_t
_lock_filename
(
const
char
*
fname
)
{
lock
lockfd
=
open
(
fname
,
O_RDONLY
|
O_CREAT
,
0400
);
lock
_t
lockfd
=
open
(
fname
,
O_RDONLY
|
O_CREAT
,
0400
);
if
(
lockfd
==
-
1
)
return
lockfd
;
/* this should be a non-blocking lock */
...
...
@@ -53,7 +53,7 @@ static lock _lock_filename(const char *fname)
}
return
lockfd
;
/* for cleanup later */
}
static
void
_lock_unlock
(
lock
*
lock
,
const
char
*
fname
)
static
void
_lock_unlock
(
lock
_t
*
lock
,
const
char
*
fname
)
{
if
(
lock
&&
!
_lock_is_invalid
(
*
lock
))
{
flock
(
*
lock
,
LOCK_UN
);
...
...
@@ -68,7 +68,7 @@ static gnutls_x509_privkey_t get_ephemeral_privkey ()
gnutls_x509_privkey_t
privkey
=
NULL
;
int
err
;
gnutls_datum_t
data
=
{
.
data
=
NULL
,
.
size
=
0
};
lock
lock
;
lock
_t
lock
;
int
datafd
=
-
1
;
/* Take a lock to ensure that two daemons started concurrently
...
...
daemon/zimport.c
View file @
647803b3
...
...
@@ -501,14 +501,14 @@ static void zi_zone_process(uv_timer_t* handle)
goto
finish
;
}
knot_rrset_t
*
rr
=
map_get
(
&
z_import
->
rrset_indexed
,
key
);
if
(
!
rr
)
{
knot_rrset_t
*
rr
_key
=
map_get
(
&
z_import
->
rrset_indexed
,
key
);
if
(
!
rr
_key
)
{
/* DNSKEY MUST be here. If not found - fail. */
kr_log_error
(
"[zimport] DNSKEY not found for `%s`, fail
\n
"
,
zone_name_str
);
failed
=
1
;
goto
finish
;
}
z_import
->
key
=
rr
;
z_import
->
key
=
rr
_key
;
VERBOSE_MSG
(
NULL
,
"started: zone: '%s'
\n
"
,
zone_name_str
);
...
...
@@ -516,16 +516,16 @@ static void zi_zone_process(uv_timer_t* handle)
/* Import DNSKEY at first step. If any validation problems will appear,
* cancel import of whole zone. */
KR_DNAME_GET_STR
(
qname_str
,
rr
->
owner
);
KR_RRTYPE_GET_STR
(
type_str
,
rr
->
type
);
KR_DNAME_GET_STR
(
kname_str
,
rr_key
->
owner
);
KR_RRTYPE_GET_STR
(
ktype_str
,
rr_key
->
type
);
VERBOSE_MSG
(
NULL
,
"importing:
q
name: '%s' type: '%s'
\n
"
,
qname_str
,
type_str
);
VERBOSE_MSG
(
NULL
,
"importing: name: '%s' type: '%s'
\n
"
,
kname_str
,
k
type_str
);
int
res
=
zi_rrset_import
(
z_import
,
rr
);
int
res
=
zi_rrset_import
(
z_import
,
rr
_key
);
if
(
res
!=
0
)
{
VERBOSE_MSG
(
NULL
,
"import failed: qname: '%s' type: '%s'
\n
"
,
qname_str
,
type_str
);
kname_str
,
k
type_str
);
failed
=
1
;
goto
finish
;
}
...
...
@@ -538,16 +538,16 @@ static void zi_zone_process(uv_timer_t* handle)
continue
;
}
KR_DNAME_GET_STR
(
q
name_str
,
rr
->
owner
);
KR_DNAME_GET_STR
(
name_str
,
rr
->
owner
);
KR_RRTYPE_GET_STR
(
type_str
,
rr
->
type
);
VERBOSE_MSG
(
NULL
,
"importing:
q
name: '%s' type: '%s'
\n
"
,
q
name_str
,
type_str
);
int
re
s
=
zi_rrset_import
(
z_import
,
rr
);
if
(
re
s
==
0
)
{
VERBOSE_MSG
(
NULL
,
"importing: name: '%s' type: '%s'
\n
"
,
name_str
,
type_str
);
int
re
t
=
zi_rrset_import
(
z_import
,
rr
);
if
(
re
t
==
0
)
{
++
ns_imported
;
}
else
{
VERBOSE_MSG
(
NULL
,
"import failed:
q
name: '%s' type: '%s'
\n
"
,
q
name_str
,
type_str
);
VERBOSE_MSG
(
NULL
,
"import failed: name: '%s' type: '%s'
\n
"
,
name_str
,
type_str
);
++
failed
;
}
z_import
->
rrset_sorted
.
at
[
i
]
=
NULL
;
...
...
@@ -570,16 +570,16 @@ static void zi_zone_process(uv_timer_t* handle)
continue
;
}
KR_DNAME_GET_STR
(
q
name_str
,
rr
->
owner
);
KR_DNAME_GET_STR
(
name_str
,
rr
->
owner
);
KR_RRTYPE_GET_STR
(
type_str
,
rr
->
type
);
VERBOSE_MSG
(
NULL
,
"importing:
q
name: '%s' type: '%s'
\n
"
,
q
name_str
,
type_str
);
VERBOSE_MSG
(
NULL
,
"importing: name: '%s' type: '%s'
\n
"
,
name_str
,
type_str
);
res
=
zi_rrset_import
(
z_import
,
rr
);
if
(
res
==
0
)
{
++
other_imported
;
}
else
{
VERBOSE_MSG
(
NULL
,
"import failed:
q
name: '%s' type: '%s'
\n
"
,
q
name_str
,
type_str
);
VERBOSE_MSG
(
NULL
,
"import failed: name: '%s' type: '%s'
\n
"
,
name_str
,
type_str
);
++
failed
;
}
}
...
...
lib/cache/nsec3.c
View file @
647803b3
...
...
@@ -339,8 +339,10 @@ int nsec3_encloser(struct key *k, struct answer *ans,
/* Basic checks OK -> materialize data, cleaning any previous
* records on that answer index (unsuccessful attempts). */
knot_dname_t
owner
[
KNOT_DNAME_MAXLEN
];
int
ret
=
dname_wire_reconstruct
(
owner
,
k
->
zname
,
hash_low
);
if
(
unlikely
(
ret
))
continue
;
{
int
ret
=
dname_wire_reconstruct
(
owner
,
k
->
zname
,
hash_low
);
if
(
unlikely
(
ret
))
continue
;
}
const
int
ans_id
=
(
exact_match
&&
name_labels
+
1
==
last_nxproven_labels
)
?
AR_CPE
:
AR_NSEC
;
{
...
...
lib/cache/peek.c
View file @
647803b3
...
...
@@ -133,12 +133,14 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
/**** 1. find the name or the closest (available) zone, not considering wildcards
**** 1a. exact name+type match (can be negative answer in insecure zones) */
knot_db_val_t
key
=
key_exact_type_maypkt
(
k
,
qry
->
stype
);
knot_db_val_t
val
=
{
NULL
,
0
};
ret
=
cache_op
(
cache
,
read
,
&
key
,
&
val
,
1
);
if
(
!
ret
)
{
/* found an entry: test conditions, materialize into pkt, etc. */
ret
=
found_exact_hit
(
ctx
,
pkt
,
val
,
lowest_rank
);
{
knot_db_val_t
key
=
key_exact_type_maypkt
(
k
,
qry
->
stype
);
knot_db_val_t
val
=
{
NULL
,
0
};
ret
=
cache_op
(
cache
,
read
,
&
key
,
&
val
,
1
);
if
(
!
ret
)
{
/* found an entry: test conditions, materialize into pkt, etc. */
ret
=
found_exact_hit
(
ctx
,
pkt
,
val
,
lowest_rank
);
}
}
if
(
ret
&&
ret
!=
-
abs
(
ENOENT
))
{
VERBOSE_MSG
(
qry
,
"=> exact hit error: %d %s
\n
"
,
ret
,
kr_strerror
(
ret
));
...
...
@@ -252,7 +254,7 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
/* Assuming k->buf still starts with zone's prefix,
* look up the SOA in cache. */
k
->
buf
[
0
]
=
k
->
zlf_len
;
key
=
key_exact_type
(
k
,
KNOT_RRTYPE_SOA
);
k
not_db_val_t
k
ey
=
key_exact_type
(
k
,
KNOT_RRTYPE_SOA
);
knot_db_val_t
val
=
{
NULL
,
0
};
ret
=
cache_op
(
cache
,
read
,
&
key
,
&
val
,
1
);
const
struct
entry_h
*
eh
;
...
...
lib/dnssec.c
View file @
647803b3
...
...
@@ -219,14 +219,14 @@ static int kr_rrset_validate_with_key(kr_rrset_validation_ctx_t *vctx,
continue
;
}
vctx
->
rrs_counters
.
matching_name_type
++
;
int
ret
=
validate_rrsig_rr
(
&
val_flgs
,
covered_labels
,
rdata_j
,
int
ret
v
=
validate_rrsig_rr
(
&
val_flgs
,
covered_labels
,
rdata_j
,
keys
->
owner
,
key_rdata
,
keytag
,
zone_name
,
timestamp
,
vctx
);
if
(
ret
==
kr_error
(
EAGAIN
))
{
if
(
ret
v
==
kr_error
(
EAGAIN
))
{
kr_dnssec_key_free
(
&
created_key
);
vctx
->
result
=
ret
;
return
ret
;
}
else
if
(
ret
!=
0
)
{
vctx
->
result
=
ret
v
;
return
ret
v
;
}
else
if
(
ret
v
!=
0
)
{
continue
;
}
if
(
val_flgs
&
FLG_WILDCARD_EXPANSION
)
{
...
...
lib/dnssec/nsec3.c
View file @
647803b3
...
...
@@ -418,16 +418,16 @@ static int closest_encloser_proof(const knot_pkt_t *pkt,
next_closer
=
knot_wire_next_label
(
next_closer
,
NULL
);
}
for
(
unsigned
j
=
0
;
j
<
sec
->
count
;
++
j
)
{
const
knot_rrset_t
*
rrset
=
knot_pkt_rr
(
sec
,
j
);
if
(
rrset
->
type
!=
KNOT_RRTYPE_NSEC3
)
{
const
knot_rrset_t
*
rrset
_j
=
knot_pkt_rr
(
sec
,
j
);
if
(
rrset
_j
->
type
!=
KNOT_RRTYPE_NSEC3
)
{
continue
;
}
ret
=
covers_name
(
&
flags
,
rrset
,
next_closer
);
ret
=
covers_name
(
&
flags
,
rrset
_j
,
next_closer
);
if
(
ret
!=
0
)
{
return
ret
;
}
if
(
flags
&
FLG_NAME_COVERED
)
{
covering
=
rrset
;
covering
=
rrset
_j
;
break
;
}
}
...
...
lib/zonecut.c
View file @
647803b3
...
...
@@ -461,9 +461,9 @@ static int fetch_ns(struct kr_context *ctx, struct kr_zonecut *cut,
||
(
aqpf
->
AWAIT_IPV6
&&
aq
->
stype
==
KNOT_RRTYPE_AAAA
))
{
if
(
knot_dname_in_bailiwick
(
ns_name
,
aq
->
parent
->
zone_cut
.
name
))
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
if
(
infos
[
i
]
==
AI_UNKNOWN
)
infos
[
i
]
=
AI_CYCLED
;
for
(
int
j
=
0
;
j
<
2
;
++
j
)
if
(
infos
[
j
]
==
AI_UNKNOWN
)
infos
[
j
]
=
AI_CYCLED
;
break
;
}
}
else
{
...
...
modules/hints/hints.c
View file @
647803b3
...
...
@@ -285,29 +285,29 @@ static int del_pair(struct hints_data *data, const char *name, const char *addr)
kr_zonecut_del
(
&
data
->
reverse_hints
,
reverse_key
,
key
,
key_len
);
return
kr_zonecut_del
(
&
data
->
hints
,
key
,
kr_inaddr
(
&
ia
.
ip
),
kr_inaddr_len
(
&
ia
.
ip
));
}
else
{
/* Find a matching name */
pack_t
*
addr_set
=
kr_zonecut_find
(
&
data
->
hints
,
key
);
if
(
!
addr_set
||
addr_set
->
len
==
0
)
{
return
kr_error
(
ENOENT
);
}
}
/* We're removing everything for the name;
* first find the name's pack */
pack_t
*
addr_set
=
kr_zonecut_find
(
&
data
->
hints
,
key
);
if
(
!
addr_set
||
addr_set
->
len
==
0
)
{
return
kr_error
(
ENOENT
);
}
/* Remove address records in hints from reverse_hints. */
uint8_t
*
addr
=
pack_head
(
*
addr_set
);
while
(
addr
!=
pack_tail
(
*
addr_set
))
{
void
*
addr_val
=
pack_obj_val
(
addr
);
int
family
=
pack_obj_len
(
addr
)
==
kr_family_len
(
AF_INET
)
?
AF_INET
:
AF_INET6
;
const
knot_dname_t
*
reverse_key
=
raw_addr2reverse
(
addr_val
,
family
);
if
(
reverse_key
!=
NULL
)
{
kr_zonecut_del
(
&
data
->
reverse_hints
,
reverse_key
,
key
,
key_len
);
}
addr
=
pack_obj_next
(
addr
);
/* Remove address records in hints from reverse_hints. */
for
(
uint8_t
*
a
=
pack_head
(
*
addr_set
);
a
!=
pack_tail
(
*
addr_set
);
a
=
pack_obj_next
(
a
))
{
void
*
addr_val
=
pack_obj_val
(
a
);
int
family
=
pack_obj_len
(
a
)
==
kr_family_len
(
AF_INET
)
?
AF_INET
:
AF_INET6
;
const
knot_dname_t
*
reverse_key
=
raw_addr2reverse
(
addr_val
,
family
);
if
(
reverse_key
!=
NULL
)
{
kr_zonecut_del
(
&
data
->
reverse_hints
,
reverse_key
,
key
,
key_len
);
}
/* Remove the whole name. */
return
kr_zonecut_del_all
(
&
data
->
hints
,
key
);
}
/* Remove the whole name. */
return
kr_zonecut_del_all
(
&
data
->
hints
,
key
);
}
static
int
load_file
(
struct
kr_module
*
module
,
const
char
*
path
)
...
...
tests/test_queue.c
View file @
647803b3
...
...
@@ -42,13 +42,15 @@ static void test_int(void **state_)
assert_int_equal
(
queue_len
(
q
),
3
+
99
);
/* Basic iterator test. */
int
i
=
0
;
for
(
queue_int_it_t
it
=
queue_it_begin
(
q
);
!
queue_it_finished
(
it
);
queue_it_next
(
it
))
{
++
queue_it_val
(
it
);
++
i
;
{
int
i
=
0
;
for
(
queue_int_it_t
it
=
queue_it_begin
(
q
);
!
queue_it_finished
(
it
);
queue_it_next
(
it
))
{
++
queue_it_val
(
it
);
++
i
;
}
assert_int_equal
(
queue_len
(
q
),
i
);
}
assert_int_equal
(
queue_len
(
q
),
i
);
queue_deinit
(
q
);
queue_init
(
q
);
...
...
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