Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #650
| From | Ralf Döblitz <doeblitz@doeblitz.net> |
|---|---|
| Newsgroups | comp.databases.postgresql |
| Subject | Re: how to count the number of ipv6 addresses in a range? |
| Date | 2015-04-03 13:17 +0000 |
| Organization | private site in Braunschweig, Germany |
| Message-ID | <mfm3u7$lr8$2@selene.doeblitz.net> (permalink) |
| References | <55197d18$0$2962$426a34cc@news.free.fr> <mfcaof$bmu$1@dont-email.me> <551a4f3d$0$3031$426a34cc@news.free.fr> <mfjrt4$m8m$2@selene.doeblitz.net> <551e3ca9$0$3053$426a74cc@news.free.fr> |
Mateusz Viste <mateusz.viste@localhost> wrote:
> On 02/04/2015 18:48, Ralf Döblitz wrote:
>> I would use the binary logarithm of the number of addresses.
>
> That's the core of the problem in fact :) the "number of addresses" is
> uncomputable, so any transformation thereof is not possible either:
>
> nsidb=# select log(2,('ff00::'::inet - 'fd00::'::inet));
> ERROR: result is out of range
> nsidb=#
Looks like you will have to program that computation yourself to avoid
getting overflows for interim results. Build the complete bitmaps of the
addresses, compare them for matching leading part, then advance to the
end, incrementally calculating the sum with the desired precision (maybe
the number of /64 nets is sufficient for your purpose).
Ralf
--
"ceterum censeo systemd esse delendam"
Ralf Döblitz * Schapenstraße 6 * 38104 Braunschweig * Germany
Mit UTF-8 kann man gleichzeitig äöüßÄÖÜæœłø‱¼½¾¤¹²³¢€£¥¶§¬÷×±©®™¡¿ verwenden …
Back to comp.databases.postgresql | Previous | Next — Previous in thread | Find similar
how to count the number of ipv6 addresses in a range? Mateusz Viste <mateusz.viste@localhost> - 2015-03-30 18:43 +0200
Re: how to count the number of ipv6 addresses in a range? "M. Strobel" <strobel@example.com> - 2015-03-30 22:13 +0200
Re: how to count the number of ipv6 addresses in a range? "M. Strobel" <strobel@example.com> - 2015-03-31 01:25 +0200
Re: how to count the number of ipv6 addresses in a range? Mateusz Viste <mateusz.viste@localhost> - 2015-03-31 09:39 +0200
Re: how to count the number of ipv6 addresses in a range? "M. Strobel" <strobel@example.com> - 2015-03-31 09:56 +0200
Re: how to count the number of ipv6 addresses in a range? Mateusz Viste <mateusz.viste@localhost> - 2015-03-31 11:03 +0200
Re: how to count the number of ipv6 addresses in a range? Ralf Döblitz <doeblitz@doeblitz.net> - 2015-04-02 16:48 +0000
Re: how to count the number of ipv6 addresses in a range? Mateusz Viste <mateusz.viste@localhost> - 2015-04-03 09:09 +0200
Re: how to count the number of ipv6 addresses in a range? Ralf Döblitz <doeblitz@doeblitz.net> - 2015-04-03 13:17 +0000
csiph-web