Mark places that might want changing for IPv6.

Any places which I feel might want to be updated to work differently
with IPv6 have been marked with a comment starting "IPV6:".

Currently the only comments address places where an IP address is
combined with a port using the standard : separated form. These may want
to be changed when printing IPv6 addresses to wrap the address in []
such as

	[2001:db8::c0:ffee]:6379

instead of

	2001:db8::c0:ffee:6379

as the latter format is a technically valid IPv6 address and it is hard
to distinguish the IPv6 address component from the port unless you know
the port is supposed to be there.
This commit is contained in:
Geoff Garside 2011-06-18 19:43:47 +01:00 committed by antirez
parent 96b02dc055
commit ca78446c55
2 changed files with 2 additions and 0 deletions

View File

@ -317,6 +317,7 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
redisLog(REDIS_VERBOSE,"Accepting cluster node: %s", server.neterr); redisLog(REDIS_VERBOSE,"Accepting cluster node: %s", server.neterr);
return; return;
} }
/* IPV6: might want to wrap a v6 address in [] */
redisLog(REDIS_VERBOSE,"Accepted cluster node %s:%d", cip, cport); redisLog(REDIS_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
/* We need to create a temporary node in order to read the incoming /* We need to create a temporary node in order to read the incoming
* packet in a valid contest. This node will be released once we * packet in a valid contest. This node will be released once we

View File

@ -1216,6 +1216,7 @@ void clientCommand(redisClient *c) {
client = listNodeValue(ln); client = listNodeValue(ln);
if (anetPeerToString(client->fd,ip,sizeof(ip),&port) == -1) continue; if (anetPeerToString(client->fd,ip,sizeof(ip),&port) == -1) continue;
/* IPV6: might want to wrap a v6 address in [] */
snprintf(addr,sizeof(addr),"%s:%d",ip,port); snprintf(addr,sizeof(addr),"%s:%d",ip,port);
if (strcmp(addr,c->argv[2]->ptr) == 0) { if (strcmp(addr,c->argv[2]->ptr) == 0) {
addReply(c,shared.ok); addReply(c,shared.ok);