[netmagis] Re: Problem to translate multi-view in Netmagis etc ...

  • From: Benoit Mandy <Benoit.Mandy@xxxxxxxxxxxxxx>
  • To: netmagis@xxxxxxxxxxxxx
  • Date: Fri, 20 Apr 2012 09:51:20 +0200

Hello Jean,

    We can't use netmagis if we don't have "BIND views".

So let's patch it :
Add a column to dns.rr (this will contain the real domain name to use)
modify admref
modify  mkzones
modify libnetmagis.tcl

to complete modifications, it will be necessary to have help for the new item.

I attached patch files to this mail for information.

Benoit Mandy


Le 17/04/2012 22:35, Jean Benoit a écrit :
MAC Address search  :

I think you are refering to the "Search" option in
the menu. Yes, it can be done (search on MAC address).
I created an issue      (https://github.com/pdav/netmagis/issues/61)

DNS views :

You are correct concerning the role of field "critère"
Its purpose is to select records to include in a zone.
For normal zones, it selects the matching domain name.
For reverse zones, it selects IP addresses matching a CIDR.
In theory, it could be used to select hosts belonging to a particular view.
(https://github.com/pdav/netmagis/issues/62)

--
Jean Benoit


*** admref.orig 2012-02-10 10:56:39.102198493 +0100
--- admref      2012-04-16 15:29:34.263608669 +0200
*************** set conf(reseau:table)          dns.reseau
*** 120,126 ****
  # Domains
  
  set conf(domaine:ptitle) "Domain management"
! set conf(domaine:cols)                { {100 nom {Domain} {string 30} {}} }
  set conf(domaine:sql)         "SELECT * FROM dns.domaine ORDER BY nom ASC"
  set conf(domaine:id)          iddom
  set conf(domaine:help)                help-domaine.html
--- 120,128 ----
  # Domains
  
  set conf(domaine:ptitle) "Domain management"
! set conf(domaine:cols)                { {50 nom {Domain} {string 30} {}} 
!                                 {50 nom_utile {Domain} {string 30} {}}
!                               }
  set conf(domaine:sql)         "SELECT * FROM dns.domaine ORDER BY nom ASC"
  set conf(domaine:id)          iddom
  set conf(domaine:help)                help-domaine.html
ALTER TABLE dns.domaine ADD COLUMN nom_utile text;
*** libnetmagis.tcl.orig        2012-03-29 11:21:47.451990946 +0200
--- libnetmagis.tcl     2012-04-16 16:29:07.316026614 +0200
*************** proc display-rr {dbfd idrr _trr} {
*** 3315,3336 ****
  #     - dbfd: database handle
  #     - _tabdom: array to fill with domain names
  #     - _tabid: array to fill with domain ids
  # Output:
  #   - parameter _tabdom: tabdom(<domainname>) <id>
  #   - parameter _tabid: tabdom(<id>) <domainname>
  #
  # History
  #   2011/03/20 : pda      : place in library
  #
  
! proc read-all-domains {dbfd _tabdom _tabid} {
      upvar $_tabdom tabdom
      upvar $_tabid  tabid
  
!     set sql "SELECT nom, iddom FROM dns.domaine"
      pg_select $dbfd $sql tab {
        set tabdom($tab(nom)) $tab(iddom)
        set tabid($tab(iddom)) $tab(nom)
      }
  }
  
--- 3315,3340 ----
  #     - dbfd: database handle
  #     - _tabdom: array to fill with domain names
  #     - _tabid: array to fill with domain ids
+ #     - _tabidu: array to fill with domain names to use
  # Output:
  #   - parameter _tabdom: tabdom(<domainname>) <id>
  #   - parameter _tabid: tabdom(<id>) <domainname>
+ #   - parameter _tabidu: tabdomu(<id>) <domainname>
  #
  # History
  #   2011/03/20 : pda      : place in library
  #
  
! proc read-all-domains {dbfd _tabdom _tabid _tabidu} {
      upvar $_tabdom tabdom
      upvar $_tabid  tabid
+     upvar $_tabidu  tabidu
  
!     set sql "SELECT nom, iddom, nom_utile FROM dns.domaine"
      pg_select $dbfd $sql tab {
        set tabdom($tab(nom)) $tab(iddom)
        set tabid($tab(iddom)) $tab(nom)
+       set tabidu($tab(iddom)) $tab(nom_utile)
      }
  }
  
*** mkzones.orig        2012-03-29 11:22:06.313959951 +0200
--- mkzones     2012-04-16 16:44:40.198977494 +0200
*************** proc gen-zone {dbfd zone _txt} {
*** 104,110 ****
      #
  
      if {! $found} then {
!       set txt "Zone '$zone' not found"
        return 0
      }
  
--- 104,110 ----
      #
  
      if {! $found} then {
!       set txt "La zone '$zone' n est pas trouvée"
        return 0
      }
  
*************** proc gen-zone {dbfd zone _txt} {
*** 223,229 ****
  proc gen-normal {dbfd zone selection rrsup _txt} {
      upvar $_txt txt
  
!     read-all-domains $dbfd "" tabiddom
  
      #
      # Get working domain id
--- 223,229 ----
  proc gen-normal {dbfd zone selection rrsup _txt} {
      upvar $_txt txt
  
!     read-all-domains $dbfd "" tabiddom tabiddomu
  
      #
      # Get working domain id
*************** proc gen-normal {dbfd zone selection rrs
*** 285,291 ****
        set nom $tab(nom)
        set ttl $tab(ttl)
        set d $tab(iddom2)
!       set fqdn2 "$tab(nom2).$tabiddom($d)."
        if {$ttl == -1} then {
            set ttl ""
        }
--- 285,292 ----
        set nom $tab(nom)
        set ttl $tab(ttl)
        set d $tab(iddom2)
!       # set fqdn2 "$tab(nom2).$tabiddom($d)."
!       set fqdn2 "$tab(nom2).$tabiddomu($d)."
        if {$ttl == -1} then {
            set ttl ""
        }
*************** proc gen-normal {dbfd zone selection rrs
*** 305,311 ****
                        ORDER BY upper(rr1.nom)"
      pg_select $dbfd $sql tab {
        set d $tab(iddom2)
!       set fqdn2 "$tab(nom2).$tabiddom($d)."
        set ttl $tab(ttl)
        if {$ttl == -1} then {
            set ttl ""
--- 306,313 ----
                        ORDER BY upper(rr1.nom)"
      pg_select $dbfd $sql tab {
        set d $tab(iddom2)
!       # set fqdn2 "$tab(nom2).$tabiddom($d)."
!       set fqdn2 "$tab(nom2).$tabiddomu($d)."
        set ttl $tab(ttl)
        if {$ttl == -1} then {
            set ttl ""
*************** proc gen-normal {dbfd zone selection rrs
*** 381,387 ****
  proc gen-ipv4 {dbfd zone selection rrsup _txt} {
      upvar $_txt txt
  
!     read-all-domains $dbfd "" tabiddom
  
      #
      # Get CIDR prefix length to compute how many bytes we keep in RR name
--- 383,389 ----
  proc gen-ipv4 {dbfd zone selection rrsup _txt} {
      upvar $_txt txt
  
!     read-all-domains $dbfd "" tabiddom tabiddomu
  
      #
      # Get CIDR prefix length to compute how many bytes we keep in RR name
*************** proc gen-ipv4 {dbfd zone selection rrsup
*** 410,416 ****
        # Get PTR
        #
  
!       set fqdn "$tab(nom).$tabiddom($tab(iddom))."
  
        set adr $tab(adr)
        set lname {}
--- 412,418 ----
        # Get PTR
        #
  
!       set fqdn "$tab(nom).$tabiddomu($tab(iddom))."
  
        set adr $tab(adr)
        set lname {}
*************** proc gen-ipv4 {dbfd zone selection rrsup
*** 452,458 ****
  proc gen-ipv6 {dbfd zone selection rrsup _txt} {
      upvar $_txt txt
  
!     read-all-domains $dbfd "" tabiddom
  
      #
      # Get prefix length to compute how many nibbles we keep in RR name
--- 454,460 ----
  proc gen-ipv6 {dbfd zone selection rrsup _txt} {
      upvar $_txt txt
  
!     read-all-domains $dbfd "" tabiddom tabiddomu
  
      #
      # Get prefix length to compute how many nibbles we keep in RR name
*************** proc gen-ipv6 {dbfd zone selection rrsup
*** 536,542 ****
        # Get out the PTR
        #
  
!       set fqdn "$tab(nom).$tabiddom($tab(iddom))."
  
        set ttl $tab(ttl)
        if {$ttl == -1} then {
--- 538,544 ----
        # Get out the PTR
        #
  
!       set fqdn "$tab(nom).$tabiddomu($tab(iddom))."
  
        set ttl $tab(ttl)
        if {$ttl == -1} then {

Other related posts: