Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

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

Closed
GoogleCodeExporter opened this issue Mar 18, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

implement IPv4.is_unspecified()

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

Attachments:

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

and thanks for doing this.

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

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant