mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
test-resolved-packet: skip most of the loop
We want to test the edge cases, but testing all the values in between is mostly pointless and slow on slow architectures (>1s on rpi).
This commit is contained in:
parent
da1e72f482
commit
86d0608929
@ -28,7 +28,6 @@
|
||||
|
||||
#define EDNS0_OPT_DO (1<<15)
|
||||
|
||||
#define DNS_PACKET_SIZE_START 512u
|
||||
assert_cc(DNS_PACKET_SIZE_START > DNS_PACKET_HEADER_SIZE)
|
||||
|
||||
typedef struct DnsPacketRewinder {
|
||||
|
@ -56,10 +56,14 @@ struct DnsPacketHeader {
|
||||
#define UDP_PACKET_HEADER_SIZE (sizeof(struct iphdr) + sizeof(struct udphdr))
|
||||
|
||||
/* The various DNS protocols deviate in how large a packet can grow,
|
||||
but the TCP transport has a 16bit size field, hence that appears to
|
||||
be the absolute maximum. */
|
||||
* but the TCP transport has a 16bit size field, hence that appears to
|
||||
* be the absolute maximum. */
|
||||
#define DNS_PACKET_SIZE_MAX 0xFFFFu
|
||||
|
||||
/* The default size to use for allocation when we don't know how large
|
||||
* the packet will turn out to be. */
|
||||
#define DNS_PACKET_SIZE_START 512u
|
||||
|
||||
/* RFC 1035 say 512 is the maximum, for classic unicast DNS */
|
||||
#define DNS_PACKET_UNICAST_SIZE_MAX 512u
|
||||
|
||||
|
@ -31,6 +31,9 @@ static void test_dns_packet_new(void) {
|
||||
|
||||
log_debug("dns_packet_new: %zu → %zu", i, p->allocated);
|
||||
assert_se(p->allocated >= MIN(DNS_PACKET_SIZE_MAX, i));
|
||||
|
||||
if (i > DNS_PACKET_SIZE_START + 10 && i < DNS_PACKET_SIZE_MAX - 10)
|
||||
i = MIN(i * 2, DNS_PACKET_SIZE_MAX - 10);
|
||||
}
|
||||
|
||||
assert_se(dns_packet_new(&p2, DNS_PROTOCOL_DNS, DNS_PACKET_SIZE_MAX + 1) == -EFBIG);
|
||||
|
Loading…
Reference in New Issue
Block a user