Not a bug Incorrect IP address format for local addresses in mod log

Chris D

XenForo developer
Staff member
This only really applies to local addresses and doesn't seem to adversely affect any thing else.

upload_2014-2-1_11-30-53.png

The IP address on my dev install for the moderator log is 0.0.0.0, yet entries against my name in the admin log is more correct:

upload_2014-2-1_11-30-27.png

As it stands looks quite minor, but I thought I'd better mention it in case it's indicative of issues with non-local addresses also.
 

Attachments

Mike

XenForo developer
Staff member
I'm not "not a bug"ing this as I'm not positive it's not a bug.

The addresses should be converted. Can you send me a dump of your moderator log table? Ideally, from 1.2 and 1.3. I'd need to see what data is in the table and how it got converted.
 

Chris D

XenForo developer
Staff member
As it's my dev board, and not set up in a mission critical way I didn't do a backup prior to moving to 1.3.

However, here's the mod log table as it is now:

upload_2014-2-1_12-47-9.png

No IP address. The first one shows as 0.0.0.0 in the template as pictured above.

The second shows as ::1 which is what I was expecting which prompted the report.

upload_2014-2-1_12-47-59.png

It's interesting that they have the same value, yet, appear differently in the log.

So I thought I'd do a Zend_Debug::dump($entry) in XenForo_ModeratorLog_Abstract::prepareEntry:

Code:
array(15) {
["moderator_log_id"] => int(2)
["log_date"] => int(1391254315)
["user_id"] => int(1)
["content_type"] => string(6) "thread"
["content_id"] => int(2)
["content_user_id"] => int(1)
["content_username"] => string(13) "Chris Deeming"
["content_title"] => string(16) "Testing a thread"
["content_url"] => string(37) "index.php?threads/testing-a-thread.2/"
["discussion_content_type"] => string(6) "thread"
["discussion_content_id"] => int(2)
["action"] => string(4) "move"
["action_params"] => string(21) "{"from":"Main Forum"}"
["ip_address"] => string(16) ""
["username"] => string(13) "Chris Deeming"
}

array(15) {
["moderator_log_id"] => int(1)
["log_date"] => int(1390866881)
["user_id"] => int(1)
["content_type"] => string(6) "thread"
["content_id"] => int(1)
["content_user_id"] => int(2)
["content_username"] => string(11) "Test User 1"
["content_title"] => string(8) "A Thread"
["content_url"] => string(29) "index.php?threads/a-thread.1/"
["discussion_content_type"] => string(6) "thread"
["discussion_content_id"] => int(1)
["action"] => string(4) "move"
["action_params"] => string(21) "{"from":"Main Forum"}"
["ip_address"] => string(4) ""
["username"] => string(13) "Chris Deeming"
}
Both are empty strings, but apparently one has a strlen of 16 and one has a strlen of 4 :cautious:
 

Mike

XenForo developer
Staff member
Doing a bit of testing, I think this was happening in 1.2. It appears that access was done via IPv6, which meant that the IP would have been recorded as 0 (since ::1 wasn't a valid IPv4 address), which would then get turned into 0.0.0.0 via long2ip(). Since 1.3 now supports IPv6, it correctly logs the IP, but we don't have the data from before.
 

PASS

Active member
Doing a bit of testing, I think this was happening in 1.2. It appears that access was done via IPv6, which meant that the IP would have been recorded as 0 (since ::1 wasn't a valid IPv4 address), which would then get turned into 0.0.0.0 via long2ip(). Since 1.3 now supports IPv6, it correctly logs the IP, but we don't have the data from before.
I have dozens and dozens of members who all share the 0.0.0.0 IP. I'm runningXF 2.0.x and PHP 7.2.x
Any ideas?

190721

(please move if this belongs in the xf2 section)
 
Last edited:
Top