Send Netdot-devel mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."


Today's Topics:

   1. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC3-70-g7a8997e (Apache)
   2. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC3-71-ge219cd2 (Apache)
   3. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC3-72-gfebb3d5 (Apache)


----------------------------------------------------------------------

Message: 1
Date: Fri, 27 Jul 2012 12:34:04 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC3-70-g7a8997e
To: [email protected]
Message-ID: <[email protected]>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".

The branch, netdot-1.0 has been updated
       via  7a8997e2c301915d414fcf51f0a22f193e8c78a0 (commit)
       via  0bdb01b0f2a672e136488cfc82ba6337b81c960a (commit)
       via  fea4587d5f0958318007bf46d703b98c135b6748 (commit)
       via  0fe559dc9e1ed44f6bbd469e81518f0b2c7c513f (commit)
      from  4ae8c6d68f070324a96011999bda2687b8c4c82a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7a8997e2c301915d414fcf51f0a22f193e8c78a0
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 27 15:27:38 2012 -0400

    Correction

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 5c90ce6..320fa56 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -4519,12 +4519,23 @@ sub _validate_arp {
        unless ($cache && $version);
 
     my $host = $self->fqdn();
+
+    my $ign_non_subnet = 
Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET');
     
+    # Cisco Firewalls do not return subnet prefix information via SNMP
+    # as of 27/07/2012. But we can get ARP info from them, so if we are
+    # configured to ignore IPs which are not within known subnets, then
+    # we'll have to disable that if we want to get v6 ARP from them.
+    # This block must be removed later if the SNMP values are supported
+    if ( $version == 6 && ref($self) =~ /CiscoFW$/o ){
+       $ign_non_subnet = 0;
+    }
+
     # Get all interfaces and IPs
     my %devints; my %devsubnets;
     foreach my $int ( $self->interfaces ){
        $devints{$int->number} = $int->id;
-       if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
+       if ( $ign_non_subnet ){
            foreach my $ip ( $int->ips ){
                next unless ($ip->version == $version);
                push @{$devsubnets{$int->id}}, $ip->parent->netaddr 
@@ -4552,7 +4563,7 @@ sub _validate_arp {
                next;
            }
            $mac = $validmac;
-           if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
+           if ( $ign_non_subnet ){
                # This check does not work with link-local, so if user wants 
those
                # just validate them
                if ( $version == 6 && Ipblock->is_link_local($ip) ){

commit 0bdb01b0f2a672e136488cfc82ba6337b81c960a
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 27 15:13:53 2012 -0400

    Fixed broken global search

diff --git a/lib/Netdot/Model.pm b/lib/Netdot/Model.pm
index 5c358a6..06a9814 100644
--- a/lib/Netdot/Model.pm
+++ b/lib/Netdot/Model.pm
@@ -1056,35 +1056,34 @@ sub search_all_tables {
        $table = $1;
        $q     = $2;
     }
-    
+   
     if ( Ipblock->matches_ip($q) ){
        # Convert IP addresses before searching
-       my @res = Ipblock->search(address=>Ipblock->ip2int($q));
+       my @res = Ipblock->search(address=>$q);
        map { $results{'Ipblock'}{$_->id} = $_ } @res;
     }elsif ( my ($addr,$pref) = Ipblock->matches_cidr($q) ){
        my @res = Ipblock->search(address=>$addr, prefix=>$pref);
        map { $results{'Ipblock'}{$_->id} = $_ } @res;  
-    }else{
-       foreach my $tbl ( $self->meta->get_table_names() ) {
-           next if ( $table && $tbl !~ /^$table$/i );
-           $lctbl = lc($tbl);
-           my @cols;
-           foreach my $c ( $tbl->columns ){
-               my $mcol = $tbl->meta_data->get_column($c);
-               # Ignore id field
-               next if ( $mcol->name eq 'id' );
-               # Ignore foreign key fields
-               next if ( $mcol->links_to() );
-               # Only include these types
-               push @cols, $c
-                   if ( $mcol->sql_type =~ /^blob|text|varchar|integer$/ ); 
-           }
-           foreach my $col ( @cols ){
-               my @res = $tbl->search_like($col=>$q);
-               map { $results{$tbl}{$_->id} = $_ } @res;
-           }
-           last if $table;
+    }
+    foreach my $tbl ( $self->meta->get_table_names() ) {
+       next if ( $table && $tbl !~ /^$table$/i );
+       $lctbl = lc($tbl);
+       my @cols;
+       foreach my $c ( $tbl->columns ){
+           my $mcol = $tbl->meta_data->get_column($c);
+           # Ignore id field
+           next if ( $mcol->name eq 'id' );
+           # Ignore foreign key fields
+           next if ( $mcol->links_to() );
+           # Only include these types
+           push @cols, $c
+               if ( $mcol->sql_type =~ /^blob|text|varchar|integer$/ ); 
+       }
+       foreach my $col ( @cols ){
+           my @res = $tbl->search_like($col=>$q);
+           map { $results{$tbl}{$_->id} = $_ } @res;
        }
+       last if $table;
     }
     return \%results;
 }

commit fea4587d5f0958318007bf46d703b98c135b6748
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 27 14:56:31 2012 -0400

    Link-local v6 addresses where being inserted even when configuration was 
set to ignore them

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 48f557e..5c90ce6 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -1075,6 +1075,9 @@ sub get_snmp_info {
 
     ################################################################
     # IPv6 addresses and prefixes
+    
+    my $ignore_link_local = $self->config->get('IGNORE_IPV6_LINK_LOCAL');
+
     # Stuff in this hash looks like this:
     #
     # CISCO-IETF-IP-MIB:
@@ -1099,6 +1102,7 @@ sub get_snmp_info {
        }
        if ( $iid && $addr && $pfx && $len ){
            next if &_check_if_status_down(\%dev, $iid);
+           next if ( Ipblock->is_link_local($addr) && $ignore_link_local );
            $dev{interface}{$iid}{ips}{$addr}{address} = $addr;
            $dev{interface}{$iid}{ips}{$addr}{version} = 6;
            $dev{interface}{$iid}{ips}{$addr}{subnet}  = "$pfx/$len";
@@ -1110,7 +1114,10 @@ sub get_snmp_info {
 
     ################################################################
     # IPv6 link-local addresses
-    unless ( $self->config->get('IGNORE_IPV6_LINK_LOCAL') ){
+    # It looks like in Cisco 'ipv6_index' contains a the addresses from
+    # 'ipv6_addr_prefix', plus link locals, so we won't query it
+    # unless we want those.
+    unless ( $ignore_link_local ){
        my $ipv6_index = $sinfo->ipv6_index();
        my ($iid, $addr);
        while ( my($key,$val) = each %$ipv6_index ){

commit 0fe559dc9e1ed44f6bbd469e81518f0b2c7c513f
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 27 14:54:51 2012 -0400

    A couple of fixes related to PTR records

diff --git a/lib/Netdot/Model/RRPTR.pm b/lib/Netdot/Model/RRPTR.pm
index 7d3b8bf..f75ed5f 100644
--- a/lib/Netdot/Model/RRPTR.pm
+++ b/lib/Netdot/Model/RRPTR.pm
@@ -25,10 +25,11 @@ my $logger = Netdot->log->get_logger('Netdot::Model::DNS');
       - Check for conflicting record types
     
   Arguments:
-    None
+    Any of RRPTRs fields
   Returns:
     RRPTR object
   Examples:
+    $rrptr->insert(ipblock=>$ip);
 
 =cut
 sub insert {
@@ -47,16 +48,23 @@ sub insert {
        $class->throw_fatal("Figuring out the rr field requires passing zone")
            unless ( $argv->{zone} );
 
-       $logger->debug("Netdot::Model::RRPTR: Figuring out owner for 
".$ipb->get_label);
-
+       my $zone;
        my $zone = blessed($argv->{zone}) ? $argv->{zone} : 
Zone->retrieve($argv->{zone});
        unless ( $zone->name =~ /(?:\.in-addr)|(?:\.ip6)\.arpa$/o ){
            $class->throw_user(sprintf("Zone %s is not a reverse zone", 
$zone->name));
        }
+       
+       # This gets us the the FQDN
        my $name = $class->get_name(ipblock=>$ipb);
-       $rr = RR->find_or_create({zone=>$zone, name=>$name});
-       $logger->debug("Netdot::Model::RRPTR: Created owner RR for IP: ".
-                      $ipb->get_label." as: ".$rr->get_label);
+
+       $rr = RR->search(name=>$name)->first;
+       unless ( $rr ){
+           my $domain = $zone->name;
+           $name =~ s/\.$domain\.?$//i;
+           $rr = RR->insert({zone=>$zone, name=>$name});
+           $logger->debug("Netdot::Model::RRPTR: Created owner RR for IP: ".
+                          $ipb->get_label." as: ".$rr->get_label);
+       }
        $argv->{rr} = $rr;
     }
 
@@ -98,23 +106,23 @@ sub insert {
 =cut
 sub get_name {
     my ($class, %argv) = @_;
-
+    
     my $ipblock = $argv{ipblock};
     unless ( $ipblock ){
        $class->throw_fatal("RRPTR::get_name: Missing required arguments");
     }
-
-      my $name;
-      if ( $ipblock->version eq '4' ){
-          $name = join('.', reverse(split(/\./, $ipblock->address)), 
'in-addr.arpa');
-      }elsif ( $ipblock->version eq '6' ){
-          $name = $ipblock->full_address;
-          $name =~ s/://g;
-          $name = join('.', reverse(split(//, $name)), 'ip6.arpa');
-      }else {
-          $class->throw_fatal("RRPTR::get_name: Unknown IP version");
-      }
-      return $name;
+    
+    my $name;
+    if ( $ipblock->version eq '4' ){
+       $name = join('.', reverse(split(/\./, $ipblock->address)), 
'in-addr.arpa');
+    }elsif ( $ipblock->version eq '6' ){
+       $name = $ipblock->full_address;
+       $name =~ s/://g;
+       $name = join('.', reverse(split(//, $name)), 'ip6.arpa');
+    }else {
+       $class->throw_fatal("RRPTR::get_name: Unknown IP version");
+    }
+    return $name;
 }
 
 =head1 INSTANCE METHODS
@@ -159,6 +167,36 @@ sub update {
     return $self->SUPER::update($argv);
 }
 
+############################################################################
+=head2 delete - Delete object
+    
+    We override the delete method for extra functionality:
+    - When removing a PTR record, most likely the RR (name)
+    associated with it needs to be deleted too.
+
+  Arguments:
+    None
+  Returns:
+    True if successful. 
+  Example:
+    $rrptr->delete;
+
+=cut
+sub delete {
+    my ($self, $argv) = @_;
+    $self->isa_object_method('delete');
+
+    my $rr = $self->rr;
+    $self->SUPER::delete();
+
+    # If RR has no more associated records
+    # it should be deleted
+    unless ( $rr->sub_records ){
+       $rr->delete;
+    }
+    return 1;
+}
+
 
 ##################################################################
 =head2 as_text

-----------------------------------------------------------------------

Summary of changes:
 lib/Netdot/Model.pm        |   43 ++++++++++++-------------
 lib/Netdot/Model/Device.pm |   24 ++++++++++++--
 lib/Netdot/Model/RRPTR.pm  |   76 +++++++++++++++++++++++++++++++++-----------
 3 files changed, 99 insertions(+), 44 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


------------------------------

Message: 2
Date: Fri, 27 Jul 2012 12:36:58 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC3-71-ge219cd2
To: [email protected]
Message-ID: <[email protected]>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".

The branch, netdot-1.0 has been updated
       via  e219cd2fff036bba9baa2355109521baebeaa953 (commit)
      from  7a8997e2c301915d414fcf51f0a22f193e8c78a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e219cd2fff036bba9baa2355109521baebeaa953
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 27 15:35:58 2012 -0400

    Default config should be to discover link local addresss, not ignore them

diff --git a/etc/Default.conf b/etc/Default.conf
index 3d8798c..07dbf62 100644
--- a/etc/Default.conf
+++ b/etc/Default.conf
@@ -496,7 +496,7 @@ GET_IPV6_ND => 1,
 
 # Ignore IPv6 Link Local addresses (fe80::/10)
 # from router interfaces and Neighbor Discovery tables
-IGNORE_IPV6_LINK_LOCAL => 1,
+IGNORE_IPV6_LINK_LOCAL => 0,
 
 #####################################################################
 #

-----------------------------------------------------------------------

Summary of changes:
 etc/Default.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


------------------------------

Message: 3
Date: Fri, 27 Jul 2012 14:15:42 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC3-72-gfebb3d5
To: [email protected]
Message-ID: <[email protected]>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".

The branch, netdot-1.0 has been updated
       via  febb3d5e7f2104d255041ea7833f97c19176041f (commit)
      from  e219cd2fff036bba9baa2355109521baebeaa953 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit febb3d5e7f2104d255041ea7833f97c19176041f
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 27 17:10:06 2012 -0400

    Corrections

diff --git a/htdocs/management/host.html b/htdocs/management/host.html
index 7511905..9caf771 100644
--- a/htdocs/management/host.html
+++ b/htdocs/management/host.html
@@ -123,8 +123,7 @@ if ( $submit ){
                    # Also, if RR was just updated, this re-reads it from the DB
                    # to avoid the old values from showing up
                    my $newrr = RR->retrieve($newid);
-                   defined $newrr ||  $m->comp('/generic/error.mhtml', 
error=>"Could not retrieve RR id $id"); ;
-                   $rrs{$newrr->id} = $newrr;
+                   $rrs{$newrr->id} = $newrr if defined $newrr;
                    
                }
                                          })
diff --git a/lib/Netdot/Model/RRPTR.pm b/lib/Netdot/Model/RRPTR.pm
index f75ed5f..8743aa2 100644
--- a/lib/Netdot/Model/RRPTR.pm
+++ b/lib/Netdot/Model/RRPTR.pm
@@ -48,7 +48,6 @@ sub insert {
        $class->throw_fatal("Figuring out the rr field requires passing zone")
            unless ( $argv->{zone} );
 
-       my $zone;
        my $zone = blessed($argv->{zone}) ? $argv->{zone} : 
Zone->retrieve($argv->{zone});
        unless ( $zone->name =~ /(?:\.in-addr)|(?:\.ip6)\.arpa$/o ){
            $class->throw_user(sprintf("Zone %s is not a reverse zone", 
$zone->name));

-----------------------------------------------------------------------

Summary of changes:
 htdocs/management/host.html |    3 +--
 lib/Netdot/Model/RRPTR.pm   |    1 -
 2 files changed, 1 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


------------------------------

_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel


End of Netdot-devel Digest, Vol 64, Issue 29
********************************************

Reply via email to