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
bd08ae67
Commit
bd08ae67
authored
Apr 19, 2013
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow option number zero in encapsulated DHCP options.
parent
4582c0ef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
18 deletions
+25
-18
src/dhcp-common.c
src/dhcp-common.c
+3
-3
src/dnsmasq.h
src/dnsmasq.h
+2
-2
src/option.c
src/option.c
+20
-13
No files found.
src/dhcp-common.c
View file @
bd08ae67
...
...
@@ -512,7 +512,7 @@ void display_opts6(void)
}
#endif
u16
lookup_dhcp_opt
(
int
prot
,
char
*
name
)
int
lookup_dhcp_opt
(
int
prot
,
char
*
name
)
{
const
struct
opttab_t
*
t
;
int
i
;
...
...
@@ -528,10 +528,10 @@ u16 lookup_dhcp_opt(int prot, char *name)
if
(
strcasecmp
(
t
[
i
].
name
,
name
)
==
0
)
return
t
[
i
].
val
;
return
0
;
return
-
1
;
}
u16
lookup_dhcp_len
(
int
prot
,
u16
val
)
int
lookup_dhcp_len
(
int
prot
,
int
val
)
{
const
struct
opttab_t
*
t
;
int
i
;
...
...
src/dnsmasq.h
View file @
bd08ae67
...
...
@@ -1216,8 +1216,8 @@ void log_tags(struct dhcp_netid *netid, u32 xid);
int
match_bytes
(
struct
dhcp_opt
*
o
,
unsigned
char
*
p
,
int
len
);
void
dhcp_update_configs
(
struct
dhcp_config
*
configs
);
void
display_opts
(
void
);
u16
lookup_dhcp_opt
(
int
prot
,
char
*
name
);
u16
lookup_dhcp_len
(
int
prot
,
u16
val
);
int
lookup_dhcp_opt
(
int
prot
,
char
*
name
);
int
lookup_dhcp_len
(
int
prot
,
int
val
);
char
*
option_string
(
int
prot
,
unsigned
int
opt
,
unsigned
char
*
val
,
int
opt_len
,
char
*
buf
,
int
buf_len
);
#ifdef HAVE_LINUX_NETWORK
...
...
src/option.c
View file @
bd08ae67
...
...
@@ -750,6 +750,7 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
struct
dhcp_netid
*
np
=
NULL
;
u16
opt_len
=
0
;
int
is6
=
0
;
int
option_ok
=
0
;
new
->
len
=
0
;
new
->
flags
=
flags
;
...
...
@@ -769,16 +770,19 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
{
new
->
opt
=
atoi
(
arg
);
opt_len
=
0
;
option_ok
=
1
;
break
;
}
if
(
strstr
(
arg
,
"option:"
)
==
arg
)
{
new
->
opt
=
lookup_dhcp_opt
(
AF_INET
,
arg
+
7
);
if
((
new
->
opt
=
lookup_dhcp_opt
(
AF_INET
,
arg
+
7
))
!=
-
1
)
{
opt_len
=
lookup_dhcp_len
(
AF_INET
,
new
->
opt
);
/* option:<optname> must follow tag and vendor string. */
if
((
opt_len
&
OT_INTERNAL
)
&&
flags
!=
DHOPT_MATCH
)
new
->
opt
=
0
;
if
(
!
(
opt_len
&
OT_INTERNAL
)
||
flags
==
DHOPT_MATCH
)
option_ok
=
1
;
}
break
;
}
#ifdef HAVE_DHCP6
...
...
@@ -792,13 +796,16 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
{
new
->
opt
=
atoi
(
arg
+
8
);
opt_len
=
0
;
option_ok
=
1
;
}
else
{
new
->
opt
=
lookup_dhcp_opt
(
AF_INET6
,
arg
+
8
);
if
((
new
->
opt
=
lookup_dhcp_opt
(
AF_INET6
,
arg
+
8
))
!=
-
1
)
{
opt_len
=
lookup_dhcp_len
(
AF_INET6
,
new
->
opt
);
if
((
opt_len
&
OT_INTERNAL
)
&&
flags
!=
DHOPT_MATCH
)
new
->
opt
=
0
;
if
(
!
(
opt_len
&
OT_INTERNAL
)
||
flags
==
DHOPT_MATCH
)
option_ok
=
1
;
}
}
/* option6:<opt>|<optname> must follow tag and vendor string. */
is6
=
1
;
...
...
@@ -821,7 +828,7 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
new
->
flags
|=
DHOPT_RFC3925
;
if
(
flags
==
DHOPT_MATCH
)
{
new
->
opt
=
1
;
/* avoid error below */
option_ok
=
1
;
break
;
}
}
...
...
@@ -848,16 +855,16 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
if
(
opt_len
==
0
&&
!
(
new
->
flags
&
DHOPT_RFC3925
))
opt_len
=
lookup_dhcp_len
(
AF_INET6
,
new
->
opt
);
opt_len
=
lookup_dhcp_len
(
AF_INET6
,
new
->
opt
);
}
else
#endif
if
(
opt_len
==
0
&&
!
(
new
->
flags
&
(
DHOPT_VENDOR
|
DHOPT_ENCAPSULATE
|
DHOPT_RFC3925
)))
opt_len
=
lookup_dhcp_len
(
AF_INET
,
new
->
opt
);
opt_len
=
lookup_dhcp_len
(
AF_INET
,
new
->
opt
);
/* option may be missing with rfc3925 match */
if
(
new
->
opt
==
0
)
if
(
!
option_ok
)
ret_err
(
_
(
"bad dhcp-option"
));
if
(
comma
)
...
...
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