#define fr_exit_now(_x) _fr_exit_now(__FILE__, __LINE__, (_x))
extern char const *fr_strerror(void);
-extern bool fr_dns_lookups; /* 0 = no dns lookups */
+extern bool fr_dns_lookups; /* do IP -> hostname lookups? */
+extern bool fr_hostname_lookups; /* do hostname -> IP lookups? */
extern int fr_debug_flag; /* 0 = no debugging information */
extern int fr_max_attributes; /* per incoming packet */
#define FR_MAX_PACKET_CODE (52)
static int fr_debugger_present = -1;
-bool fr_dns_lookups = false;
+bool fr_dns_lookups = false; /* IP -> hostname lookups? */
+bool fr_hostname_lookups = true; /* hostname -> IP lookups? */
int fr_debug_flag = 0;
static char const *months[] = {
int rcode;
struct addrinfo hints, *ai = NULL, *res = NULL;
+ if (!fr_hostname_lookups) {
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
+ if (af == AF_UNSPEC) {
+ char const *p;
+
+ for (p = src; *p != '\0'; p++) {
+ if ((*p == ':') ||
+ (*p == '[') ||
+ (*p == ']')) {
+ af = AF_INET6;
+ break;
+ }
+ }
+ }
+#endif
+
+ if (af == AF_UNSPEC) af = AF_INET;
+
+ if (!inet_pton(af, src, &(dst->ipaddr))) {
+ return -1;
+ }
+
+ dst->af = af;
+ return 0;
+ }
+
memset(&hints, 0, sizeof(hints));
hints.ai_family = af;
mainconfig.name = "radiusd";
/*
+ * The tests should have only IPs, not host names.
+ */
+ fr_hostname_lookups = false;
+
+ /*
* We always log to stdout.
*/
fr_log_fp = stdout;