Skip to content

Commit a3026de

Browse files
committed
- Add IPv4 DNS request test cases.
1 parent 232459c commit a3026de

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

test/test.c

+17
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ static struct packet pkt_http_request =
7171
sizeof(http_request),
7272
"ipv4_tcp_http_req"
7373
};
74+
static struct packet pkt_dns_request =
75+
{
76+
dns_request,
77+
sizeof(dns_request),
78+
"ipv4_udp_dns_req"
79+
};
7480
static struct packet pkt_ipv6_tcp_syn =
7581
{
7682
ipv6_tcp_syn,
@@ -110,6 +116,17 @@ static struct test tests[] =
110116
{"tcp.PayloadLength <= 469", &pkt_http_request, TRUE},
111117
{"tcp.PayloadLength > 469", &pkt_http_request, FALSE},
112118
{"tcp.PayloadLength < 469", &pkt_http_request, FALSE},
119+
{"udp", &pkt_dns_request, TRUE},
120+
{"udp && udp.SrcPort > 1 && ipv6", &pkt_dns_request, FALSE},
121+
{"udp.DstPort == 53", &pkt_dns_request, TRUE},
122+
{"udp.DstPort > 100", &pkt_dns_request, FALSE},
123+
{"ip.DstAddr = 8.8.4.4", &pkt_dns_request, TRUE},
124+
{"ip.DstAddr = 8.8.8.8", &pkt_dns_request, FALSE},
125+
{"ip.SrcAddr >= 10.0.0.0 && ip.SrcAddr <= 10.255.255.255",
126+
&pkt_dns_request, TRUE},
127+
{"ip.SrcAddr < 10.0.0.0 or ip.SrcAddr > 10.255.255.255",
128+
&pkt_dns_request, FALSE},
129+
{"udp.PayloadLength == 29", &pkt_dns_request, TRUE},
113130
{"ipv6", &pkt_ipv6_tcp_syn, TRUE},
114131
{"ip", &pkt_ipv6_tcp_syn, FALSE},
115132
{"tcp.Syn", &pkt_ipv6_tcp_syn, TRUE},

test/test_data.c

+13
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@ static unsigned char http_request[] =
103103
0x0a
104104
};
105105

106+
// IPV4 DNS REQUEST
107+
static unsigned char dns_request[] =
108+
{
109+
0x45, 0x00, 0x00, 0x39, 0x20, 0x90, 0x00, 0x00,
110+
0x49, 0x11, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x01,
111+
0x08, 0x08, 0x04, 0x04, 0xe0, 0x45, 0x00, 0x35,
112+
0x00, 0x25, 0x00, 0x00, 0x17, 0x08, 0x01, 0x00,
113+
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114+
0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
115+
0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00,
116+
0x01
117+
};
118+
106119
// IPV6 TCP SYN
107120
static unsigned char ipv6_tcp_syn[] =
108121
{

0 commit comments

Comments
 (0)