From cbc771c58de3bc50210cf5d8269250e79d6e66f8 Mon Sep 17 00:00:00 2001 From: Bob Sutterfield Date: Thu, 21 Mar 2024 17:52:44 -0700 Subject: [PATCH] Consider AWS address reservations --- ipcalc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ipcalc b/ipcalc index 803694a..a688af2 100755 --- a/ipcalc +++ b/ipcalc @@ -48,6 +48,7 @@ my $opt_print_only_class = 0; my $opt_split = 0; my $opt_deaggregate = 0; my $opt_version = 0; +my $opt_aws = 0; my $opt_help = 0; my @opt_split_sizes; my @arguments; @@ -353,7 +354,7 @@ sub printnet { my $broadcast = $network | ((~$mask1) & $thirtytwobits); - $hmin = $network + 1; + $hmin = $network + 1 + $opt_aws * 3; $hmax = $broadcast - 1; $hostn = $hmax - $hmin + 1; $mask = ntobitcountmask($mask1); @@ -728,6 +729,7 @@ sub getopts # -s --split # -b --nobinary # -d --deaggregate + # -a --aws { my @arguments; my $arg; @@ -836,6 +838,9 @@ sub getopts elsif ($opt eq 'r' || $opt eq 'range') { $opt_deaggregate = 1; } + elsif ($opt eq 'a' || $opt eq 'aws') { + $opt_aws = 1; + } elsif ($opt eq 's' || $opt eq 'split') { $opt_split = 1; while (defined $ARGV[0] && $ARGV[0] =~ /^\d+$/) { @@ -1310,6 +1315,7 @@ easy-to-understand binary values. -s --split n1 n2 n3 Split into networks of size n1, n2, n3. -r --range Deaggregate address range. + -a --aws Consider AWS address reservations --help Longer help text. Examples: