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

Aryan Ganjoo commented on NET-747:
----------------------------------

The proposed fix and regression test are in 
https://github.com/apache/commons-net/pull/412. The default Maven build passed 
locally on the final three-file commit; hosted CI and maintainer review are 
pending.

> SubnetUtils6 rejects IPv4-mapped IPv6 literals and formats mapped range as 
> IPv4
> -------------------------------------------------------------------------------
>
>                 Key: NET-747
>                 URL: https://issues.apache.org/jira/browse/NET-747
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 3.13.0
>            Reporter: Aryan Ganjoo
>            Priority: Major
>
> On current Commons Net master (39a85646d21002de4df6082342485dc2dedecd5a), 
> SubnetUtils6 rejects valid IPv4-mapped IPv6 literals because 
> InetAddress.getByName returns Inet4Address for ::ffff:0:0 and 
> ::ffff:192.0.2.1. It also formats a high address inside ::ffff:0:0/96 as 
> plain IPv4, which cannot round-trip through its IPv6 string API.
> Reproduction:
> 1. new SubnetUtils6("::ffff:0:0/96") throws IllegalArgumentException: Could 
> not parse [::ffff:0:0] - not an IPv6 address.
> 2. new SubnetUtils6("::/80").getInfo().getHighAddress() returns 
> 255.255.255.255 instead of an IPv6 literal; isInRange on that output then 
> rejects it.
> Expected: mapped IPv6 literals remain 128-bit addresses throughout parsing, 
> formatting and range checks. Plain IPv4 input such as 192.0.2.1 should remain 
> rejected.
> A local two-file fix and regression test have been independently reviewed. 
> The focused test was red on unmodified master (31 tests, one error) and green 
> with the fix (31 tests, no failures/errors). The default Maven build is being 
> checked separately; no PR or hosted CI result exists yet. This is distinct 
> from NET-741, which introduced SubnetUtils6.
> Prepared with AI assistance.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to