1IP(3) User Contributed Perl Documentation IP(3)
2
3
4
6 NetAddr::IP - Manages IPv4 and IPv6 addresses and subnets
7
9 use NetAddr::IP qw(
10 Compact
11 Coalesce
12 Zero
13 Ones
14 V4mask
15 V4net
16 :aton
17 :old_storable
18 :old_nth
19 );
20
21 my $ip = new NetAddr::IP 'loopback';
22
23 print "The address is ", $ip->addr, " with mask ", $ip->mask, "\n" ;
24
25 if ($ip->within(new NetAddr::IP "127.0.0.0", "255.0.0.0")) {
26 print "Is a loopback address\n";
27 }
28
29 # This prints 127.0.0.1/32
30 print "You can also say $ip...\n";
31
32 * The following four functions return ipV6 representations of:
33
34 :: = Zeros();
35 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF: = Ones();
36 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:: = V4mask();
37 ::FFFF:FFFF = V4net();
38
39 * To accept addresses in the format as returned by inet_aton, invoke
40 the module as:
41
42 use NetAddr::IP qw(:aton);
43
44 * To enable usage of legacy data files containing NetAddr::IP objects
45 stored using the Storable module.
46
47 use NetAddr::IP qw(:old_storable);
48
49 * To compact many smaller subnets (see: "$me->compact($addr1,
50 $addr2,...)"
51
52 @compacted_object_list = Compact(@object_list)
53
54 * Return a reference to list of "NetAddr::IP" subnets of $masklen mask
55 length, when $number or more addresses from @list_of_subnets are found
56 to be contained in said subnet.
57
58 $arrayref = Coalesce($masklen, $number, @list_of_subnets)
59
61 Un-tar the distribution in an appropriate directory and type:
62
63 perl Makefile.PL
64 make
65 make test
66 make install
67
68 NetAddr::IP depends on NetAddr::IP::Util which installs by default with
69 its primary functions compiled using Perl's XS extensions to build a
70 'C' library. If you do not have a 'C' complier available or would like
71 the slower Pure Perl version for some other reason, then type:
72
73 perl Makefile.PL -noxs
74 make
75 make test
76 make install
77
79 This module provides an object-oriented abstraction on top of IP
80 addresses or IP subnets, that allows for easy manipulations. Version
81 4.xx of NetAdder::IP will will work older versions of Perl and does not
82 use Math::BigInt as in previous versions.
83
84 The internal representation of all IP objects is in 128 bit IPv6 nota‐
85 tion. IPv4 and IPv6 objects may be freely mixed.
86
87 Overloaded Operators
88
89 Many operators have been overloaded, as described below:
90
91 Assignment ("=")
92 Has been optimized to copy one NetAddr::IP object to another very
93 quickly.
94
95 "->copy()"
96 The assignment ("=") operation is only put in to operation when the
97 copied object is further mutated by another overloaded operation.
98 See overload SPECIAL SYMBOLS FOR "use overload" for details.
99
100 "->copy()" actually creates a new object when called.
101
102 Stringification
103 An object can be used just as a string. For instance, the following
104 code
105
106 my $ip = new NetAddr::IP '192.168.1.123';
107 print "$ip\n";
108
109 Will print the string 192.168.1.123/32.
110
111 Equality
112 You can test for equality with either "eq" or "==". "eq" allows the
113 comparison with arbitrary strings as well as NetAddr::IP objects.
114 The following example:
115
116 if (NetAddr::IP->new('127.0.0.1','255.0.0.0') eq '127.0.0.1/8')
117 { print "Yes\n"; }
118
119 Will print out "Yes".
120
121 Comparison with "==" requires both operands to be NetAddr::IP
122 objects.
123
124 In both cases, a true value is returned if the CIDR representation
125 of the operands is equal.
126
127 Comparison via >, <, >=, <=, <=> and "cmp"
128 Internally, all network objects are represented in 128 bit format.
129 The numeric representation of the network is compared through the
130 corresponding operation. Comparisons are tried first on the address
131 portion of the object and if that is equal then the cidr portion of
132 the masks are compared.
133
134 Addition of a constant
135 Adding a constant to a NetAddr::IP object changes its address part
136 to point to the one so many hosts above the start address. For
137 instance, this code:
138
139 print NetAddr::IP->new('127.0.0.1') + 5;
140
141 will output 127.0.0.6/8. The address will wrap around at the broad‐
142 cast back to the network address. This code:
143
144 print NetAddr::IP->new('10.0.0.1/24') + 255;
145
146 outputs 10.0.0.0/24.
147
148 Substraction of a constant
149 The complement of the addition of a constant.
150
151 Auto-increment
152 Auto-incrementing a NetAddr::IP object causes the address part to
153 be adjusted to the next host address within the subnet. It will
154 wrap at the broadcast address and start again from the network
155 address.
156
157 Auto-decrement
158 Auto-decrementing a NetAddr::IP object performs exactly the oppo‐
159 site of auto-incrementing it, as you would expect.
160
161 Serializing and Deserializing
162
163 This module defines hooks to collaborate with Storable for serializing
164 "NetAddr::IP" objects, through compact and human readable strings. You
165 can revert to the old format by invoking this module as
166
167 use NetAddr::IP ':old_storable';
168
169 You must do this if you have legacy data files containing NetAddr::IP
170 objects stored using the Storable module.
171
172 Methods
173
174 "->new([$addr, [ $mask⎪IPv6 ]])"
175 "->new6([$addr, [ $mask]])"
176 These methods creates a new address with the supplied address in
177 $addr and an optional netmask $mask, which can be omitted to get a
178 /32 or /128 netmask for IPv4 / IPv6 addresses respectively
179
180 "->new6" marks the address as being in ipV6 address space even if
181 the format would suggest otherwise.
182
183 i.e. ->new6('1.2.3.4') will result in ::102:304
184
185 addresses submitted to ->new in ipV6 notation will
186 remain in that notation permanently. i.e.
187 ->new('::1.2.3.4') will result in ::102:304
188 whereas new('1.2.3.4') would print out as 1.2.3.4
189
190 See "STRINGIFICATION" below.
191
192 $addr can be almost anything that can be resolved to an IP address
193 in all the notations I have seen over time. It can optionally con‐
194 tain the mask in CIDR notation.
195
196 prefix notation is understood, with the limitation that the range
197 speficied by the prefix must match with a valid subnet.
198
199 Addresses in the same format returned by "inet_aton" or "gethostby‐
200 name" can also be understood, although no mask can be specified for
201 them. The default is to not attempt to recognize this format, as it
202 seems to be seldom used.
203
204 To accept addresses in that format, invoke the module as in
205
206 use NetAddr::IP ':aton'
207
208 If called with no arguments, 'default' is assumed.
209
210 $addr can be any of the following and possibly more...
211
212 n.n
213 n.n/mm
214 n.n.n
215 n.n.n/mm
216 n.n.n.n
217 n.n.n.n/mm 32 bit cidr notation
218 n.n.n.n/m.m.m.m
219 loopback, localhost, broadcast, any, default
220 x.x.x.x/host
221 0xABCDEF, 0b111111000101011110, (a bcd number)
222 a netaddr as returned by 'inet_aton'
223
224 Any RFC1884 notation
225
226 ::n.n.n.n
227 ::n.n.n.n/mmm 128 bit cidr notation
228 ::n.n.n.n/::m.m.m.m
229 ::x:x
230 ::x:x/mmm
231 x:x:x:x:x:x:x:x
232 x:x:x:x:x:x:x:x/mmm
233 x:x:x:x:x:x:x:x/m:m:m:m:m:m:m:m any RFC1884 notation
234 loopback, localhost, unspecified, any, default
235 ::x:x/host
236 0xABCDEF, 0b111111000101011110 within the limits
237 of perl's number resolution
238 123456789012 a 'big' bcd number i.e. Math::BigInt
239
240 If called with no arguments, 'default' is assumed.
241
242 "->broadcast()"
243 Returns a new object refering to the broadcast address of a given
244 subnet. The broadcast address has all ones in all the bit positions
245 where the netmask has zero bits. This is normally used to address
246 all the hosts in a given subnet.
247
248 "->network()"
249 Returns a new object refering to the network address of a given
250 subnet. A network address has all zero bits where the bits of the
251 netmask are zero. Normally this is used to refer to a subnet.
252
253 "->addr()"
254 Returns a scalar with the address part of the object as an IPv4 or
255 IPv6 text string as appropriate. This is useful for printing or for
256 passing the address part of the NetAddr::IP object to other compo‐
257 nents that expect an IP address. If the object is an ipV6 address
258 or was created using ->new6($ip) it will be reported in ipV6 hex
259 format otherwise it will be reported in dot quad format only if it
260 resides in ipV4 address space.
261
262 "->mask()"
263 Returns a scalar with the mask as an IPv4 or IPv6 text string as
264 described above.
265
266 "->masklen()"
267 Returns a scalar the number of one bits in the mask.
268
269 "->bits()"
270 Returns the width of the address in bits. Normally 32 for v4 and
271 128 for v6.
272
273 "->version()"
274 Returns the version of the address or subnet. Currently this can be
275 either 4 or 6.
276
277 "->cidr()"
278 Returns a scalar with the address and mask in CIDR notation. A
279 NetAddr::IP object stringifies to the result of this function.
280 (see comments about ->new6() and ->addr() for output formats)
281
282 "->aton()"
283 Returns the address part of the NetAddr::IP object in the same for‐
284 mat as the "inet_aton()" or "ipv6_aton" function respectively. If
285 the object was created using ->new6($ip), the address returned will
286 always be in ipV6 format, even for addresses in ipV4 address space.
287
288 "->range()"
289 Returns a scalar with the base address and the broadcast address
290 separated by a dash and spaces. This is called range notation.
291
292 "->prefix()"
293 Returns a scalar with the address and mask in ipV4 prefix represen‐
294 tation. This is useful for some programs, which expect its input to
295 be in this format. This method will include the broadcast address
296 in the encoding.
297
298 "->nprefix()"
299 Just as "->prefix()", but does not include the broadcast address.
300
301 "->numeric()"
302 When called in a scalar context, will return a numeric representa‐
303 tion of the address part of the IP address. When called in an array
304 contest, it returns a list of two elements. The first element is as
305 described, the second element is the numeric representation of the
306 netmask.
307
308 This method is essential for serializing the representation of a
309 subnet.
310
311 "->wildcard()"
312 When called in a scalar context, returns the wildcard bits corre‐
313 sponding to the mask, in dotted-quad or ipV6 format as applicable.
314
315 When called in an array context, returns a two-element array. The
316 first element, is the address part. The second element, is the
317 wildcard translation of the mask.
318
319 "->short()"
320 Returns the address part in a short or compact notation.
321
322 (ie, 127.0.0.1 becomes 127.1).
323
324 Works with both, V4 and V6.
325
326 "$me->contains($other)"
327 Returns true when $me completely contains $other. False is returned
328 otherwise and "undef" is returned if $me and $other are not both
329 "NetAddr::IP" objects.
330
331 "$me->within($other)"
332 The complement of "->contains()". Returns true when $me is com‐
333 pletely con tained within $other.
334
335 Note that $me and $other must be "NetAddr::IP" objects.
336
337 "->split($bits)"
338 Returns a list of objects, representing subnets of $bits mask pro‐
339 duced by splitting the original object, which is left unchanged.
340 Note that $bits must be longer than the original mask in order for
341 it to be splittable.
342
343 Note that $bits can be given as an integer (the length of the mask)
344 or as a dotted-quad. If omitted, a host mask is assumed.
345
346 "->splitref($bits)"
347 A (faster) version of "->split()" that returns a reference to a
348 list of objects instead of a real list. This is useful when large
349 numbers of objects are expected.
350
351 Return undef if the number of subnets > 2 ** 32
352
353 "->hostenum()"
354 Returns the list of hosts within a subnet.
355
356 "->hostenumref()"
357 Faster version of "->hostenum()", returning a reference to a list.
358
359 "$me->compact($addr1, $addr2, ...)"
360 "@compacted_object_list = Compact(@object_list)"
361 Given a list of objects (including $me), this method will compact
362 all the addresses and subnets into the largest (ie, least specific)
363 subnets possible that contain exactly all of the given objects.
364
365 Note that in versions prior to 3.02, if fed with the same IP sub‐
366 nets multiple times, these subnets would be returned. From 3.02 on,
367 a more "correct" approach has been adopted and only one address
368 would be returned.
369
370 Note that $me and all $addr's must be "NetAddr::IP" objects.
371
372 "$me->compactref(\@list)"
373 As usual, a faster version of =item "->compact()" that returns a
374 reference to a list. Note that this method takes a reference to a
375 list instead.
376
377 Note that $me must be a "NetAddr::IP" object.
378
379 "$me->coalesce($masklen, $number, @list_of_subnets)"
380 "$arrayref = Coalesce($masklen,$number,@list_of_subnets)"
381 Will return a reference to list of "NetAddr::IP" subnets of
382 $masklen mask length, when $number or more addresses from
383 @list_of_subnets are found to be contained in said subnet.
384
385 Subnets from @list_of_subnets with a mask shorter than $masklen are
386 passed "as is" to the return list.
387
388 Subnets from @list_of_subnets with a mask longer than $masklen will
389 be counted (actually, the number of IP addresses is counted)
390 towards $number.
391
392 Called as a method, the array will include $me.
393
394 WARNING: the list of subnet must be the same type. i.e ipV4 or ipV6
395
396 "->first()"
397 Returns a new object representing the first usable IP address
398 within the subnet (ie, the first host address).
399
400 "->last()"
401 Returns a new object representing the last usable IP address within
402 the subnet (ie, one less than the broadcast address).
403
404 "->nth($index)"
405 Returns a new object representing the n-th usable IP address within
406 the subnet (ie, the n-th host address). If no address is available
407 (for example, when the network is too small for $index hosts),
408 "undef" is returned.
409
410 Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
411 implements "->nth($index)" and "->num()" exactly as the documenta‐
412 tion states. Previous versions behaved slightly differently and
413 not in a consistent manner. See the README file for details.
414
415 To use the old behavior for "->nth($index)" and "->num()":
416
417 use NetAddr::IP::Lite qw(:old_nth);
418
419 "->num()"
420 Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
421 Returns the number of usable addresses IP addresses within the sub‐
422 net, not counting the broadcast or network address. Previous ver‐
423 sions returned th number of IP addresses not counting the broadcast
424 address.
425
426 To use the old behavior for "->nth($index)" and "->num()":
427
428 use NetAddr::IP::Lite qw(:old_nth);
429
430 "->re()"
431 Returns a Perl regular expression that will match an IP address
432 within the given subnet. Defaults to ipV4 notation. Will return an
433 ipV6 regex if the address in not in ipV4 space.
434
435 "->re6()"
436 Returns a Perl regular expression that will match an IP address
437 within the given subnet. Always returns an ipV6 regex.
438
440 Compact
441 Coalesce
442 Zero
443 Ones
444 V4mask
445 V4net
446
448 $Id: IP.pm,v 4.4 2006/08/17 01:00:54 lem Exp $
449
450 0.01
451 * original version; Basic testing and release to CPAN as
452 version 0.01. This is considered beta software.
453
454 0.02
455 * Multiple changes to fix endiannes issues. This code is now
456 moderately tested on Wintel and Sun/Solaris boxes.
457
458 0.03
459 * Added ->first and ->last methods. Version changed to 0.03.
460
461 1.00
462 * Implemented ->new_subnet. Version changed to 1.00.
463
464 * less croak()ing when improper input is fed to the module. A
465 more consistent 'undef' is returned now instead to allow the
466 user to better handle the error.
467
468 1.10
469 * As per Marnix A. Van Ammers [mav6@ns02.comp.pge.com]
470 suggestion, changed the syntax of the loop in host_enum to be
471 the same of the enum method.
472
473 * Fixed the MS-DOS ^M at the end-of-line problem. This should
474 make the module easier to use for *nix users.
475
476 1.20
477 * Implemented ->compact and ->expand methods.
478
479 * Applying for official name
480
481 1.21
482 * Added ->addr_number and ->mask_bits. Currently we return
483 normal numbers (not BigInts). Please test this in your
484 platform and report any problems!
485
486 2.00
487 * Released under the new *official* name of NetAddr::IP
488
489 2.10
490 * Added support for ->new($min, $max, $bits) form
491
492 * Added ->to_numeric. This helps serializing objects
493
494 2.20
495 * Chris Dowling reported that the sort method introduced in
496 v1.20 for ->expand and ->compact doesn't always return a
497 number under perl versions < 5.6.0. His fix was applied and
498 redistributed. Thanks Chris!
499
500 * This module is hopefully released with no CR-LF issues!
501
502 * Fixed a warning about uninitialized values during make test
503
504 2.21
505 * Dennis Boylan pointed out a bug under Linux and perhaps
506 other platforms as well causing the error "Sort subroutine
507 didn't return single value at
508 /usr/lib/perl5/site_perl/5.6.0/NetAddr/IP.pm line 299, <>
509 line 2." or similar. This was fixed.
510
511 2.22
512 * Some changes suggested by Jeroen Ruigrok and Anton Berezin
513 were included. Thanks guys!
514
515 2.23
516 * Bug fix for /XXX.XXX.XXX.XXX netmasks under v5.6.1 suggested by
517 Tim Wuyts. Thanks!
518
519 * Tested the module under MACHTYPE=hppa1.0-hp-hpux11.00. It is
520 now konwn to work under Linux (Intel/AMD), Digital Unix
521 (Alpha), Solaris (Sun), HP-UX11 (HP-PA-RISC), Windows
522 9x/NT/2K (using ActiveState on Intel).
523
524 2.24
525 * A spurious warning when expand()ing with "-w" under certain
526 circumstances was removed. This involved using /31s, /32s
527 and the same netmask as the input. Thanks to Elie Rosenblum
528 for pointing it out.
529
530 * Slight change in license terms to ease redistribution as a
531 Debian package.
532
533 3.00
534 This is a major rewrite, supposed to fix a number of issues
535 pointed out in earlier versions.
536
537 The goals for this version include getting rid of BigInts, speeding
538 up and also cleaning up the code, which is written in a modular
539 enough way so as to allow IPv6 functionality in the future, tak‐
540 ing benefit from most of the methods.
541
542 Note that no effort has been made to remain backwards compatible
543 with earlier versions. In particular, certain semantics of the ear‐
544 lier versions have been removed in favor of faster performance.
545
546 This version was tested under Win98/2K (ActiveState
547 5.6.0/5.6.1), HP-UX11 on PA-RISC (5.6.0), RedHat Linux 6.2
548 (5.6.0), Digital Unix on Alpha (5.6.0), Solaris on Sparc (5.6.0)
549 and possibly others.
550
551 3.01
552 * Added "->numeric()".
553
554 * "->new()" called with no parameters creates a default
555 NetAddr::IP object.
556
557 3.02
558 * Fxed "->compact()" for cases of equal subnets or mutually-con‐
559 tained IP addresses as pointed out by Peter Wirdemo. Note that
560 now only distinct IP addresses will be returned by this method.
561
562 * Fixed the docs as suggested by Thomas Linden.
563
564 * Introduced overloading to ease certain common operations.
565
566 *
567 Fixed compatibility issue with C<-E<gt>num()> on 64-bit processors.
568
569 3.03
570 * Added more comparison operators.
571
572 * As per Peter Wirdemo's suggestion, added "->wildcard()" for
573 producing subnets in wildcard format.
574
575 * Added "++" and "+" to provide for efficient iteration opera‐
576 tions over all the hosts of a subnet without "->expand()"ing
577 it.
578
579 3.04
580 * Got rid of "croak()" when invalid input was fed to "->new()".
581
582 * As suggested by Andrew Gaskill, added support for prefix nota‐
583 tion. Thanks for the code of the initial "->prefix()" function.
584
585 3.05
586 * Added support for range notation, where base and broadcast
587 addresses are given as arguments to "->new()".
588
589 3.06
590 * Andrew Ruthven pointed out a bug related to proper interpreta‐
591 tion of "compact" CIDR blocks. This was fixed. Thanks!
592
593 3.07
594 * Sami Pohto pointed out a bug with "->last()". This was fixed.
595
596 * A small bug related to parsing of 'localhost' was fixed.
597
598 3.08
599 * By popular request, "->new()" now checks the sanity of the net‐
600 masks it receives. If the netmask is invalid, "undef" will be
601 returned.
602
603 3.09
604 * Fixed typo that invalidated otherwise correct masks. This bug
605 appeared in 3.08.
606
607 3.10
608 * Fixed relops. Semantics where adjusted to remove the netmask
609 from the comparison. (ie, it does not make sense to say that
610 10.0.0.0/24 is > 10.0.0.0/16 or viceversa).
611
612 3.11
613 * Thanks to David D. Zuhn for contributing the "->nth()" method.
614
615 * tutorial.htm now included in the distribution. I hope this
616 helps some people to better understand what kind of stuff can
617 be done with this module.
618
619 * 'any' can be used as a synonim of 'default'. Also, 'host' is
620 now a valid (/32) netmask.
621
622 3.12
623 * Added CVS control files, though this is of no relevance to the
624 community.
625
626 * Thanks to Steve Snodgrass for pointing out a bug in the pro‐
627 cessing of the special names such as default, any, etc. A fix
628 was produced and adequate tests were added to the code.
629
630 * First steps towards "regexp free" parsing.
631
632 * Documentation revisited and reorganized within the file, so
633 that it helps document the code.
634
635 * Added "->aton()" and support for this format in "->new()". This
636 makes the code helpful to interface with old-style socket code.
637
638 3.13
639 * Fixes a warning related to 'wrapping', introduced in 3.12 in
640 "pack()"/"unpack()" for the new support for "->aton()".
641
642 3.14
643 * "Socket::gethostbyaddr" in Solaris seems to behave a bit dif‐
644 ferent from other OSes. Reversed change in 3.13 and added code
645 around this difference.
646
647 3.14_1
648 This is an interim release just to incorporate the v6 patches con‐
649 tributed. No extensive testing has been done with this support
650 yet. More tests are needed.
651
652 * Preliminary support for IPv6 contributed by Kadlecsik Jozsi
653 <kadlec at sunserv.kfki.hu>. Thanks a lot!
654
655 * IP.pm and other files are enconded in ISO-8859-1 (Latin1) so
656 that I can spell my name properly.
657
658 * Tested under Perl 5.8.0, no surprises found.
659
660 3.14_2
661 Minor development release.
662
663 * Added "->version" and "->bits", including testing.
664
665 * "Compact" can now be exported if the user so requests.
666
667 * Fixed a bug when octets in a dotted quad were > 256 (ie, were
668 not octets). Thanks to Anton Berezin for pointing this out.
669
670 3.14_3
671 Fixed a bug pointed out by Brent Imhoff related to the implicit
672 comparison that happens within "Compact()". The netmask was being
673 ignored in the comparison (ie, 10/8 was considered the same as
674 10.0/16). Since some people have requested that 10.0/16 was consid‐
675 ered larger than 10/8, I added this change, which makes the bug go
676 away. This will be the last '_' release, pending new bugs.
677
678 Regarding the comparison of subnets, I'm still open to debate so as
679 to wether 10.0/16 > 10/8. Certainly 255.255.0.0 > 255.0.0.0, but 2
680 ** 24 are more hosts than 2 ** 16. I think we might use gt &
681 friends for this semantic and make everyone happy, but I won't do
682 anything else here without (significant) feedback.
683
684 3.14_4
685 As noted by Michael, 127/8 should be 127.0.0.0/8 and not
686 0.0.0.128/8. Also, improved docs on the usage of contains() and
687 friends.
688
689 3.15
690 Finally. Added POD tests (and fixed minor doc bug in IP.pm). As
691 reported by Anand Vijay, negative numbers are assumed to be signed
692 ints and converted accordingly to a v4 address. split() and nth()
693 now work with IPv6 addresses (Thanks to Venkata Pingali for report‐
694 ing). Tests were added for v6 base functionality and splitting.
695 Also tests for bitwise aritmethic with long integers has been
696 added. I'm afraid Math::BigInt is now required.
697
698 Note that IPv6 might not be as solid as I would like. Be careful...
699
700 3.16
701 Fixed a couple of (minor) bugs in shipped tests in the last ver‐
702 sion. Also, fixed a small pod typo that caused code to show up in
703 the documentation.
704
705 3.17
706 Fixed IP.pm so that all test could pass in Solaris machines. Thanks
707 to all who reported this.
708
709 3.18
710 Fixed some bugs pointed out by David Lloyd, having to do with the
711 module packaging and version requirements. Thanks David!
712
713 3.19
714 Fixed a bug pointed out by Andrew D. Clark, regarding proper pars‐
715 ing of IP ranges with non-contiguous masks. Thanks Andrew!
716
717 3.20
718 Suggestion by Reuland Olivier gave birth to "short()", which pro‐
719 vides for a compact representation of the IP address. Rewrote
720 "_compact" to find the longest sequence of zeros to compact. Reu‐
721 land also pointed out a flaw in contains() and within(), which was
722 fixed. Thanks Reuland!
723
724 Fixed rt bug #5478 in t/00-load.t.
725
726 3.21
727 Fixed minor v-string problem pointed out by Steve Snodgrass (Thanks
728 Steve!). NetAddr::IP can now collaborate with Storable to serialize
729 itself.
730
731 3.22
732 Fixed bug rt.cpan.org #7070 reported by Grover Browning
733 (auto-inc/dec on v6 fails). Thanks Grover. Ruben van Staveren
734 pointed out a bug in v6 canonicalization, as well as providing a
735 patch that was applied. Thanks Ruben.
736
737 3.23
738 Included support for Module::Signature. Added ->re() as contributed
739 by Laurent Facq (Thanks Laurent!). Added Coalesce() as suggested by
740 Perullo.
741
742 3.24
743 Version bump. Transfer of 3.23 to CPAN ended up in a truncated file
744 being uploaded.
745
746 3.25
747 Some IP specs resembling range notations but not depicting actual
748 CIDR ranges, were being erroneously recognized. Thanks to Steve
749 Snodgrass for reporting a bug with parsing IP addresses in 4-octet
750 binary format. Added optional Pod::Coverage tests. compact_addr has
751 been commented out, after a long time as deprecated. Improved speed
752 of ->new() for the case of a single host IPv4 address, which seems
753 to be the most common one.
754
755 4.00
756 Dependence on Math::BigInt removed, works with earlier versions of
757 Perl. The module was partitioned into three logical pieces as fol‐
758 lows:
759
760 Util.pm Math and logic operation on bit strings and number
761 that represent IP addresses and masks. Conversions
762 between various number formats. Implemented in
763 C_XS for speed and PURE PERL of transportability.
764
765 Lite.pm Operations, simple conversions and comparisons of
766 IP addresses, notations and formats.
767
768 IP.pm Complex operations and conversions of IP address
769 notation, nets, subnets, and ranges.
770
771 The internal representation of addresses was changed to 128 bit
772 binary strings as returned by inet_pton (ipv6_aton in this module).
773 Both ipV4 and ipV6 notations can be freely mixed and matched.
774
775 Additional methods added to force operations into ipV6 space even
776 when ipV4 notation is used.
777
779 Luis E. Muñoz <luismunoz@cpan.org>, Michael Robinton <michael@bizsys‐
780 tems.com>
781
783 This software comes with the same warranty as perl itself (ie, none),
784 so by using it you accept any and all the liability.
785
787 This software is (c) Luis E. Muñoz, 1999 - 2005, and (c) Michael Robin‐
788 ton, 2006. It can be used under the terms of the perl artistic license
789 provided that proper credit for the work of the author is preserved in
790 the form of this copyright notice and license for this module.
791
793 perl(1)
794
795 L<NetAddr::IP::Lite>
796
797 L<NetAddr::IP::Util>
798
799
800
801perl v5.8.8 2007-07-11 IP(3)