A Patch to RtConfig to address JunOS configuration generation problems

Stan Barber sob at academ.com
Thu Jul 5 06:19:33 UTC 2007


Stan Barber wrote:
> Howdy!
> I found a fix for the JunOS configuration generator. When using 
> @RtConfig export and generating a JunOS configure, it produces what I 
> expected, but if @RtConfig import is used, the
> peer address contains a mask (e.g. /32) to the end of the dotted-quad. 
> With this fix, both produce the expected form for the peer address.
>
> I also commented out another problem that I have not been able to find a 
> fix to as yet. For the way I use RtConfig, I don't need this. It still 
> needs to be fixed.
>
> Comments are welcome.
>
> STAN BARBER
>
>
>
>
>   
Here is the patch....

*** 
/usr/ports/net-mgmt/irrtoolset/work/IRRToolSet-4.8.5/src/RtConfig/f_junos.cc    
Sun Oct  1 06:23:32 2006
--- f_junos.cc    Wed Jul  4 23:47:57 2007
***************
*** 811,816 ****
--- 811,819 ----
 
     Debug(Channel(DBG_JUNOS) << "# ne: " << *ne << "\n");
 
+    if (ne->is_any() != NEITHER)
+      cerr << "Warning: filter matches ANY/NOT ANY" << endl;
+
     if (ne->isEmpty())
        return last;
 
***************
*** 915,927 ****
        cout << "            metric-out igp;\n";
        setMEDtoIGP = false;
     }
!
     if (afi_activate) {
        cout << "            family " << (AddressFamily &) *filter_afi 
<< " { "<< endl;
        cout << "                any;" << endl;
        cout << "            } " << endl;
     }
!
     cout << "         }\n"
      << "      }\n"
      << "   }\n"
--- 918,930 ----
        cout << "            metric-out igp;\n";
        setMEDtoIGP = false;
     }
! #ifdef notdef
     if (afi_activate) {
        cout << "            family " << (AddressFamily &) *filter_afi 
<< " { "<< endl;
        cout << "                any;" << endl;
        cout << "            } " << endl;
     }
! #endif
     cout << "         }\n"
      << "      }\n"
      << "   }\n"
***************
*** 1019,1025 ****
        return;
      }
 
!    int preAclID = prefixMgr.lastID();
     // get matching import attributes
     AutNumSelector<AttrImport> itr(autnum, "import",
                    NULL, peerAS, peer_addr, addr);
--- 1022,1028 ----
        return;
      }
 
!    //   int preAclID = prefixMgr.lastID();
     // get matching import attributes
     AutNumSelector<AttrImport> itr(autnum, "import",
                    NULL, peerAS, peer_addr, addr);
***************
*** 1074,1080 ****
 
     ItemAFI *peer_afi = new ItemAFI(peer_addr->get_afi());
 
!    printNeighbor(IMPORT, asno, peerAS, peer_addr->get_text(), false, 
(ItemAFI *) peer_afi, (ItemAFI *) afi_list);
  }
 
  void JunosConfig::static2bgp(ASt asno, MPPrefix *addr) {
--- 1077,1083 ----
 
     ItemAFI *peer_afi = new ItemAFI(peer_addr->get_afi());
 
!    printNeighbor(IMPORT, asno, peerAS, peer_addr->get_ip_text(), 
false, (ItemAFI *) peer_afi, (ItemAFI *) afi_list);
  }
 
  void JunosConfig::static2bgp(ASt asno, MPPrefix *addr) {



More information about the irrtoolset mailing list