Changeset 660 for trunk


Ignore:
Timestamp:
09/12/14 18:04:03 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Tweak some IP validation internals; accept a CIDR suffix to be nice to

callers.

Almost(?) always use inetlazy() function on sorts on the records table;

it looks bad to have reverse records properly sorted by IP, but domain
records only sorted by string value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r658 r660  
    517517    # Fail on "compact" IPv4 variants, because they are not consistent and predictable.
    518518    return ('FAIL',"A record must be a valid IPv4 address")
    519         unless ${$args{host}} =~ /^\d+\.\d+\.\d+\.\d+$/;
     519        unless ${$args{host}} =~ m{^\d+\.\d+\.\d+\.\d+(/\d+)?$};
    520520    $args{addr} = new NetAddr::IP ${$args{host}};
    521521    return ('FAIL',"A record must be a valid IPv4 address")
     
    10441044    # but that gets stupid in forward zones, since these records are shared.
    10451045    return ('FAIL', "$typemap{${$args{rectype}}} record must be a valid IPv4 address")
    1046       if ${$args{rectype}} == 65280 && ${$args{val}} !~ /^\d+\.\d+\.\d+\.\d+$/;
     1046      if ${$args{rectype}} == 65280 && ${$args{val}} !~ m{^\d+\.\d+\.\d+\.\d+(?:/\d+)?$};
    10471047    return ('FAIL', "$typemap{${$args{rectype}}} record must be a valid IPv6 address")
    1048       if ${$args{rectype}} == 65281 && ${$args{val}} !~ /^[a-fA-F0-9:]+$/;
     1048      if ${$args{rectype}} == 65281 && ${$args{val}} !~ m{^[a-fA-F0-9:]+(?:/\d+)?$};
    10491049    # If things are not OK, this should prevent Stupid in the error log.
    10501050    $args{addr} = new NetAddr::IP ${$args{val}}
     
    40204020  foreach my $sf (split /,/, $args{sortby}) {
    40214021    $sf = "r.$sf";
    4022     $sf =~ s/r\.val/inetlazy(r.val)/
    4023         if $args{revrec} eq 'y' && $args{defrec} eq 'n';
     4022    $sf =~ s/r\.val/inetlazy(r.val)/;
     4023# hmm.  do we really need to limit this?
     4024#       if $args{revrec} eq 'y' && $args{defrec} eq 'n';
    40244025    $sf =~ s/r\.type/t.alphaorder/;
    40254026    $newsort .= ",$sf";
Note: See TracChangeset for help on using the changeset viewer.