Changeset 889 for trunk/compact-recs.pl


Ignore:
Timestamp:
06/24/25 12:23:01 (7 days ago)
Author:
Kris Deugau
Message:

/trunk

Refine/fix compact-recs.pl handling for %c/%-c templates, which in fact
were not correctly handled with r834

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/compact-recs.pl

    r852 r889  
    44##
    55# $Id$
    6 # Copyright 2013-2022 Kris Deugau <kdeugau@deepnet.cx>
     6# Copyright 2013-2022,2025 Kris Deugau <kdeugau@deepnet.cx>
    77#
    88#    This program is free software: you can redistribute it and/or modify
     
    170170      # skip existing template within the new template's range
    171171      next if $val =~ m{/\d+$};
    172       DNSDB::_template4_expand(\$cmp, $val, \$cidr);
     172      if ($cmp =~ /\%-?c/) {
     173        # Determine "nth host" index value of $val for %c and %-c
     174        my $possible = new NetAddr::IP $val;
     175        my $valindex = $possible - $cidr;
     176        $valindex-- if $cmp =~ /\%-c/;
     177        DNSDB::_template4_expand(\$cmp, $val, \$cidr, $valindex);
     178      } else {
     179        DNSDB::_template4_expand(\$cmp, $val, \$cidr);
     180      }
    173181      $delsth->execute($id) if $cmp eq $host;
    174182      $delcnt++ if $cmp eq $host;
Note: See TracChangeset for help on using the changeset viewer.