Skip to content

Commit

Permalink
Update assignopppair.py to allocate /30 subnets
Browse files Browse the repository at this point in the history
  • Loading branch information
dpkingston authored Feb 4, 2024
1 parent 22deb36 commit 330a6ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions portal/management/commands/assignopppair.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def handle(self, *args, **options):
self.stderr.write("WARNING: last host (%s) is not in last subnet (%s)!" % (
last_host, last_network))

next31 = IPv4Network(str(max(last_network, last_host) + 1) + '/31')
next31 = IPv4Network(str(max(last_network, last_host) + 1) + '/30')
hosts = map(str, next31.iterhosts())
self.stdout.write(" ".join(hosts))
if options['dry_run']:
Expand All @@ -71,7 +71,7 @@ def handle(self, *args, **options):
raise CommandError("Aborting. Use -f to force adding more addresses to an existing host.")
new_host.save()
self.stderr.write(str(new_host))
for (name, address) in zip(("first", "second"), hosts):
for (name, address) in zip(("first", "second"), hosts[1:3]):
ip = IPAddress()
ip.host = new_host
ip.interface = name
Expand Down

0 comments on commit 330a6ad

Please sign in to comment.