You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2017/08/07 21:21:00 UTC

[jira] [Commented] (LUCENE-7920) Make it easier to create ip prefix queries

    [ https://issues.apache.org/jira/browse/LUCENE-7920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16117325#comment-16117325 ] 

Robert Muir commented on LUCENE-7920:
-------------------------------------

I'm concerned this is really the right thing to do: because these are in fact ipv4 addresses (just with a different representation).

the spirit of the RFC is kind of against it here: https://www.ietf.org/rfc/rfc4038.txt

{quote}
   However, IPv6 applications must not be required to distinguish
   "normal" and "NAT-PT translated" addresses (or any other kind of
   special addresses, including the IPv4-mapped IPv6 addresses): This
   would be completely impractical, and if the distinction must be made,
   it must be done elsewhere (e.g., kernel, system libraries).
{quote}

Also, taking raw byte[] here looks very error prone. at the very least it would need checks that the byte[] is of the correct length (32 or 128 bits only), etc etc.


> Make it easier to create ip prefix queries
> ------------------------------------------
>
>                 Key: LUCENE-7920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7920
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Priority: Minor
>         Attachments: LUCENE-7920.patch
>
>
> {{InetAddress.getByAddress}} automatically transforms ipv6-mapped ipv4 addresses to ipv4 addresses. While this is usually desirable, it can make ip prefix query a bit trappy. For instance the following code:
> {code}
> InetAddressPoint.newPrefixQuery("a", InetAddress.getByName("::ffff:0:0"), 96);
> {code}
> throws an IAE complaining that the prefix length is invalid: {{illegal prefixLength '96'. Must be 0-32 for IPv4 ranges, 0-128 for IPv6 ranges}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org