[GH-ISSUE #18] Make sure IPv6 addresses are stored "compressed" #15

Closed
opened 2026-02-28 14:15:48 +03:00 by kerem · 1 comment
Owner

Originally created by @abh on GitHub (Jun 4, 2011).
Original GitHub issue: https://github.com/abh/ntppool/issues/18

We need to make sure we normalize the IPv6 addresses when the servers are added. We could either do it with two unsigned BIGINTs (and store them numerically); but the space isn't really a concern and it's convenient to have them easily readable I think; so better to keep storing them like we are now – but normalized ...

Some of the IP related CPAN modules have a "compress IPv6 address" function or method; but I haven't looked too closely at any of them (they all have terrible APIs). Net::IP::XS seemed promising.

Originally created by @abh on GitHub (Jun 4, 2011). Original GitHub issue: https://github.com/abh/ntppool/issues/18 We need to make sure we normalize the IPv6 addresses when the servers are added. We could either do it with two unsigned BIGINTs (and store them numerically); but the space isn't really a concern and it's convenient to have them easily readable I think; so better to keep storing them like we are now – but normalized ... Some of the IP related CPAN modules have a "compress IPv6 address" function or method; but I haven't looked too closely at any of them (they all have terrible APIs). Net::IP::XS seemed promising.
kerem closed this issue 2026-02-28 14:15:49 +03:00
Author
Owner

@loewis commented on GitHub (Jun 5, 2011):

The standard approach is to use inet_pton for normalization:

use Socket qw(inet_pton inet_ntop AF_INET6);
die inet_ntop(AF_INET6, inet_pton(AF_INET6, '0:1:0:0::2'));

gives 0:1::2

<!-- gh-comment-id:1303641 --> @loewis commented on GitHub (Jun 5, 2011): The standard approach is to use inet_pton for normalization: ``` perl use Socket qw(inet_pton inet_ntop AF_INET6); die inet_ntop(AF_INET6, inet_pton(AF_INET6, '0:1:0:0::2')); ``` gives 0:1::2
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntppool#15
No description provided.