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
00e9ad52
Commit
00e9ad52
authored
Feb 16, 2012
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for DHCPv6 tag system.
parent
96c3879b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
23 deletions
+54
-23
src/rfc3315.c
src/rfc3315.c
+54
-23
No files found.
src/rfc3315.c
View file @
00e9ad52
...
...
@@ -394,7 +394,7 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
if
(
!
config
)
{
/* Search again now we have a hostname.
Only accept configs without CLID
and HWADDR here, (they
won't match)
Only accept configs without CLID
here, (it
won't match)
to avoid impersonation by name. */
struct
dhcp_config
*
new
=
find_config6
(
daemon
->
dhcp_conf
,
context
,
NULL
,
0
,
hostname
);
if
(
new
&&
!
have_config
(
new
,
CONFIG_CLID
)
&&
!
new
->
hwaddr
)
...
...
@@ -423,18 +423,31 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
ignore
=
1
;
}
tagif
=
run_tag_if
(
tags
);
/* if all the netids in the ignore list are present, ignore this client */
if
(
daemon
->
dhcp_ignore
)
{
struct
dhcp_netid_list
*
id_list
;
tagif
=
run_tag_if
(
tags
);
for
(
id_list
=
daemon
->
dhcp_ignore
;
id_list
;
id_list
=
id_list
->
next
)
if
(
match_netid
(
id_list
->
list
,
tagif
,
0
))
ignore
=
1
;
}
/* if all the netids in the ignore_name list are present, ignore client-supplied name */
if
(
!
hostname_auth
)
{
struct
dhcp_netid_list
*
id_list
;
for
(
id_list
=
daemon
->
dhcp_ignore_names
;
id_list
;
id_list
=
id_list
->
next
)
if
((
!
id_list
->
list
)
||
match_netid
(
id_list
->
list
,
tagif
,
0
))
break
;
if
(
id_list
)
hostname
=
NULL
;
}
switch
(
msg_type
)
{
default:
...
...
@@ -508,7 +521,8 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
struct
in6_addr
*
req_addr
=
opt6_ptr
(
ia_option
,
0
);
preferred_time
=
opt6_uint
(
ia_option
,
16
,
4
);
if
(
!
address6_available
(
context
,
req_addr
,
tags
))
if
(
!
address6_available
(
context
,
req_addr
,
tags
)
&&
(
!
have_config
(
config
,
CONFIG_ADDR6
)
||
memcmp
(
&
config
->
addr6
,
req_addr
,
IN6ADDRSZ
)
!=
0
))
{
if
(
msg_type
==
DHCP6REQUEST
)
{
...
...
@@ -584,13 +598,23 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
address_assigned
=
1
;
/* shouldn't ever fail */
if
((
this_context
=
narrow_context6
(
context
,
addrp
,
tag
s
)))
if
((
this_context
=
narrow_context6
(
context
,
addrp
,
tag
if
)))
{
/* get tags from context if we've not used it before */
if
(
this_context
->
netid
.
next
!
=
&
this_context
->
netid
&&
this_context
->
netid
.
net
)
if
(
this_context
->
netid
.
next
=
=
&
this_context
->
netid
&&
this_context
->
netid
.
net
)
{
this_context
->
netid
.
next
=
context_tags
;
context_tags
=
&
this_context
->
netid
;
if
(
!
hostname_auth
)
{
struct
dhcp_netid_list
*
id_list
;
for
(
id_list
=
daemon
->
dhcp_ignore_names
;
id_list
;
id_list
=
id_list
->
next
)
if
((
!
id_list
->
list
)
||
match_netid
(
id_list
->
list
,
&
this_context
->
netid
,
0
))
break
;
if
(
id_list
)
hostname
=
NULL
;
}
}
lease_time
=
have_config
(
valid_config
,
CONFIG_TIME
)
?
valid_config
->
lease_time
:
this_context
->
lease_time
;
...
...
@@ -653,13 +677,18 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
client_hostname
?
strlen
(
client_hostname
)
:
0
,
0
);
/* space-concat tag set */
if
(
!
tags
)
if
(
!
tag
if
&&
!
context_tag
s
)
lease_add_extradata
(
lease
,
NULL
,
0
,
0
);
else
{
struct
dhcp_netid
*
n
;
struct
dhcp_netid
*
n
,
*
l
;
for
(
n
=
run_tag_if
(
tags
);
n
;
n
=
n
->
next
)
/* link temporarily */
for
(
n
=
context_tags
;
n
&&
n
->
next
;
n
=
n
->
next
);
if
(
l
=
n
)
l
->
next
=
tags
;
for
(
n
=
run_tag_if
(
context_tags
);
n
;
n
=
n
->
next
)
{
struct
dhcp_netid
*
n1
;
/* kill dupes */
...
...
@@ -669,6 +698,10 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
if
(
!
n1
)
lease_add_extradata
(
lease
,
(
unsigned
char
*
)
n
->
net
,
strlen
(
n
->
net
),
n
->
next
?
' '
:
0
);
}
/* unlink again */
if
(
l
)
l
->
next
=
NULL
;
}
if
(
link_address
)
...
...
@@ -820,17 +853,27 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
break
;
}
tagif
=
run_tag_if
(
tags
);
if
(
!
address6_available
(
context
,
req_addr
,
tagif
)
||
!
(
this_context
=
narrow_context6
(
context
,
req_addr
,
tagif
)))
lease_time
=
0
;
else
{
/* get tags from context if we've not used it before */
if
(
this_context
->
netid
.
next
!
=
&
this_context
->
netid
&&
this_context
->
netid
.
net
)
if
(
this_context
->
netid
.
next
=
=
&
this_context
->
netid
&&
this_context
->
netid
.
net
)
{
this_context
->
netid
.
next
=
context_tags
;
context_tags
=
&
this_context
->
netid
;
if
(
!
hostname_auth
)
{
struct
dhcp_netid_list
*
id_list
;
for
(
id_list
=
daemon
->
dhcp_ignore_names
;
id_list
;
id_list
=
id_list
->
next
)
if
((
!
id_list
->
list
)
||
match_netid
(
id_list
->
list
,
&
this_context
->
netid
,
0
))
break
;
if
(
id_list
)
hostname
=
NULL
;
}
}
lease_time
=
have_config
(
valid_config
,
CONFIG_TIME
)
?
valid_config
->
lease_time
:
this_context
->
lease_time
;
...
...
@@ -1213,18 +1256,6 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
}
/* if all the netids in the ignore_name list are present, ignore client-supplied name */
if
(
!
hostname_auth
)
{
struct
dhcp_netid_list
*
id_list
;
for
(
id_list
=
daemon
->
dhcp_ignore_names
;
id_list
;
id_list
=
id_list
->
next
)
if
((
!
id_list
->
list
)
||
match_netid
(
id_list
->
list
,
tagif
,
0
))
break
;
if
(
id_list
)
hostname
=
NULL
;
}
if
(
hostname
)
{
unsigned
char
*
p
;
...
...
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