I bet someone could have used this 10 years ago...

In doing a recent upgrade from D6 to D7, I found that the IP patterns supported vary considerably between the versions. In contrast to the D6 data model, field_ipaddress supports neither comma-separated lists of patterns nor IP ranges (except in the last octet). This patch parses the legacy data so that, for a pattern like "123.123.1-2.*, 456.456.7-8.*", the following records are created in D7:

123.123.1.*
123.123.2.*
456.456.7.*
456.456.8.*

Without this patch, such a pattern is logged in watchdog, and the site administrator is left to update the record manually.

One significant change this patch makes from the original behavior is that it does not check to see if field_ip_login is set on the user account before saving it. Since this is an upgrade/migration step, it seemed an unlikely case that there would already be data in this field. In my case, the upgrade had already done a partial/incomplete migration (because of the unaddressed cases of comma-separated lists and ranges), so it was in fact desirable to overwrite any data in those fields.

Comments

frago created an issue. See original summary.

universalhandle’s picture

Status: Needs review » Needs work
markabur’s picture

Seems to work, but it sure does create a lot of entries. For example, 123.123.1-200.* would create 200 separate field values.

According to #2795765: how define 1.1.1-34.*, it should be possible to use a shorthand format in cases like this. E.g. 123.123.1-200.* could be rewritten as 123.123.1.0 - 123.123.200.255

amateescu’s picture

Status: Needs work » Closed (outdated)

Closing old issues.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.