From: barmar@alum.mit.edu   
      
   In article ,   
    Jorgen Grahn wrote:   
      
   > On Sun, 2016-11-27, ElChino wrote:   
   > > I'm having some troubles figuring out the CIDR "prefix length"   
   > > of a IPv6 addresses range.   
   > >   
   > > Specifically, in some code that reads MaxMind's GeoIPv6.dat records,   
   > > the low and high IP-numbers of IPv6-blocks are given like:   
   > > IP-num low: 76:96:42:219::   
   > > IP-num high: 76:96:42:219:ffff:ffff:ffff:ffff   
   > > (belonging to 'United States')   
   > >   
   > > I need to figure out how to print this using CIDR notation.   
   > > E.g. if I have the 2 above addresses in   
   > > struct in6_addr a, b;   
   > >   
   > > I've cooked up this function after much head-scratching:   
   > ...   
   > > The above code (+inet_ntop(&a..)) will print "76:96:42:219::/64".   
   > > Does this make sense for you experts?   
   >   
   > I'm no expert and I've not read your code. However, at least the   
   > /result/ is correct. 76:96:42:219:: and 76:96:42:219:ffff:ffff:ffff:ffff   
   > differ after 4 identical words, i.e. 64 bits.   
   >   
   > The best thing would be if people stopped using any notation but   
   > addr/len. Is there any reason to use first--last or address, mask   
   > today? For IPv6?   
      
   Ranges are useful for databases. In SQL can write   
      
   WHERE addr BETWEEN range_start AND range_end   
      
   --   
   Barry Margolin   
   Arlington, MA   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|