nextcloud/suspicious_login

Investigate feasibility of use in 32-bit environments

joshtrichards opened this issue · 2 comments

A single dependency that appears to only be used for IPv6 handling currently has a requirement for a 64-bit environment.

This came up during nextcloud/server#43157 (and further context can bge found there).

  • Is this still a hard requirement today?
  • How much work would it take to support IPv6 w/o this requirement?
  • Would it make any sense to adapt the app to still function in 32-bit IPv4-only environments?
st3iny commented

At first glance, it sounds reasonable to get rid or replace this dependency. We'll investigate this dependency further.

st3iny commented

The library is only used to parse an IPv6 address and convert it into a binary representation1.

The same could be achieved by making use of the inet_pton2 built-in:

$hex = bin2hex(inet_pton($ip));

It has been available since PHP 5 and only requires PHP to be compiled with IPv6 support.

Footnotes

  1. https://github.com/nextcloud/suspicious_login/blob/d482467425cdb57c38d83f3446b1dc3b7c1f10c2/lib/Service/IpV6Strategy.php#L53-L54

  2. https://www.php.net/manual/en/function.inet-pton.php