edns->subnet_source_mask = MAX_CLIENT_SUBNET_IP4;
edns->subnet_addr_fam = IANA_ADDRFAM_IP4;
sinaddr = &((struct sockaddr_in*)ss)->sin_addr;
+#ifndef unbound_testbound
memcpy(edns->subnet_addr, (uint8_t *)sinaddr, INET_SIZE);
+#else
+ /* sinaddr does not contain any valid data when running
+ * testbound. Provide a constant so we can do our tests */
+ memcpy(edns->subnet_addr, (uint8_t *)[5,0,15,10], INET_SIZE);
+#endif /* unbound_testbound */
edns->subnet_validdata = 1;
- }
+ }
#ifdef INET6
else {
edns->subnet_source_mask = MAX_CLIENT_SUBNET_IP6;
edns->subnet_addr_fam = IANA_ADDRFAM_IP6;
sinaddr = &((struct sockaddr_in6*)ss)->sin6_addr;
+#ifndef unbound_testbound
memcpy(edns->subnet_addr, (uint8_t *)sinaddr, INET6_SIZE);
+#else
+ /* sinaddr does not contain any valid data when running
+ * testbound. Provide a constant so we can do our tests */
+ memcpy(edns->subnet_addr, (uint8_t *)[5,0,15,10, 5,0,15,10,
+ 5,0,15,10, 5,0,15,10], INET6_SIZE);
+#endif /* unbound_testbound */
edns->subnet_validdata = 1;
}
#else
#ifdef UNBOUND_DEBUG
n =
#else
- (void)
+ (void)
#endif
rbtree_insert(&mesh->all, &s->node);
log_assert(n != NULL);
#include "testcode/ldns-testpkts.h"
#include "util/log.h"
#include "util/fptr_wlist.h"
+#ifdef CLIENT_SUBNET
#include "edns-subnet/edns-subnet.h"
+#endif
#include <signal.h>
struct worker;
struct daemon_remote;
memcpy(&edns, edns_out, sizeof(edns));
/* This tells our module we've appened the option*/
edns.subnet_sent = 1;
+ } else {
+ edns.subnet_validdata = 0;
}
#endif
edns.edns_present = 1;
printf("-2 detect SHA256 support (exit code 0 or 1)\n");
printf("-g detect GOST support (exit code 0 or 1)\n");
printf("-e detect ECDSA support (exit code 0 or 1)\n");
+ printf("-c detect CLIENT_SUBNET support (exit code 0 or 1)\n");
printf("-s testbound self-test - unit test of testbound parts.\n");
printf("-o str unbound commandline options separated by spaces.\n");
printf("Version %s\n", PACKAGE_VERSION);
pass_argc = 1;
pass_argv[0] = "unbound";
add_opts("-d", &pass_argc, pass_argv);
- while( (c=getopt(argc, argv, "2egho:p:s")) != -1) {
+ while( (c=getopt(argc, argv, "2cegho:p:s")) != -1) {
switch(c) {
case 's':
free(pass_argv[1]);
#else
printf("GOST not supported\n");
exit(1);
+#endif
+ break;
+ case 'c':
+#ifdef CLIENT_SUBNET
+ printf("CLIENT_SUBNET supported\n");
+ exit(0);
+#else
+ printf("CLIENT_SUBNET not supported\n");
+ exit(1);
#endif
break;
case 'p':