marvin-zhao / ipaddr-py

Automatically exported from code.google.com/p/ipaddr-py
0 stars 0 forks source link

no property IPv4Address.is_unspecified (as opposed to IPv6Address) #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
bug=ipaddr.IPAddress("127.0.0.1")
ok=ipaddr.IPAddress("::1")
print(bug.is_loopback and ok.is_loopback)
True # works fine
print(bug.is_unspecified and ok.is_unspecified)
print(bug.is_unspecified and ok.is_unspecified)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'IPv4Address' object has no attribute 'is_unspecified'

Original issue reported on code.google.com by rep.dot....@gmail.com on 11 Jan 2010 at 9:07

GoogleCodeExporter commented 9 years ago
missing IPv4Address.is_reserved entry?

According to RFC5753 (http://www.rfc-editor.org/rfc/rfc5735.txt), the 
192.0.0.0/24
"[...] is reserved for IETF protocol assignments."

Hence:
$ svn diff ipaddr.py
Index: ipaddr.py
===================================================================
--- ipaddr.py   (revision 133)
+++ ipaddr.py   (working copy)
@@ -1019,7 +1019,8 @@ class _BaseV4(object):
             reserved IPv4 Network range.

        """
-       return self in IPv4Network('240.0.0.0/4')
+       return (self in IPv4Network('240.0.0.0/4') or
+               self in IPv4Network('192.0.0.0/24'))

     @property
     def is_private(self):

Original comment by rep.dot....@gmail.com on 2 Feb 2010 at 9:07

GoogleCodeExporter commented 9 years ago
implement IPv4.is_unspecified()

Original comment by rep.dot....@gmail.com on 2 Feb 2010 at 9:24

Attachments:

GoogleCodeExporter commented 9 years ago
hey, thanks for the patch. Before we accept it, our lawyers require that you 
sign a the 
CLA 
(linked from the main page). It should be fairly simple. Please let me know if 
this is 
something you can/can't do.

oh, and if you already have, please let me know under what address you signed 
it.

cheers,
/peter

Original comment by pmo...@google.com on 4 Feb 2010 at 5:11

GoogleCodeExporter commented 9 years ago
ugh, can't i just transfer the copyright of those trivial(!) snippets to you 
(which i
hereby do for any past or future contribution of mine to ipaddr-py) ?

Original comment by rep.dot....@gmail.com on 4 Feb 2010 at 8:35

GoogleCodeExporter commented 9 years ago
unfortunately it's the lawyers who insist on this, not me :-/

you're right though, this is super-trivial, and there really is not other way 
to implement 
it.

Original comment by pmo...@google.com on 4 Feb 2010 at 10:32

GoogleCodeExporter commented 9 years ago
i'll get you that CLA signed. In the individual CLA, what do they mean by 
"Electronic
Signature:" my gpg fingerprint or something else?

Original comment by rep.dot....@gmail.com on 4 Feb 2010 at 10:50

GoogleCodeExporter commented 9 years ago
you should just have to enter "I AGREE" in that box and then hit submit.

Original comment by pmo...@google.com on 4 Feb 2010 at 10:53

GoogleCodeExporter commented 9 years ago
and thanks for doing this.

Original comment by pmo...@google.com on 4 Feb 2010 at 10:54

GoogleCodeExporter commented 9 years ago
got the CLA, thanks. 

the ipv4 unspecified address looks to be 0.0.0.0/32, not /8, so I'm fixing that 
and 
adding a test case for it.

fixed in r137

Original comment by pmo...@google.com on 5 Feb 2010 at 10:54