1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-10 21:23:12 +02:00

- Now allowing '1.2.3.4' ips again in IPv6 mode as well (instead of enforcing

'::ffff:1.2.3.4' ips in the conf, they are now auto-converted to that).
  Based on patch from tabrisnet.
- Fixed issue where the cgiirc block did not work with IPv6, reported by
  djGrrr, fixed by previous change.
This commit is contained in:
Bram Matthys
2007-09-05 19:03:06 +00:00
parent 15008285aa
commit 68c5bf4f66
2 changed files with 44 additions and 12 deletions
+5
View File
@@ -1535,3 +1535,8 @@
not being created
- Fixed bug in SJOIN, possibly causing things like odd bans showing up in
some circumstances. Reported by Hurga, patch provided by fbi.
- Now allowing '1.2.3.4' ips again in IPv6 mode as well (instead of enforcing
'::ffff:1.2.3.4' ips in the conf, they are now auto-converted to that).
Based on patch from tabrisnet.
- Fixed issue where the cgiirc block did not work with IPv6, reported by
djGrrr, fixed by previous change.
+39 -12
View File
@@ -4198,10 +4198,18 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce)
#ifdef INET6
if ((strlen(ip) > 6) && !strchr(ip, ':') && isdigit(ip[strlen(ip)-1]))
{
config_error("%s:%i: listen: ip set to '%s' (ipv4) on an IPv6 compile, "
"use the ::ffff:1.2.3.4 form instead",
char crap[32];
if (inet_pton(AF_INET, ip, crap) != 0)
{
char ipv6buf[128];
snprintf(ipv6buf, sizeof(ipv6buf), "[::ffff:%s]:%s", ip, port);
ce->ce_vardata = strdup(ipv6buf);
} else {
/* Insert IPv6 validation here */
config_error("%s:%i: listen: '%s' looks like it might be IPv4, but is not a valid address.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ip);
return 1;
return 1;
}
}
#endif
port_range(port, &start, &end);
@@ -6081,11 +6089,20 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce)
if (cep->ce_vardata && (strlen(cep->ce_vardata) > 6) && !strchr(cep->ce_vardata, ':') &&
isdigit(cep->ce_vardata[strlen(cep->ce_vardata)-1]))
{
config_error("%s:%i: link %s has link::hostname set to '%s' (IPv4) on a IPv6 compile, "
"use the ::ffff:1.2.3.4 form instead",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, ce->ce_vardata,
cep->ce_vardata);
errors++;
char crap[32];
if (inet_pton(AF_INET, cep->ce_vardata, crap) != 0)
{
char ipv6buf[48];
snprintf(ipv6buf, sizeof(ipv6buf), "::ffff:%s", cep->ce_vardata);
cep->ce_vardata = strdup(ipv6buf);
} else {
/* Insert IPv6 validation here */
config_error( "%s:%i: listen: '%s' looks like "
"it might be IPv4, but is not a valid address.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
cep->ce_vardata);
errors++;
}
}
#endif
if (strchr(cep->ce_vardata, '*') != NULL || strchr(cep->ce_vardata, '?'))
@@ -6352,10 +6369,20 @@ int _test_cgiirc(ConfigFile *conf, ConfigEntry *ce)
if (cep->ce_vardata && (strlen(cep->ce_vardata) > 6) && !strchr(cep->ce_vardata, ':') &&
isdigit(cep->ce_vardata[strlen(cep->ce_vardata)-1]))
{
config_error("%s:%i: cgiirc block has cgiirc::hostname set to '%s' (IPv4) on a IPv6 compile, "
"use the ::ffff:1.2.3.4 form instead",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_vardata);
errors++;
char crap[32];
if (inet_pton(AF_INET, cep->ce_vardata, crap) != 0)
{
char ipv6buf[48];
snprintf(ipv6buf, sizeof(ipv6buf), "::ffff:%s", cep->ce_vardata);
cep->ce_vardata = strdup(ipv6buf);
} else {
/* Insert IPv6 validation here */
config_error( "%s:%i: cgiirc::hostname: '%s' looks like "
"it might be IPv4, but is not a valid address.",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
cep->ce_vardata);
errors++;
}
}
#endif
}