Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
nexedi
libloc
Commits
9c1e2943
Commit
9c1e2943
authored
Mar 07, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address: Rename in6_addr_cmp into loc_address_cmp
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
0b1fef38
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
src/database.c
src/database.c
+3
-3
src/libloc/address.h
src/libloc/address.h
+2
-2
src/network-list.c
src/network-list.c
+2
-2
src/network.c
src/network.c
+5
-5
No files found.
src/database.c
View file @
9c1e2943
...
...
@@ -1466,7 +1466,7 @@ static int __loc_database_enumerator_next_bogon(
gap_end
=
address_decrement
(
loc_network_get_first_address
(
network
));
// There is a gap
if
(
in6_addr
_cmp
(
gap_start
,
&
gap_end
)
<
0
)
{
if
(
loc_address
_cmp
(
gap_start
,
&
gap_end
)
<
0
)
{
r
=
loc_network_list_summarize
(
enumerator
->
ctx
,
gap_start
,
&
gap_end
,
&
enumerator
->
stack
);
if
(
r
)
{
...
...
@@ -1496,7 +1496,7 @@ FINISH:
if
(
r
)
return
r
;
if
(
in6_addr
_cmp
(
&
enumerator
->
gap6_start
,
&
gap_end
)
<
0
)
{
if
(
loc_address
_cmp
(
&
enumerator
->
gap6_start
,
&
gap_end
)
<
0
)
{
r
=
loc_network_list_summarize
(
enumerator
->
ctx
,
&
enumerator
->
gap6_start
,
&
gap_end
,
&
enumerator
->
stack
);
if
(
r
)
...
...
@@ -1512,7 +1512,7 @@ FINISH:
if
(
r
)
return
r
;
if
(
in6_addr
_cmp
(
&
enumerator
->
gap4_start
,
&
gap_end
)
<
0
)
{
if
(
loc_address
_cmp
(
&
enumerator
->
gap4_start
,
&
gap_end
)
<
0
)
{
r
=
loc_network_list_summarize
(
enumerator
->
ctx
,
&
enumerator
->
gap4_start
,
&
gap_end
,
&
enumerator
->
stack
);
if
(
r
)
...
...
src/libloc/address.h
View file @
9c1e2943
...
...
@@ -33,7 +33,7 @@ static inline int loc_address_family(const struct in6_addr* address) {
return
AF_INET6
;
}
static
inline
int
in6_addr
_cmp
(
const
struct
in6_addr
*
a1
,
const
struct
in6_addr
*
a2
)
{
static
inline
int
loc_address
_cmp
(
const
struct
in6_addr
*
a1
,
const
struct
in6_addr
*
a2
)
{
for
(
unsigned
int
i
=
0
;
i
<
16
;
i
++
)
{
if
(
a1
->
s6_addr
[
i
]
>
a2
->
s6_addr
[
i
])
return
1
;
...
...
@@ -278,7 +278,7 @@ static inline int loc_address_all_zeroes(const struct in6_addr* address) {
if
(
r
)
return
r
;
if
(
in6_addr
_cmp
(
address
,
&
all_zeroes
)
==
0
)
if
(
loc_address
_cmp
(
address
,
&
all_zeroes
)
==
0
)
return
1
;
return
0
;
...
...
src/network-list.c
View file @
9c1e2943
...
...
@@ -319,7 +319,7 @@ int loc_network_list_summarize(struct loc_ctx* ctx,
}
// Check if the last address is larger than the first address
if
(
in6_addr
_cmp
(
first
,
last
)
>=
0
)
{
if
(
loc_address
_cmp
(
first
,
last
)
>=
0
)
{
ERROR
(
ctx
,
"The first address must be smaller than the last address
\n
"
);
errno
=
EINVAL
;
return
1
;
...
...
@@ -330,7 +330,7 @@ int loc_network_list_summarize(struct loc_ctx* ctx,
const
int
family_bit_length
=
loc_address_family_bit_length
(
family1
);
while
(
in6_addr
_cmp
(
&
start
,
last
)
<=
0
)
{
while
(
loc_address
_cmp
(
&
start
,
last
)
<=
0
)
{
struct
in6_addr
num
;
int
bits1
;
...
...
src/network.c
View file @
9c1e2943
...
...
@@ -295,11 +295,11 @@ LOC_EXPORT char* loc_network_format_last_address(struct loc_network* network) {
LOC_EXPORT
int
loc_network_matches_address
(
struct
loc_network
*
network
,
const
struct
in6_addr
*
address
)
{
// Address must be larger than the start address
if
(
in6_addr
_cmp
(
&
network
->
first_address
,
address
)
>
0
)
if
(
loc_address
_cmp
(
&
network
->
first_address
,
address
)
>
0
)
return
0
;
// Address must be smaller than the last address
if
(
in6_addr
_cmp
(
&
network
->
last_address
,
address
)
<
0
)
if
(
loc_address
_cmp
(
&
network
->
last_address
,
address
)
<
0
)
return
0
;
// The address is inside this network
...
...
@@ -365,7 +365,7 @@ LOC_EXPORT int loc_network_set_flag(struct loc_network* network, uint32_t flag)
LOC_EXPORT
int
loc_network_cmp
(
struct
loc_network
*
self
,
struct
loc_network
*
other
)
{
// Compare address
int
r
=
in6_addr
_cmp
(
&
self
->
first_address
,
&
other
->
first_address
);
int
r
=
loc_address
_cmp
(
&
self
->
first_address
,
&
other
->
first_address
);
if
(
r
)
return
r
;
...
...
@@ -404,12 +404,12 @@ LOC_EXPORT int loc_network_is_subnet(struct loc_network* self, struct loc_networ
// If the start address of the other network is smaller than this network,
// it cannot be a subnet.
if
(
in6_addr
_cmp
(
&
self
->
first_address
,
&
other
->
first_address
)
>
0
)
if
(
loc_address
_cmp
(
&
self
->
first_address
,
&
other
->
first_address
)
>
0
)
return
0
;
// If the end address of the other network is greater than this network,
// it cannot be a subnet.
if
(
in6_addr
_cmp
(
&
self
->
last_address
,
&
other
->
last_address
)
<
0
)
if
(
loc_address
_cmp
(
&
self
->
last_address
,
&
other
->
last_address
)
<
0
)
return
0
;
return
1
;
...
...
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