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
Knot DNS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
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
Knot projects
Knot DNS
Commits
77a3e384
Commit
77a3e384
authored
Feb 06, 2014
by
Marek Vavrusa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: renamed knot_serial_compare and added headers
parent
5a99c7ce
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
14 deletions
+17
-14
src/knot/nameserver/ixfr.c
src/knot/nameserver/ixfr.c
+3
-2
src/knot/server/zones.c
src/knot/server/zones.c
+2
-2
src/knot/updates/ddns.c
src/knot/updates/ddns.c
+3
-3
src/knot/updates/xfr-in.c
src/knot/updates/xfr-in.c
+2
-1
src/knot/zone/zone-diff.c
src/knot/zone/zone-diff.c
+3
-2
src/libknot/util/utils.c
src/libknot/util/utils.c
+3
-3
src/libknot/util/utils.h
src/libknot/util/utils.h
+1
-1
No files found.
src/knot/nameserver/ixfr.c
View file @
77a3e384
...
...
@@ -8,6 +8,7 @@
#include "libknot/rdata.h"
#include "knot/server/zones.h"
#include "common/descriptor.h"
#include "libknot/util/utils.h"
/*! \brief Current IXFR answer sections. */
enum
{
...
...
@@ -134,7 +135,7 @@ static int ixfr_load_chsets(knot_changesets_t **chgsets, const zone_t *zone,
const
knot_rrset_t
*
our_soa
=
knot_node_rrset
(
apex
,
KNOT_RRTYPE_SOA
);
uint32_t
serial_to
=
knot_rdata_soa_serial
(
our_soa
);
uint32_t
serial_from
=
knot_rdata_soa_serial
(
their_soa
);
int
ret
=
ns
_serial_compare
(
serial_to
,
serial_from
);
int
ret
=
knot
_serial_compare
(
serial_to
,
serial_from
);
if
(
ret
<=
0
)
{
/* We have older/same age zone. */
return
KNOT_EUPTODATE
;
}
...
...
@@ -390,7 +391,7 @@ int ixfr_process_answer(knot_ns_xfr_t *xfr)
return
KNOT_ERROR
;
}
if
(
ns
_serial_compare
(
if
(
knot
_serial_compare
(
knot_rdata_soa_serial
(
chgsets
->
first_soa
),
knot_rdata_soa_serial
(
zone_soa
))
>
0
)
{
...
...
src/knot/server/zones.c
View file @
77a3e384
...
...
@@ -39,11 +39,11 @@
#include "knot/updates/changesets.h"
#include "knot/updates/ddns.h"
#include "knot/updates/xfr-in.h"
#include "libknot/packet/wire.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/zone-diff.h"
#include "knot/zone/zone.h"
#include "knot/zone/zonedb.h"
#include "libknot/util/utils.h"
/*!
* \brief Apply jitter to time interval.
...
...
@@ -839,7 +839,7 @@ uint32_t zones_next_serial(zone_t *zone)
}
/* If the new serial is 'lower' or equal than the new one, warn the user.*/
if
(
ns
_serial_compare
(
old_serial
,
new_serial
)
>=
0
)
{
if
(
knot
_serial_compare
(
old_serial
,
new_serial
)
>=
0
)
{
log_zone_warning
(
"New serial will be lower than "
"the current one. Old: %"
PRIu32
" "
"new: %"
PRIu32
".
\n
"
,
...
...
src/knot/updates/ddns.c
View file @
77a3e384
...
...
@@ -842,7 +842,7 @@ static int knot_ddns_process_add_soa(knot_node_t *node,
}
/* Check that the serial is indeed larger than the current one*/
assert
(
ns
_serial_compare
(
knot_rdata_soa_serial
(
removed
),
assert
(
knot
_serial_compare
(
knot_rdata_soa_serial
(
removed
),
knot_rdata_soa_serial
(
rr
))
<
0
);
/* 1) Store it to 'changes', together with its RRSIGs. */
...
...
@@ -1798,7 +1798,7 @@ int knot_ddns_process_update(knot_zone_contents_t *zone,
if
(
knot_rrset_type
(
rr
)
==
KNOT_RRTYPE_SOA
&&
(
knot_rrset_class
(
rr
)
==
KNOT_CLASS_NONE
||
knot_rrset_class
(
rr
)
==
KNOT_CLASS_ANY
||
ns
_serial_compare
(
knot_rdata_soa_serial
(
rr
),
||
knot
_serial_compare
(
knot_rdata_soa_serial
(
rr
),
sn
)
<=
0
))
{
// This ignores also SOA removals
dbg_ddns_verb
(
"Ignoring SOA...
\n
"
);
...
...
@@ -1823,7 +1823,7 @@ int knot_ddns_process_update(knot_zone_contents_t *zone,
int64_t
sn_rr
=
knot_rdata_soa_serial
(
rr
);
dbg_ddns_verb
(
"Replacing SOA. Old serial: %"
PRId64
", "
"new serial: %"
PRId64
"
\n
"
,
sn_new
,
sn_rr
);
assert
(
ns
_serial_compare
(
sn_rr
,
sn
)
>
0
);
assert
(
knot
_serial_compare
(
sn_rr
,
sn
)
>
0
);
assert
(
rr_copy
!=
NULL
);
sn_new
=
sn_rr
;
soa_end
=
rr_copy
;
...
...
src/knot/updates/xfr-in.c
View file @
77a3e384
...
...
@@ -38,6 +38,7 @@
#include "common/lists.h"
#include "common/descriptor.h"
#include "libknot/rdata.h"
#include "libknot/util/utils.h"
#define KNOT_NS_TSIG_FREQ 100
...
...
@@ -98,7 +99,7 @@ dbg_xfrin_exec(
return
KNOT_EMALF
;
// maybe some other error
}
return
(
ns
_serial_compare
(
local_serial
,
remote_serial
)
<
0
);
return
(
knot
_serial_compare
(
local_serial
,
remote_serial
)
<
0
);
}
/*----------------------------------------------------------------------------*/
...
...
src/knot/zone/zone-diff.c
View file @
77a3e384
...
...
@@ -24,6 +24,7 @@
#include "knot/zone/zone-diff.h"
#include "common/descriptor.h"
#include "libknot/rdata.h"
#include "libknot/util/utils.h"
struct
zone_diff_param
{
knot_zone_tree_t
*
nodes
;
...
...
@@ -79,7 +80,7 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
dbg_zonediff
(
"zone_diff: load_soas: Got bad SOA.
\n
"
);
}
if
(
ns
_serial_compare
(
soa_serial1
,
soa_serial2
)
==
0
)
{
if
(
knot
_serial_compare
(
soa_serial1
,
soa_serial2
)
==
0
)
{
dbg_zonediff
(
"zone_diff: "
"second zone must have higher serial than the "
"first one. (%"
PRId64
" vs. %"
PRId64
")
\n
"
,
...
...
@@ -87,7 +88,7 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
return
KNOT_ENODIFF
;
}
if
(
ns
_serial_compare
(
soa_serial1
,
soa_serial2
)
>
0
)
{
if
(
knot
_serial_compare
(
soa_serial1
,
soa_serial2
)
>
0
)
{
dbg_zonediff
(
"zone_diff: "
"second zone must have higher serial than the "
"first one. (%"
PRId64
" vs. %"
PRId64
")
\n
"
,
...
...
src/libknot/util/utils.c
View file @
77a3e384
...
...
@@ -55,14 +55,14 @@ knot_lookup_table_t *knot_lookup_by_id(knot_lookup_table_t *table,
/*----------------------------------------------------------------------------*/
static
int32_t
ns_
serial_difference
(
uint32_t
s1
,
uint32_t
s2
)
static
int32_t
serial_difference
(
uint32_t
s1
,
uint32_t
s2
)
{
return
(((
int64_t
)
s1
-
s2
)
%
((
int64_t
)
1
<<
32
));
}
int
ns
_serial_compare
(
uint32_t
s1
,
uint32_t
s2
)
int
knot
_serial_compare
(
uint32_t
s1
,
uint32_t
s2
)
{
int32_t
diff
=
ns_
serial_difference
(
s1
,
s2
);
int32_t
diff
=
serial_difference
(
s1
,
s2
);
return
(
s1
==
s2
)
/* s1 equal to s2 */
?
0
:
((
diff
>=
1
&&
diff
<
((
uint32_t
)
1
<<
31
))
...
...
src/libknot/util/utils.h
View file @
77a3e384
...
...
@@ -182,7 +182,7 @@ static inline void knot_wire_write_u64(uint8_t *pos, uint64_t data)
* \retval > 0 if s1 is larger than s2.
* \retval == 0 if s1 is equal to s2.
*/
int
ns
_serial_compare
(
uint32_t
s1
,
uint32_t
s2
);
int
knot
_serial_compare
(
uint32_t
s1
,
uint32_t
s2
);
#endif
/* _KNOT_UTILS_H_ */
...
...
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