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
3bc0d932
Commit
3bc0d932
authored
Dec 28, 2012
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on lease and router lifetime calculation.
parent
60225f4e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
20 deletions
+51
-20
src/dhcp6.c
src/dhcp6.c
+26
-9
src/dnsmasq.h
src/dnsmasq.h
+1
-0
src/radv.c
src/radv.c
+14
-8
src/rfc3315.c
src/rfc3315.c
+10
-3
No files found.
src/dhcp6.c
View file @
3bc0d932
...
...
@@ -26,7 +26,7 @@ struct iface_param {
static
int
complete_context6
(
struct
in6_addr
*
local
,
int
prefix
,
int
scope
,
int
if_index
,
int
flags
,
int
preferred
,
int
valid
,
void
*
vparam
);
unsigned
int
preferred
,
unsigned
int
valid
,
void
*
vparam
);
static
int
make_duid1
(
int
index
,
unsigned
int
type
,
char
*
mac
,
size_t
maclen
,
void
*
parm
);
...
...
@@ -182,18 +182,15 @@ void dhcp6_packet(time_t now)
}
static
int
complete_context6
(
struct
in6_addr
*
local
,
int
prefix
,
int
scope
,
int
if_index
,
int
flags
,
int
preferred
,
int
valid
,
void
*
vparam
)
int
scope
,
int
if_index
,
int
flags
,
unsigned
int
preferred
,
unsigned
int
valid
,
void
*
vparam
)
{
struct
dhcp_context
*
context
;
struct
iface_param
*
param
=
vparam
;
struct
iname
*
tmp
;
(
void
)
scope
;
/* warning */
(
void
)
flags
;
(
void
)
preferred
;
(
void
)
valid
;
if
(
if_index
==
param
->
ind
&&
!
IN6_IS_ADDR_LOOPBACK
(
local
)
&&
!
IN6_IS_ADDR_LINKLOCAL
(
local
)
&&
...
...
@@ -219,12 +216,32 @@ static int complete_context6(struct in6_addr *local, int prefix,
is_same_net6
(
local
,
&
context
->
start6
,
prefix
)
&&
is_same_net6
(
local
,
&
context
->
end6
,
prefix
))
{
/* link it onto the current chain if we've not seen it before */
if
(
context
->
current
==
context
)
{
context
->
current
=
param
->
current
;
param
->
current
=
context
;
struct
dhcp_context
*
tmp
,
**
up
;
/* use interface values only for contructed contexts */
if
(
!
(
context
->
flags
&
CONTEXT_CONSTRUCTED
))
preferred
=
valid
=
0xffffffff
;
else
if
(
flags
&
IFACE_DEPRECATED
)
preferred
=
0
;
if
(
context
->
flags
&
CONTEXT_DEPRECATE
)
preferred
=
0
;
/* order chain, longest preferred time first */
for
(
up
=
&
param
->
current
,
tmp
=
param
->
current
;
tmp
;
tmp
=
tmp
->
current
)
if
(
tmp
->
preferred
<=
preferred
)
break
;
context
->
current
=
*
up
;
*
up
=
context
;
context
->
local6
=
*
local
;
context
->
preferred
=
preferred
;
context
->
valid
=
valid
;
}
}
}
...
...
src/dnsmasq.h
View file @
3bc0d932
...
...
@@ -683,6 +683,7 @@ struct dhcp_context {
struct
in6_addr
start6
,
end6
;
/* range of available addresses */
struct
in6_addr
local6
;
int
prefix
,
if_index
;
unsigned
int
valid
,
preferred
;
time_t
ra_time
,
ra_short_period_start
;
char
*
template_interface
;
#endif
...
...
src/radv.c
View file @
3bc0d932
...
...
@@ -344,6 +344,7 @@ static int add_prefixes(struct in6_addr *local, int prefix,
int
do_prefix
=
0
;
int
do_slaac
=
0
;
int
deprecate
=
0
;
int
constructed
=
0
;
unsigned
int
time
=
0xffffffff
;
struct
dhcp_context
*
context
;
...
...
@@ -383,6 +384,10 @@ static int add_prefixes(struct in6_addr *local, int prefix,
if
(
context
->
flags
&
CONTEXT_DEPRECATE
)
deprecate
=
1
;
if
(
context
->
flags
&
CONTEXT_CONSTRUCTED
)
constructed
=
1
;
/* collect dhcp-range tags */
if
(
context
->
netid
.
next
==
&
context
->
netid
&&
context
->
netid
.
net
)
...
...
@@ -408,18 +413,19 @@ static int add_prefixes(struct in6_addr *local, int prefix,
}
/* configured time is ceiling */
if
(
valid
>
time
)
if
(
!
constructed
||
valid
>
time
)
valid
=
time
;
if
(
(
flags
&
IFACE_DEPRECATED
)
||
deprecate
)
if
(
flags
&
IFACE_DEPRECATED
)
preferred
=
0
;
else
{
/* configured time is ceiling */
if
(
preferred
>
time
)
preferred
=
time
;
}
if
(
deprecate
)
time
=
0
;
/* configured time is ceiling */
if
(
!
constructed
||
preferred
>
time
)
preferred
=
time
;
if
(
preferred
>
param
->
pref_time
)
{
param
->
pref_time
=
preferred
;
...
...
src/rfc3315.c
View file @
3bc0d932
...
...
@@ -625,10 +625,16 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
hostname
=
NULL
;
}
}
if
(
have_config
(
valid_config
,
CONFIG_TIME
))
lease_time
=
valid_config
->
lease_time
;
else
lease_time
=
this_context
->
lease_time
;
lease_time
=
have_config
(
valid_config
,
CONFIG_TIME
)
?
valid_config
->
lease_time
:
this_context
->
lease_time
;
if
(
this_context
->
valid
<
lease_time
)
lease_time
=
this_context
->
valid
;
if
(
ia_option
)
if
(
ia_option
)
{
if
(
requested_time
<
120u
)
requested_time
=
120u
;
/* sanity */
...
...
@@ -740,7 +746,8 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
o1
=
new_opt6
(
OPTION6_IAADDR
);
put_opt6
(
addrp
,
sizeof
(
*
addrp
));
/* preferred lifetime */
put_opt6_long
(
this_context
&&
(
this_context
->
flags
&
CONTEXT_DEPRECATE
)
?
0
:
lease_time
);
put_opt6_long
(
this_context
&&
(
this_context
->
preferred
<
lease_time
)
?
this_context
->
preferred
:
lease_time
);
put_opt6_long
(
lease_time
);
/* valid lifetime */
end_opt6
(
o1
);
...
...
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