Skip to content

Instantly share code, notes, and snippets.

@ottomata
Created July 12, 2012 16:21
Show Gist options
  • Save ottomata/3099134 to your computer and use it in GitHub Desktop.
Save ottomata/3099134 to your computer and use it in GitHub Desktop.
cidr_includes
$ ./cidr_includes 192.168.0.1/24 192.168.0.10
Does 192.168.0.1/24 contain 192.168.0.10/32? yes
$ ./cidr_includes 192.168.0.1/24 192.168.5.10
Does 192.168.0.1/24 contain 192.168.5.10/32? no
$ ./cidr_includes 2620:0:860:2::/64 2620:0:860:2:0:0:0:0005
Does 2620:0:860:2::/64 contain 2620:0:860:2::5/128? yes
$ ./cidr_includes 2620:0:860:2::/64 2620:0:860:3:0:0:0:0005
Does 2620:0:860:2::/64 contain 2620:0:860:3::5/128? no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment