Skip to content
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

IPv4 address within IPv6 in segment form not correctly recognised #62

Open
lloydk04 opened this issue Dec 15, 2017 · 0 comments
Open

IPv4 address within IPv6 in segment form not correctly recognised #62

lloydk04 opened this issue Dec 15, 2017 · 0 comments

Comments

@lloydk04
Copy link

Parsing of a v4 address within v6 in octet format is correctly recognised as v4

const ipAddress = require('ip-address');
v6Address = new ipAddress.Address6('::ffff:127.0.0.1');
> Address6 {
  groups: 8,
  v4: true,
  subnet: '/128',
  subnetMask: 128,
  zone: '',
  address: '::ffff:127.0.0.1',
  addressMinusSuffix: '::ffff:127.0.0.1',
  elidedGroups: 5,
  elisionBegin: 0,
  elisionEnd: 5,
  valid: true,
  parsedAddress: [ '0', '0', '0', '0', '0', 'ffff', '7f00', '1' ] }
v6Address.v4
> true

but, not when in segment (hex) format. The following should be equivalent to the above address

v6Address = new ipAddress.Address6('::ffff:7f00:0001');
> Address6 {
  groups: 8,
  v4: false,
  subnet: '/128',
  subnetMask: 128,
  zone: '',
  address: '::ffff:7f00:0001',
  addressMinusSuffix: '::ffff:7f00:0001',
  elidedGroups: 5,
  elisionBegin: 0,
  elisionEnd: 5,
  valid: true,
  parsedAddress: [ '0', '0', '0', '0', '0', 'ffff', '7f00', '1' ] }
v6Address.v4
> false

As I understand it (https://en.wikipedia.org/wiki/IPv6_address and elsewhere) both representations are valid (and equivalent).

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

No branches or pull requests

1 participant