Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1371#discussion_r62786731 --- Diff: utils/src/main/java/com/cloud/utils/net/NetUtils.java --- @@ -1159,6 +1181,25 @@ public static boolean validateGuestCidr(final String cidr) { } } + public static boolean validateGuestCidr(final CIDR cidr) throws BadCIDRException { + // RFC 1918 - The Internet Assigned Numbers Authority (IANA) has reserved the + // following three blocks of the IP address space for private internets: + // 10.0.0.0 - 10.255.255.255 (10/8 prefix) + // 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) + // 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) + + final CIDR cidr1 = CIDRFactory.getCIDR("10.0.0.0/8"); + final CIDR cidr2 = CIDRFactory.getCIDR("172.16.0.0/12"); + final CIDR cidr3 = CIDRFactory.getCIDR("192.168.0.0/16"); --- End diff -- Consider moving these values to a ``final static ImmutableSet`` on the IPv4 CIDR class. The ``CIDR`` interface could also provide ``getGuestCIDRs`` method.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---