﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16302	Ensure contrib (namely comments) is IPv6 capable	Dan McGee	Sasha Romijn	"This is a follow-on ticket now that #811 has been implemented. What's the design decision on updating `django.contrib.comments.models` to utilize the new IPv6-capable address field? It appears to be the only core Django application utilizing this field.

It assumes the value of REMOTE_ADDR can be coerced into the field, as you can see in this line from `django/contrib/comments/views/comments.py`:

{{{
comment.ip_address = request.META.get(""REMOTE_ADDR"", None)
}}}

This currently populates PostgreSQL-backed instances correctly if hooked up to an IPv6-capable webserver, but all other databases will fail or truncate (perhaps even silently!) any non-IPv4 value exceeding 15 characters, such as `::ffff:192.168.100.1`. The prudent decision to me seems to be to modify the Comment model to use:

{{{
ip_address  = models.IPAddressField(_('IP address'), unpack_ipv4=True, blank=True, null=True)
}}}

A change like this will require manual database migration for all storage engines that use a char type for this; I'm not sure what your policy (if any) is on that. Either way the end result is no worse than what currently happens with truncation."	Bug	closed	contrib.comments	dev	Normal	fixed	ipv6 sprint2013	eromijn@…	Accepted	1	0	0	0	0	0
