/*
* Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id$ */
/*! \file */
#include <config.h>
#include <atf-c.h>
#include <unistd.h>
#include <dns/compress.h>
#include "dnstest.h"
/*
* Individual unit tests
*/
/* Successful load test */
"be rejected");
}
0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
0x04, 0x41, 0x42, 0x43, 0x44, 0x00 };
size_t i;
/*
* Fill the rest of input buffer with compression pointers.
*/
hipwire[i] = 0xc0;
}
isc_buffer_setactive(&source, i);
0, &target);
}
"check EDNS client subnet option parsing");
}
struct {
} test_data[] = {
{
/* option code with no content */
},
{
/* Option code family 0, source 0, scope 0 */
{
0x00, 0x08, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00
},
8, ISC_TRUE
},
{
/* Option code family 1 (ipv4), source 0, scope 0 */
{
0x00, 0x08, 0x00, 0x04,
0x00, 0x01, 0x00, 0x00
},
8, ISC_TRUE
},
{
/* Option code family 2 (ipv6) , source 0, scope 0 */
{
0x00, 0x08, 0x00, 0x04,
0x00, 0x02, 0x00, 0x00
},
8, ISC_TRUE
},
{
/* extra octet */
{
0x00, 0x08, 0x00, 0x05,
0x00, 0x00, 0x00, 0x00,
0x00
},
9, ISC_FALSE
},
{
/* source too long for IPv4 */
{
0x00, 0x08, 0x00, 8,
0x00, 0x01, 33, 0x00,
0x00, 0x00, 0x00, 0x00
},
12, ISC_FALSE
},
{
/* source too long for IPv6 */
{
0x00, 0x08, 0x00, 20,
0x00, 0x02, 129, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
},
24, ISC_FALSE
},
{
/* scope too long for IPv4 */
{
0x00, 0x08, 0x00, 8,
0x00, 0x01, 0x00, 33,
0x00, 0x00, 0x00, 0x00
},
12, ISC_FALSE
},
{
/* scope too long for IPv6 */
{
0x00, 0x08, 0x00, 20,
0x00, 0x02, 0x00, 129,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
},
24, ISC_FALSE
},
{
/* length too short for source generic */
{
0x00, 0x08, 0x00, 5,
0x00, 0x00, 17, 0x00,
0x00, 0x00,
},
19, ISC_FALSE
},
{
/* length too short for source ipv4 */
{
0x00, 0x08, 0x00, 7,
0x00, 0x01, 32, 0x00,
0x00, 0x00, 0x00, 0x00
},
11, ISC_FALSE
},
{
/* length too short for source ipv6 */
{
0x00, 0x08, 0x00, 19,
0x00, 0x02, 128, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
},
23, ISC_FALSE
},
{
/* sentinal */
{ 0x00 }, 0, ISC_FALSE
}
};
size_t i;
else
}
}
}
struct {
} test_data[] = {
{
/* too short */
},
{
/* minimal TCP */
},
{
/* minimal UDP */
},
{
/* minimal other */
},
{
/* sentinal */
{ 0x00 }, 0, ISC_FALSE
}
};
size_t i;
else
if (result != ISC_R_SUCCESS)
continue;
&target2);
}
}
}
struct {
} test_data[] = {
{
/* "" */
},
{
/* "\001" */
},
{
/* "\001" "" */
},
{
/* "\000" "\001" */
},
{
/* sentinal */
{ 0x00 }, 0, ISC_FALSE
}
};
size_t i;
else
if (result != ISC_R_SUCCESS)
continue;
&target2);
}
}
/*
* Main
*/
return (atf_no_error());
}