Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Sebastian Schrader
Kea
Commits
8d638e07
Commit
8d638e07
authored
Mar 16, 2011
by
Jelte Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[trac697] add test for dns parse error in response
parent
32d47188
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
src/lib/resolve/tests/recursive_query_unittest_2.cc
src/lib/resolve/tests/recursive_query_unittest_2.cc
+21
-6
No files found.
src/lib/resolve/tests/recursive_query_unittest_2.cc
View file @
8d638e07
...
...
@@ -101,11 +101,13 @@ public:
/// Set before the query and then by each "server" when responding.
enum
QueryStatus
{
NONE
=
0
,
///< Default
UDP_ROOT
=
1
,
///< Query root server over UDP
UDP_ORG
=
2
,
///< Query ORG server over UDP
TCP_ORG
=
3
,
///< Query ORG server over TCP
UDP_EXAMPLE_ORG
=
4
,
///< Query EXAMPLE.ORG server over UDP
COMPLETE
=
5
///< Query is complete
UDP_ROOT
,
///< Query root server over UDP
UDP_ORG
,
///< Query ORG server over UDP
TCP_ORG
,
///< Query ORG server over TCP
UDP_EXAMPLE_ORG_BAD
,
///< Query EXAMPLE.ORG server over UDP
///< (return malformed packet)
UDP_EXAMPLE_ORG
,
///< Query EXAMPLE.ORG server over UDP
COMPLETE
///< Query is complete
};
// Common stuff
...
...
@@ -305,6 +307,12 @@ public:
expected_
=
TCP_ORG
;
break
;
case
UDP_EXAMPLE_ORG_BAD
:
// Return the answer to the question.
setAnswerWwwExampleOrg
(
msg
);
// Set new expected in check below
break
;
case
UDP_EXAMPLE_ORG
:
// Return the answer to the question.
setAnswerWwwExampleOrg
(
msg
);
...
...
@@ -320,6 +328,13 @@ public:
MessageRenderer
renderer
(
*
udp_send_buffer_
);
msg
.
toWire
(
renderer
);
if
(
expected_
==
UDP_EXAMPLE_ORG_BAD
)
{
// mangle the packet a bit
// set additional to one more
udp_send_buffer_
->
writeUint8At
(
3
,
11
);
expected_
=
UDP_EXAMPLE_ORG
;
}
// Return a message back to the IOFetch object (after setting the
// expected length of data for the check in the send handler).
udp_length_
=
udp_send_buffer_
->
getLength
();
...
...
@@ -450,7 +465,7 @@ public:
// readiness for the next read. (If any - at present, there is only
// one read in the test, although extensions to this test suite could
// change that.)
expected_
=
UDP_EXAMPLE_ORG
;
expected_
=
UDP_EXAMPLE_ORG
_BAD
;
tcp_cumulative_
=
0
;
// Unless we go through a callback loop we cannot simply use
...
...
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