Skip to content

bug: normalizeIPv6 does not normalize correct when double colon is already added #89

@Uzlopak

Description

@Uzlopak

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

normalizeIPv6 in utils can not properly normalize IPv6 addresses. Hard to describe, so here an example:

::0000:1 has to be normalized to ::1 but it is normalized to :::1
1::1:0:0:1has to be normalized to 1::1:0:0:1but is normalized to 1::1:::1

So basically in the normalizeIPv6 function we have to track if we already added the double colon, and if so, dont add again a double colon.
Also if we have added a double colon following hextets with 0 need to be written out.

In #88 I modified already the stringArrayToHexStripped I added a second parameter called keepZero. So if we already added a double colon followed by a non-zero hextet, we have to track to keep the zero and if we have following 0 hextets we have to set in stringArrayToHexStripped the parameter keepZero to true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions