Skip to content

Conversation

@rvbcldud
Copy link
Contributor

@rvbcldud rvbcldud commented Aug 8, 2024

Background

This crate states that it supports the use of Ipv4 CIDR notation when defining a range for the IP generator to use. However, during my tests using it I did not find that to be the case. Rather, I got the following error:

Error: InvalidIpNetwork("[BUG] failed to parse the generated IP address `a83:6304` as IPv4")

Furthermore, the test currently fail in lib.rs

Changes

After doing some debugging within the crate itself, I found that when converting from Ipv4 to Ipv6, Ipv4-compatible Ipv6 addresses were used. This type of address "was defined to assist in the IPv6 transition" and is now deprecated as of RFC 4291. Instead of prepending a ::, in the case of the Ipv4-compatible address, ip() should prepend ::fff: (and likewise strip).

Conclusion

This fixes the issues I encountered when trying to generate Ipv4 addresses using this crate and restores the tests in lib.rs to working order.

@rushmorem
Copy link
Contributor

Thank you!

@rushmorem rushmorem merged commit cba8420 into ipgen:main Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants