*/
if ((value[0] == '*') && (value[1] == '\0')) {
out->ipaddr.ip4addr.s_addr = htonl(INADDR_ANY);
+ out->prefix = 0;
+ out->af = AF_INET;
+
+ return 0;
/*
* Convert things which are obviously integers to IP addresses
*
*/
if ((value[0] == '*') && (value[1] == '\0')) {
memset(&out->ipaddr.ip6addr.s6_addr, 0, sizeof(out->ipaddr.ip6addr.s6_addr));
+ out->prefix = 0;
+ out->af = AF_INET6;
+
+ return 0;
} else if (!resolve) {
if (inet_pton(AF_INET6, value, &(out->ipaddr.ip6addr.s6_addr)) <= 0) {
fr_strerror_printf("Failed to parse IPv6 address string \"%s\"", value);
}
fr_ntop(buffer, sizeof(buffer), &client->ipaddr);
- DEBUG("Adding client %s (%s)", buffer, client->longname);
+ DEBUG3("Adding client %s (%s) to prefix tree %i", buffer, client->longname, client->ipaddr.prefix);
/*
* If "clients" is NULL, it means add to the global list.
fr_strerror());
goto error;
}
- cf_log_err_cs(cs, "Wildcard client addresses are not allowed");
c->longname = talloc_typed_strdup(c, name2);
if (!c->shortname) c->shortname = talloc_typed_strdup(c, c->longname);
fr_ipaddr_mask(&c->ipaddr, cl_prefix);
}
- if ((c->ipaddr.prefix == 0) || is_wildcard(&c->ipaddr)) {
- cf_log_err_cs(cs, "Wildcard client addresses are not allowed");
- goto error;
- }
-
c->proto = IPPROTO_UDP;
if (hs_proto) {
if (strcmp(hs_proto, "udp") == 0) {
return NULL;
}
- if ((c->ipaddr.prefix == 0) || is_wildcard(&c->ipaddr)) {
- ERROR("Wildcard client addresses are not allowed");
-
- goto error;
- }
-
#ifdef WITH_DYNAMIC_CLIENTS
c->dynamic = true;
#endif
}
}
- if ((c->ipaddr.prefix == 0) || is_wildcard(&c->ipaddr)) {
- DEBUG("- Wildcard client addresses are not allowed");
-
- goto error;
- }
-
if (c->ipaddr.af == AF_UNSPEC) {
DEBUG("- Cannot add client %s: No IP address was specified.",
ip_ntoh(&request->packet->src_ipaddr,
case PW_TYPE_IP_ADDR:
switch (ipaddr->af) {
case AF_INET:
- if (ipaddr->prefix != 32) {
+ if (!is_wildcard(ipaddr) && (ipaddr->prefix != 32)) {
ERROR("Invalid IPv4 mask length \"/%i\". Only \"/32\" permitted for non-prefix types",
ipaddr->prefix);
break;
case AF_INET6:
- if (ipaddr->prefix != 128) {
+ if (!is_wildcard(ipaddr) && (ipaddr->prefix != 128)) {
ERROR("Invalid IPv6 mask length \"/%i\". Only \"/128\" permitted for non-prefix types",
ipaddr->prefix);
* Figure out which one to use.
*/
if (cf_pair_find(cs, "ipaddr") || cf_pair_find(cs, "ipv4addr") || cf_pair_find(cs, "ipv6addr")) {
+ if (is_wildcard(&hs_ipaddr)) {
+ cf_log_err_cs(cs, "Wildcard '*' addresses are not permitted for home servers");
+ goto error;
+ }
home->ipaddr = hs_ipaddr;
} else if ((cp = cf_pair_find(cs, "virtual_server")) != NULL) {
home->ipaddr.af = AF_UNSPEC;