Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-23 Thread Sean M. Collins
On Sun, Aug 23, 2015 at 10:10:39AM EDT, Kevin Benton wrote:
 While waiting for the upstream netaddr feedback, we should be able to block
 this pretty easily on the Neutron side by just checking that
 str(netaddr.IPNetwork(input)) == input.

Good call - I totally missed the easy way to fix.

-- 
Sean M. Collins

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-23 Thread Kevin Benton
While waiting for the upstream netaddr feedback, we should be able to block
this pretty easily on the Neutron side by just checking that
str(netaddr.IPNetwork(input)) == input.

On Sat, Aug 22, 2015 at 12:31 PM, Sean M. Collins s...@coreitpro.com
wrote:

 On August 22, 2015 11:58:03 AM EDT, Monty Taylor mord...@inaugust.com
 wrote:

 On 08/21/2015 03:33 PM, Jay Pipes wrote:

  On 08/21/2015 02:34 PM, Sean M. Collins wrote:

  So - the tl;dr is that I don't think that we should accept inputs like
  the following:

  x   - 192
  x/y - 10/8
  x.x/y   - 192.168/16
  x.x.x/y - 192.168.0/24

  which are equivalent to::

  x.0.0.0/y   - 192.0.0.0/24
  x.0.0.0/y   - 10.0.0.0/8
  x.x.0.0/y   - 192.168.0.0/16
  x.x.x.0/y   - 192.168.0.0/24


  Agreed completely.


 ++


 --

 OpenStack Development Mailing List (not for usage questions)
 Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


 I've got a proof of concept patch for netaddr, I'll be reaching out to the
 netaddr devs and use it to spur discussion.


 https://github.com/sc68cal/netaddr/commit/7ccbfe40fe6be66228601977ded74781cf5cffd9


 --
 Sent from my Android device with K-9 Mail. Please excuse my brevity.

 __
 OpenStack Development Mailing List (not for usage questions)
 Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




-- 
Kevin Benton
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-22 Thread shihanzhang
there was another patch [1] fix the invalid CIDR for subnet.
 
thanks,
   hanzhang, shi


[1] https://review.openstack.org/#/c/201942/


At 2015-08-22 03:33:26, Jay Pipes jaypi...@gmail.com wrote:
On 08/21/2015 02:34 PM, Sean M. Collins wrote:
 So - the tl;dr is that I don't think that we should accept inputs like
 the following:

 x   - 192
 x/y - 10/8
 x.x/y   - 192.168/16
 x.x.x/y - 192.168.0/24

 which are equivalent to::

 x.0.0.0/y   - 192.0.0.0/24
 x.0.0.0/y   - 10.0.0.0/8
 x.x.0.0/y   - 192.168.0.0/16
 x.x.x.0/y   - 192.168.0.0/24

Agreed completely.

Best,
-jay

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-22 Thread Sean M. Collins
On August 22, 2015 11:58:03 AM EDT, Monty Taylor mord...@inaugust.com wrote:
On 08/21/2015 03:33 PM, Jay Pipes wrote:
 On 08/21/2015 02:34 PM, Sean M. Collins wrote:
 So - the tl;dr is that I don't think that we should accept inputs
like
 the following:

 x   - 192
 x/y - 10/8
 x.x/y   - 192.168/16
 x.x.x/y - 192.168.0/24

 which are equivalent to::

 x.0.0.0/y   - 192.0.0.0/24
 x.0.0.0/y   - 10.0.0.0/8
 x.x.0.0/y   - 192.168.0.0/16
 x.x.x.0/y   - 192.168.0.0/24
 
 Agreed completely.

++


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe:
openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

I've got a proof of concept patch for netaddr, I'll be reaching out to the 
netaddr devs and use it to spur discussion.

https://github.com/sc68cal/netaddr/commit/7ccbfe40fe6be66228601977ded74781cf5cffd9


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-22 Thread Monty Taylor
On 08/21/2015 03:33 PM, Jay Pipes wrote:
 On 08/21/2015 02:34 PM, Sean M. Collins wrote:
 So - the tl;dr is that I don't think that we should accept inputs like
 the following:

 x   - 192
 x/y - 10/8
 x.x/y   - 192.168/16
 x.x.x/y - 192.168.0/24

 which are equivalent to::

 x.0.0.0/y   - 192.0.0.0/24
 x.0.0.0/y   - 10.0.0.0/8
 x.x.0.0/y   - 192.168.0.0/16
 x.x.x.0/y   - 192.168.0.0/24
 
 Agreed completely.

++


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-21 Thread Jay Pipes

On 08/21/2015 02:34 PM, Sean M. Collins wrote:

So - the tl;dr is that I don't think that we should accept inputs like
the following:

x   - 192
x/y - 10/8
x.x/y   - 192.168/16
x.x.x/y - 192.168.0/24

which are equivalent to::

x.0.0.0/y   - 192.0.0.0/24
x.0.0.0/y   - 10.0.0.0/8
x.x.0.0/y   - 192.168.0.0/16
x.x.x.0/y   - 192.168.0.0/24


Agreed completely.

Best,
-jay

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-21 Thread Sean M. Collins
[Resending - since I don't think my mail client actually sent this the
first time]


While reviewing https://review.openstack.org/#/c/204459/ - I noticed
that one of the unit tests is passing an IP address 1/32 - so I went
and looked up the constructor for netaddr.IPNetwork, which has a feature that 
expands a string into a prefix.

http://pythonhosted.org//netaddr/api.html?highlight=abbreviated%20cidr#ip-networks-and-subnets

Putting it into my REPL:

http://paste.openstack.org/show/421041/


So - is this an actual IP address? I could be horribly wrong, but it
doesn't look like one to me - especially since built in tools like ping
don't appear to like it.

scollins@Sean-Collins-MBPr15 ~ » ping 1/32
ping: cannot resolve 1/32: Unknown host

Although, ping has it's own interesting behavior.

scollins@Sean-Collins-MBPr15 ~ » ping 1 
68 ↵
PING 1 (0.0.0.1): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 0
^C
--- 1 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
scollins@Sean-Collins-MBPr15 ~ » ping 60
 2 ↵
PING 60 (0.0.0.60): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 0
^C
--- 60 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss


Oh, also spelunking through the code of Netaddr, it looks like this
option is going to be deprecated?

https://github.com/drkjam/netaddr/blob/bfba0b80c2e88b6e00ca7a870998b630d7c29734/netaddr/ip/__init__.py#L776

Which calls into:

https://github.com/drkjam/netaddr/blob/bfba0b80c2e88b6e00ca7a870998b630d7c29734/netaddr/ip/__init__.py#L1438

So - the tl;dr is that I don't think that we should accept inputs like
the following:

x   - 192
x/y - 10/8
x.x/y   - 192.168/16
x.x.x/y - 192.168.0/24

which are equivalent to::

x.0.0.0/y   - 192.0.0.0/24
x.0.0.0/y   - 10.0.0.0/8
x.x.0.0/y   - 192.168.0.0/16
x.x.x.0/y   - 192.168.0.0/24

-- 
Sean M. Collins

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Neutron] netaddr and abbreviated CIDR format

2015-08-21 Thread Sean M. Collins
Here's what the implicit_prefix arg for the IPNetwork constructor does.

Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type help, copyright, credits or license for more information.
 import netaddr
 a = netaddr.IPNetwork(1, implicit_prefix=True)
 a
IPNetwork('1.0.0.0/8')
 a = netaddr.IPNetwork(1, implicit_prefix=False)
 a
IPNetwork('1.0.0.0/32')


-- 
Sean M. Collins

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev