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
ed8b68ad
Commit
ed8b68ad
authored
Dec 21, 2012
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify and fix RA lifetime calculation.
parent
bad7b875
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
36 deletions
+15
-36
src/dhcp6.c
src/dhcp6.c
+2
-13
src/dnsmasq.h
src/dnsmasq.h
+0
-1
src/radv.c
src/radv.c
+13
-22
No files found.
src/dhcp6.c
View file @
ed8b68ad
...
...
@@ -488,6 +488,8 @@ static int construct_worker(struct in6_addr *local, int prefix,
(
void
)
scope
;
(
void
)
flags
;
(
void
)
valid
;
(
void
)
preferred
;
struct
cparam
*
param
=
vparam
;
...
...
@@ -549,19 +551,6 @@ static int construct_worker(struct in6_addr *local, int prefix,
log_context
(
AF_INET6
,
context
);
}
if
(
context
)
{
if
(
valid
==
-
1
)
context
->
valid
=
valid
;
else
context
->
valid
=
valid
+
param
->
now
;
if
(
preferred
==
-
1
)
context
->
preferred
=
preferred
;
else
context
->
preferred
=
preferred
+
param
->
now
;
}
}
return
1
;
...
...
src/dnsmasq.h
View file @
ed8b68ad
...
...
@@ -685,7 +685,6 @@ struct dhcp_context {
int
prefix
,
if_index
;
time_t
ra_time
,
ra_short_period_start
;
char
*
template_interface
;
int
valid
,
preferred
;
/* times from address for constructed contexts */
#endif
int
flags
;
struct
dhcp_netid
netid
,
*
filter
;
...
...
src/radv.c
View file @
ed8b68ad
...
...
@@ -331,10 +331,7 @@ static int add_prefixes(struct in6_addr *local, int prefix,
struct
ra_param
*
param
=
vparam
;
(
void
)
scope
;
/* warning */
(
void
)
flags
;
(
void
)
preferred
;
(
void
)
valid
;
if
(
if_index
==
param
->
ind
)
{
if
(
IN6_IS_ADDR_LINKLOCAL
(
local
))
...
...
@@ -345,9 +342,7 @@ static int add_prefixes(struct in6_addr *local, int prefix,
int
do_prefix
=
0
;
int
do_slaac
=
0
;
int
deprecate
=
0
;
int
found_constructed
=
0
;
unsigned
int
time
=
0xffffffff
;
int
calc_valid
=
0
,
calc_preferred
=
0
;
struct
dhcp_context
*
context
;
for
(
context
=
daemon
->
dhcp6
;
context
;
context
=
context
->
next
)
...
...
@@ -376,17 +371,6 @@ static int add_prefixes(struct in6_addr *local, int prefix,
param
->
other
=
1
;
}
if
(
context
->
flags
&
CONTEXT_CONSTRUCTED
)
{
found_constructed
=
1
;
calc_valid
=
context
->
valid
;
calc_preferred
=
context
->
preferred
;
if
(
context
->
valid
!=
-
1
)
calc_valid
-=
(
int
)
param
->
now
;
if
(
context
->
preferred
!=
-
1
)
calc_preferred
-=
(
int
)
param
->
now
;
}
/* find floor time */
if
(
time
>
context
->
lease_time
)
time
=
context
->
lease_time
;
...
...
@@ -417,10 +401,17 @@ static int add_prefixes(struct in6_addr *local, int prefix,
param
->
found_context
=
1
;
}
if
(
!
found_constructed
)
/* configured time is ceiling */
if
((
unsigned
int
)
valid
>
time
)
valid
=
time
;
if
((
flags
&
IFACE_DEPRECATED
)
||
deprecate
)
preferred
=
0
;
else
{
calc_valid
=
time
;
calc_preferred
=
deprecate
?
0
:
time
;
/* configured time is ceiling */
if
((
unsigned
int
)
preferred
>
time
)
preferred
=
time
;
}
if
(
do_prefix
)
...
...
@@ -441,8 +432,8 @@ static int add_prefixes(struct in6_addr *local, int prefix,
opt
->
prefix_len
=
prefix
;
/* autonomous only if we're not doing dhcp, always set "on-link" */
opt
->
flags
=
do_slaac
?
0xC0
:
0x80
;
opt
->
valid_lifetime
=
htonl
(
calc_
valid
);
opt
->
preferred_lifetime
=
htonl
(
calc_
preferred
);
opt
->
valid_lifetime
=
htonl
(
valid
);
opt
->
preferred_lifetime
=
htonl
(
preferred
);
opt
->
reserved
=
0
;
opt
->
prefix
=
*
local
;
...
...
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