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
17e3d8fd
Commit
17e3d8fd
authored
Mar 09, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address: Set default prefix if none is given
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
95b6a8e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
src/address.c
src/address.c
+13
-2
No files found.
src/address.c
View file @
17e3d8fd
...
@@ -138,11 +138,22 @@ int loc_address_parse(struct in6_addr* address, unsigned int* prefix, const char
...
@@ -138,11 +138,22 @@ int loc_address_parse(struct in6_addr* address, unsigned int* prefix, const char
// Did the user request a prefix?
// Did the user request a prefix?
if
(
prefix
)
{
if
(
prefix
)
{
// Set the prefix to the default value
// Set the prefix to the default value
*
prefix
=
loc_address_family_bit_length
(
family
);
const
unsigned
int
max_
prefix
=
loc_address_family_bit_length
(
family
);
// Parse the actual string
// Parse the actual string
if
(
p
)
if
(
p
)
{
*
prefix
=
strtol
(
p
,
NULL
,
10
);
*
prefix
=
strtol
(
p
,
NULL
,
10
);
// Check if prefix is within bounds
if
(
*
prefix
>
max_prefix
)
{
errno
=
EINVAL
;
return
1
;
}
// If the string didn't contain a prefix, we set the maximum
}
else
{
*
prefix
=
max_prefix
;
}
}
}
return
0
;
return
0
;
...
...
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