Index: wp-includes/comment.php
===================================================================
--- wp-includes/comment.php	(revision 13196)
+++ wp-includes/comment.php	(working copy)
@@ -1247,7 +1247,7 @@
 	$parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
 	$commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
 
-	$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
+	$commentdata['comment_author_IP'] = wp_remote_ip();
 	$commentdata['comment_agent']     = substr($_SERVER['HTTP_USER_AGENT'], 0, 254);
 
 	$commentdata['comment_date']     = current_time('mysql');
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 13196)
+++ wp-includes/functions.php	(working copy)
@@ -1302,6 +1302,17 @@
 }
 
 /**
+ * Retrieve the IP address of the user
+ *
+ * @since 3.0.0
+ *
+ * @return string
+ */
+function wp_remote_ip() {
+	return apply_filters('get_ip', preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']));
+}
+
+/**
  * Whether today is a new day.
  *
  * @since 0.71
@@ -4037,4 +4048,4 @@
 function _search_terms_tidy($t) {
 	return trim($t, "\"'\n\r ");
 }
-?>
\ No newline at end of file
+?>
