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
5c3b4f2c
Commit
5c3b4f2c
authored
Feb 20, 2015
by
Chen Wei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for DNSSEC error after split tcp_request()
parent
65985384
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
src/forward.c
src/forward.c
+21
-11
No files found.
src/forward.c
View file @
5c3b4f2c
...
@@ -31,8 +31,9 @@ static int send_check_sign(struct frec *forward, time_t now, struct dns_header *
...
@@ -31,8 +31,9 @@ static int send_check_sign(struct frec *forward, time_t now, struct dns_header *
char
*
name
,
char
*
keyname
);
char
*
name
,
char
*
keyname
);
#endif
#endif
static
int
tcp_conn_serv
(
struct
server
*
serv
,
time_t
now
,
static
int
tcp_conn_serv
(
struct
server
*
serv
,
time_t
now
,
unsigned
char
*
packet
,
size_t
payload_size
,
unsigned
char
*
packet
,
size_t
payload_size
,
union
mysockaddr
*
peer_addr
);
union
mysockaddr
*
peer_addr
,
int
*
added_pheader
,
int
*
no_cache_dnssec
,
int
*
cache_secure
);
/* Send a UDP packet with its source address set as "source"
/* Send a UDP packet with its source address set as "source"
unless nowild is true, when we just send it with the kernel default */
unless nowild is true, when we just send it with the kernel default */
...
@@ -1643,8 +1644,9 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
...
@@ -1643,8 +1644,9 @@ static int tcp_key_recurse(time_t now, int status, struct dns_header *header, si
* 0 on upstream response has 0 length DNS message, or DNSSEC error
* 0 on upstream response has 0 length DNS message, or DNSSEC error
* > 0 DNS message length received from upstream server */
* > 0 DNS message length received from upstream server */
static
int
tcp_conn_serv
(
struct
server
*
serv
,
time_t
now
,
static
int
tcp_conn_serv
(
struct
server
*
serv
,
time_t
now
,
unsigned
char
*
packet
,
size_t
payload_size
,
unsigned
char
*
packet
,
size_t
payload_size
,
union
mysockaddr
*
peer_addr
)
union
mysockaddr
*
peer_addr
,
int
*
added_pheader
,
int
*
no_cache_dnssec
,
int
*
cache_secure
)
{
{
unsigned
char
*
payload
=
packet
+
2
;
/* skip msg length field */
unsigned
char
*
payload
=
packet
+
2
;
/* skip msg length field */
struct
dns_header
*
header
=
(
struct
dns_header
*
)
payload
;
struct
dns_header
*
header
=
(
struct
dns_header
*
)
payload
;
...
@@ -1699,6 +1701,9 @@ static int tcp_conn_serv(struct server *serv, time_t now,
...
@@ -1699,6 +1701,9 @@ static int tcp_conn_serv(struct server *serv, time_t now,
return
-
1
;
return
-
1
;
}
}
#ifdef HAVE_DNSSEC
#ifdef HAVE_DNSSEC
if
(
option_bool
(
OPT_DNSSEC_VALID
))
if
(
option_bool
(
OPT_DNSSEC_VALID
))
{
{
...
@@ -1712,11 +1717,14 @@ static int tcp_conn_serv(struct server *serv, time_t now,
...
@@ -1712,11 +1717,14 @@ static int tcp_conn_serv(struct server *serv, time_t now,
header
->
hb4
|=
HB4_CD
;
header
->
hb4
|=
HB4_CD
;
if
(
payload_size
!=
new_size
)
if
(
payload_size
!=
new_size
)
added_pheader
=
1
;
*
added_pheader
=
1
;
payload_size
=
new_size
;
payload_size
=
new_size
;
}
}
#endif
#endif
}
}
/* get query name again for logging - may have been overwritten */
/* get query name again for logging - may have been overwritten */
...
@@ -1768,10 +1776,10 @@ static int tcp_conn_serv(struct server *serv, time_t now,
...
@@ -1768,10 +1776,10 @@ static int tcp_conn_serv(struct server *serv, time_t now,
log_query
(
F_KEYTAG
|
F_SECSTAT
,
"result"
,
NULL
,
result
);
log_query
(
F_KEYTAG
|
F_SECSTAT
,
"result"
,
NULL
,
result
);
if
(
status
==
STAT_BOGUS
)
if
(
status
==
STAT_BOGUS
)
no_cache_dnssec
=
1
;
*
no_cache_dnssec
=
1
;
if
(
status
==
STAT_SECURE
)
if
(
status
==
STAT_SECURE
)
cache_secure
=
1
;
*
cache_secure
=
1
;
}
}
#endif
#endif
...
@@ -1811,8 +1819,8 @@ unsigned char *tcp_request(int confd, time_t now,
...
@@ -1811,8 +1819,8 @@ unsigned char *tcp_request(int confd, time_t now,
#ifdef HAVE_AUTH
#ifdef HAVE_AUTH
int
local_auth
=
0
;
int
local_auth
=
0
;
#endif
#endif
int
checking_disabled
,
ad_question
,
do_bit
,
added_pheader
=
0
;
int
checking_disabled
,
ad_question
,
do_bit
,
check_subnet
;
int
check_subnet
,
no_cache_dnssec
=
0
,
cache_secure
=
0
;
int
added_pheader
=
0
,
no_cache_dnssec
=
0
,
cache_secure
=
0
;
size_t
m
;
size_t
m
;
unsigned
short
qtype
;
unsigned
short
qtype
;
unsigned
int
gotname
;
unsigned
int
gotname
;
...
@@ -1971,7 +1979,8 @@ unsigned char *tcp_request(int confd, time_t now,
...
@@ -1971,7 +1979,8 @@ unsigned char *tcp_request(int confd, time_t now,
{
{
/* --server=/example.org/1.2.3.4 */
/* --server=/example.org/1.2.3.4 */
serv
=
fwdserv
;
serv
=
fwdserv
;
ret
=
tcp_conn_serv
(
serv
,
now
,
packet
,
size
,
&
peer_addr
);
ret
=
tcp_conn_serv
(
serv
,
now
,
packet
,
size
,
&
peer_addr
,
&
added_pheader
,
&
no_cache_dnssec
,
&
cache_secure
);
}
}
else
else
{
{
...
@@ -2001,7 +2010,8 @@ unsigned char *tcp_request(int confd, time_t now,
...
@@ -2001,7 +2010,8 @@ unsigned char *tcp_request(int confd, time_t now,
continue
;
continue
;
serv
=
last_server
;
serv
=
last_server
;
ret
=
tcp_conn_serv
(
serv
,
now
,
packet
,
size
,
&
peer_addr
);
ret
=
tcp_conn_serv
(
serv
,
now
,
packet
,
size
,
&
peer_addr
,
&
added_pheader
,
&
no_cache_dnssec
,
&
cache_secure
);
/* something wrong with tcp connect/read/write */
/* something wrong with tcp connect/read/write */
if
(
ret
<=
0
)
if
(
ret
<=
0
)
continue
;
continue
;
...
...
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