-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subnet info is lost when converting to v4 address. #123
Comments
What would imply /24 as the default for you? An address without netmask normally means "host" address, even one that ends in Quick quest for an example gives me When operating with different addresses it's best to assume nothing and treat all addresses without netmask as individual hosts, which is an equivalent of /32 subnet |
Hmm, I'm not sure if I foresaw that use case, of instantiating from an
Address4 with a subnet and then converting back to an Address4… will have
to figure out how to work correctly!
if I remember correctly `parsedAddress4` should be viewed as internal,
though
…On Thu, Nov 05, 2020 at 5:10 AM, momchil-anachkov ***@***.***> wrote:
Hi there,
It seems when converting to a v4 from a v6 address the the resulting v4
address does not retain any of the subnet information even when coming from
a "v4 in v6" address.
Steps to reproduce:
const a = Address6.fromAddress4('192.168.0.1/24'); // 24 bit maskconsole.log(a.address); // ::ffff:192.168.0.1/120console.log(a.subnet); // '/120'console.log(a.subnetMask); // 120console.log(a.is4()); // trueconsole.log(a.v4); // true
// This is where the funkiness starts
console.log(a.parsedAddress4); // '192.168.0.1' -- no maskconsole.log(a.address4.address); // '192.168.0.1' -- no maskconsole.log(a.to4().subnet); // '/32'console.log(a.to4().subnetMask); // 32
I was expecting if the address is a valid v4 address for it to be
preserved with the subnet (24), and not get the default (32).
Am I missing something?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#123>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAPCX2NXIQAEMSN3QY7L23SOKP3PANCNFSM4TLK66DA>
.
|
Nothing implies that. Please read the code example. 🙂 |
I see. Thanks. I'll keep that in mind.
That's okay. It's easy-enough to do some math as a consumer and figure things out. In this case the ipv6 address has a mask of It's just some weird behaviour that I noticed, and thought I'd bring it up. 🙂 Thanks for looking into it. Cheers 🥂 |
Hi there,
It seems when converting to a v4 from a v6 address the the resulting v4 address does not retain any of the subnet information even when coming from a "v4 in v6" address.
Steps to reproduce:
I was expecting if the address is a valid v4 address for it to be preserved with the subnet (24), and not get the default (32).
Am I missing something?
Cheers
The text was updated successfully, but these errors were encountered: