revised extended autnum patch, was: Re: Bit of tweaking to IRRToolSet web site

S.P.Zeidler spz at serpens.de
Sun Mar 15 22:02:18 UTC 2009


Hi,

ok, this did take a bit longer. The diff attached works against svn trunk
version 222 (but mind that you need a new rpsl.l.cc but object_log.l.cc
doesn't work for me when I regenerate it (not touched by me)).

regards,
	spz
-- 
spz at serpens.de (S.P.Zeidler)
-------------- next part --------------
$NetBSD: patch-br,v 1.2 2007/09/07 21:26:31 spz Exp $

--- src/normalform/SetOfSymbol.cc.orig	2006-06-08 17:16:26.000000000 +0200
+++ src/normalform/SetOfSymbol.cc
@@ -271,7 +271,7 @@ void SetOfSymbol::operator =  (const Set
 
 void SetOfSymbol::add(ASt as) {
    char buffer[64];
-   sprintf(buffer, "AS%d", as);
+   asnum_string(buffer, as);
    add(symbols.symID(buffer));
 }
 
$NetBSD: patch-ct,v 1.2 2009/02/14 16:17:06 spz Exp $

--- src/rpsl/rpsl/rptype.cc.orig	2006-06-08 17:16:26.000000000 +0200
+++ src/rpsl/rpsl/rptype.cc
@@ -254,7 +254,7 @@ Item *RPTypeWord::typeCast(const Item  *
 	 return new ItemWORD(strdup("false"));
    if (typeid(*item) == typeid(ItemASNO)) {
       char buffer[64];
-      sprintf(buffer, "AS%d", ((ItemASNO *) item)->asno);
+      asnum_string(buffer, ((ItemASNO *) item)->asno);
       return new ItemWORD(strdup(buffer));
    }
 
@@ -285,7 +285,7 @@ Item *RPTypeBlob::typeCast(const Item  *
 	 return new ItemBLOB(strdup("false"));
    if (typeid(*item) == typeid(ItemASNO)) {
       char buffer[64];
-      sprintf(buffer, "AS%d", ((ItemASNO *) item)->asno);
+      asnum_string(buffer, ((ItemASNO *) item)->asno);
       return new ItemWORD(strdup(buffer));
    }
 
@@ -367,7 +367,7 @@ Item *RPTypeEnum::typeCast(const Item  *
 	 w = new ItemWORD(strdup("false"));
    if (typeid(*item) == typeid(ItemASNO)) {
       char buffer[64];
-      sprintf(buffer, "AS%d", ((ItemASNO *) item)->asno);
+      asnum_string(buffer, ((ItemASNO *) item)->asno);
       w = new ItemWORD(strdup(buffer));
    }
 
@@ -388,8 +388,7 @@ bool RPTypeBoolean::validate(const Item 
 ////////////////////////////// RPTypeASNumber ////////////////////
 
 bool RPTypeASNumber::validate(const Item *item) const {
-   return ((typeid(*item) == typeid(ItemASNO))
-	   && ((ItemASNO *) item)->asno <= 65535);
+   return ((typeid(*item) == typeid(ItemASNO)));
 }
 
 ////////////////////////////// RPTypeIPv4Address ////////////////////
$NetBSD: patch-cu,v 1.1 2007/09/07 21:26:32 spz Exp $

--- src/rpsl/rpsl/rpsl_item.hh.orig	2007-02-09 20:46:31.000000000 +0100
+++ src/rpsl/rpsl/rpsl_item.hh
@@ -127,6 +127,9 @@ public:
 	 && asno <= ((ItemASNO&) b).asno;
    }
    virtual Buffer *bufferize(Buffer *buf = NULL, bool lcase = false) const;
+   virtual const char *sprint(char *buf) {
+	  asnum_string(buf, asno);
+   }
 #ifdef DEBUG
    virtual const char *className(void) const {
       return "ItemASNO";
$NetBSD: patch-cv,v 1.1 2007/09/07 21:26:32 spz Exp $

--- src/rpsl/rpsl/rpsl.y.orig	2006-06-08 17:16:26.000000000 +0200
+++ src/rpsl/rpsl/rpsl.y
@@ -755,7 +755,7 @@ tkn_word: TKN_WORD {
 }
 | TKN_ASNO {
    char buffer[64];
-   sprintf(buffer, "AS%d", $1);
+   asnum_string(buffer, $1);
    $$ = strdup(buffer);
 }
 | TKN_ASNAME {
$NetBSD: patch-cw,v 1.2 2009/02/14 16:17:06 spz Exp $

--- src/rpsl/rpsl/rpsl_item.cc.orig	2006-06-08 17:16:26.000000000 +0200
+++ src/rpsl/rpsl/rpsl_item.cc
@@ -67,14 +67,18 @@ ostream &Item::print(ostream &out) const
 }
 
 ostream &ItemASNO::print(ostream &out) const {
-   out << "AS" << asno;
+   char buffer[64];
+   asnum_string(buffer, asno);
+   out << buffer;
    return out;
 }
 
 Buffer *ItemASNO::bufferize(Buffer *buf, bool lcase) const {
+   char buffer[64];
+   asnum_string(buffer, asno);
    if (!buf)
       buf = new Buffer;
-   buf->appendf("as%d", asno);
+   buf->appendf(buffer);
    return buf;
 }
 
$NetBSD$

--- src/irr/irr.cc.orig	2006-10-01 13:23:32.000000000 +0200
+++ src/irr/irr.cc
@@ -316,13 +316,20 @@ const AutNum *IRR::getAutNum(ASt as) {
    AutNum *result = NULL;
 
    if (! AutNumCache.query(as, result)) {
-      sprintf(buffer, "AS%d", as);
+      asnum_string_dot(buffer, as); // try asdotted
       if (getAutNum(buffer, text, len)) {
 	 Buffer b(text, len);
 	 result = new AutNum(b);
 	 AutNumCache.add(as, result);
-      } else
-	 AutNumCache.add(as, NULL); // a negative object
+      } else {
+         asnum_string_plain(buffer, as); // try asplain before giving up
+         if (getAutNum(buffer, text, len)) {
+	    Buffer b(text, len);
+	    result = new AutNum(b);
+	    AutNumCache.add(as, result);
+         } else
+	    AutNumCache.add(as, NULL); // a negative object
+      }
    }
 
    return result;
@@ -369,7 +376,7 @@ void IRR::getRoute(Route *&route, Prefix
    char *text;
    int  len;
 
-   sprintf(buffer, "AS%d", as);
+   asnum_string_dot(buffer, as);
    if (getRoute(rt->get_text(), buffer, text, len)) {
       Buffer b(text, len);
       route = new Route(b);
@@ -383,12 +390,18 @@ void IRR::getRoute(Route *&route, char *
   char *text;
   int  len;
 
-  sprintf(buffer, "AS%d", as);
+  asnum_string_dot(buffer, as);
   if (getRoute(rt, buffer, text, len)) {
      Buffer b(text, len);
      route = new Route(b);
-  } else
-     route = NULL;
+  } else {
+     asnum_string_plain(buffer, as);
+     if (getRoute(rt, buffer, text, len)) {
+        Buffer b(text, len);
+        route = new Route(b);
+     } else
+        route = NULL;
+  }
 }
 
 const InetRtr *IRR::getInetRtr(SymID inetRtr)
@@ -423,11 +436,14 @@ const MPPrefixRanges *IRR::expandAS(ASt 
       // we insert the set to the cache before expanding
       // this is needed to avoid recursion if sets are recursively defined
       expandASCache.add(as, result);
-      sprintf(buffer, "AS%d", as);
+      asnum_string_dot(buffer, as); // try asdotted
       if (!expandAS(buffer, result)) {
-   expandASCache.nullify(as);
-  delete result;
-  result = NULL; // A negative cache
+         asnum_string_plain(buffer, as); // that failed, try asplained
+         if (!expandAS(buffer, result)) {
+            expandASCache.nullify(as);
+            delete result;
+            result = NULL; // A negative cache
+         }
       }
    }
 
$NetBSD$

--- src/rpsl/rpsl/rpsl_asnum.hh.orig	2009-03-15 16:45:45.000000000 +0100
+++ src/rpsl/rpsl/rpsl_asnum.hh
@@ -0,0 +1,28 @@
+#ifndef ASNUM_HH
+#define ASNUM_HH 1
+
+extern bool opt_asdot;
+
+inline int asnum_string(char *buf, unsigned int asno)
+{
+   if (asno > 65535 && opt_asdot)
+      return sprintf(buf, "AS%d.%d", asno>>16, asno&0xffff);
+   else
+      return sprintf(buf, "AS%d", asno);
+}
+
+inline int asnum_string_dot(char *buf, unsigned int asno)
+{
+   if (asno > 65535)
+      return sprintf(buf, "AS%d.%d", asno>>16, asno&0xffff);
+   else
+      return sprintf(buf, "AS%d", asno);
+}
+
+inline int asnum_string_plain(char *buf, unsigned int asno)
+{
+   return sprintf(buf, "AS%d", asno);
+}
+
+#endif
+
$NetBSD: patch-da,v 1.2 2009/02/14 16:17:06 spz Exp $

--- src/aoe/aoe.cc.orig	2002-04-09 13:48:46.000000000 +0200
+++ src/aoe/aoe.cc
@@ -106,6 +106,7 @@ Rusage ru(clog, &opt_rusage);
 char *opt_my_as  = NULL;
 char *opt_rcfile = NULL;
 char *display    = NULL;
+bool opt_asdot   = true;
 ASt myAS         = 0;
 
 
@@ -153,6 +154,9 @@ void init_and_set_options (int argc, cha
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
+       "print AS numbers in asplain format."},
+
       // aoe specific arguments
       {"-as",  ARGV_STRING,     (char *)NULL, (char *) &opt_my_as,
        "AS number of the aut-num object to use"},
@@ -275,7 +279,7 @@ TclList &operator<<(TclList &tl, List<AS
 	pcASPeer;
 	pcASPeer = lh.next(pcASPeer))
       {
-      sprintf(pzcASPeerNo, "AS%d", pcASPeer->getNo());
+      asnum_string(pzcASPeerNo, pcASPeer->getNo());
       switch (pcASPeer->getType())
 	 {
 	 case dASPeerFromIRR:
@@ -662,8 +666,8 @@ int ListPeer::command(int argc, char *ar
    ASt tPeerAS      = pcApp->getASPeerNo(iPeerASIndex);
    
    char pzcMyAS[16], pzcPeerAS[16];
-   sprintf(pzcMyAS, "AS%d", tMyAS);
-   sprintf(pzcPeerAS, "AS%d", tPeerAS);
+   asnum_string(pzcMyAS, tMyAS);
+   asnum_string(pzcPeerAS, tPeerAS);
 
    // Setup $PeerAS properly
    if (!pcApp->evalf("set PeerAS %s", pzcPeerAS)) return TCL_ERROR;
@@ -1093,7 +1097,7 @@ AoeApplication::AoeApplication(char *pzc
    pcPolicyShowButton(NULL),
    pcStatusLine(NULL)
 {
-  sprintf(pzcASNo, "AS%d", tASNo);
+  asnum_string(pzcASNo, tASNo);
   if (!(pcIrr = IRR::newClient()))
     {
     usage();
$NetBSD: patch-db,v 1.1 2007/09/07 21:26:33 spz Exp $

--- src/aoe/bgp_aspath.cc.orig	2002-04-09 13:48:46.000000000 +0200
+++ src/aoe/bgp_aspath.cc
@@ -110,11 +110,15 @@ void BgpASPath::print(void)
 	pcFirstAndLastAS; 
 	pcFirstAndLastAS = cFirstAndLastASes.next(pcFirstAndLastAS))
       {
-      printf("AS%d --", pcFirstAndLastAS->getFirst());
+      char buf[64];
+	  asnum_string(buf, pcFirstAndLastAS->getFirst());
+	  printf("%s --", buf);
       for (int i = pcFirstAndLastAS->getLast().first(); 
 	   i >= 0; 
-	   i = pcFirstAndLastAS->getLast().next(i))
-	 printf(" AS%d", i); 
+	   i = pcFirstAndLastAS->getLast().next(i)) {
+	     asnum_string(buf, i);
+		 printf(" %s", buf);
+       }
       printf("\n");
       }
 }
$NetBSD: patch-dc,v 1.1 2007/09/07 21:26:33 spz Exp $

--- src/roe/schedule.cc.orig	2002-04-09 13:48:48.000000000 +0200
+++ src/roe/schedule.cc
@@ -177,7 +177,8 @@ void Schedule::add_selected(char *select
    for (char *s = strtok(selection, " \t"); s; s = strtok(NULL, " \t")) {
       r = routelist(atoi(s));
 
-      tcl_Eval("set AS AS%d", routelist.as);
+	  asnum_string(buffer, routelist.as);
+	  tcl_Eval("set AS %s", buffer);
       tcl_Eval("set ROUTE %s", r->route.get_text(buffer));
       tcl_Eval("set DATE %s", configure.date);
       tcl_Eval("subst \"%s\"", configure.add_template);
@@ -190,6 +191,7 @@ void Schedule::del_selected(char *select
    RouteList::Route *r;
    RouteList::Route::db_as *p;
    Route *route = NULL;
+   char buffer[64];
 
    for (char *s = strtok(selection, " \t"); s; s = strtok(NULL, " \t")) {
       r = routelist(atoi(s));
@@ -213,7 +215,8 @@ void Schedule::del_selected(char *select
          // Modified by wlee at isi.edu
 	 //	 if (code)
 	 if (route) {
-	    tcl_Eval("set AS AS%d", routelist.as);
+		asnum_string(buffer, routelist.as);
+	    tcl_Eval("set AS %s", buffer);
 	    tcl_Eval("set ROUTE %s", r->route.get_text());
 	    tcl_Eval("set DATE %s", configure.date);
 	    tcl_Eval("subst \"%.*s%s\"", 
@@ -231,6 +234,7 @@ void Schedule::del_selected_matching_sou
    RouteList::Route *r;
    RouteList::Route::db_as *p;
    Route *route = NULL;
+   char buffer[64];
 
    for (char *s = strtok(selection, " \t"); s; s = strtok(NULL, " \t")) {
       r = routelist(atoi(s));
@@ -254,7 +258,8 @@ void Schedule::del_selected_matching_sou
 
 	    // Modified by wlee at isi.edu
 	    if (route) {
-	       tcl_Eval("set AS AS%d", routelist.as);
+		   asnum_string(buffer, routelist.as);
+	       tcl_Eval("set AS %s", buffer);
 	       tcl_Eval("set ROUTE %s", r->route.get_text());
 	       tcl_Eval("set DATE %s", configure.date);
 	       tcl_Eval("subst \"%.*s%s\"", 
$NetBSD: patch-dd,v 1.2 2009/02/14 16:17:06 spz Exp $

--- src/roe/route-list.cc.orig	2002-06-18 13:00:11.000000000 +0200
+++ src/roe/route-list.cc
@@ -67,6 +67,7 @@ extern IRR *RLWhois;
 
 char *RouteList::format(RouteList::Route *vr) {
    static char line[256];
+   char buf[64];
    char *c;
 
    for (c = line; c < line + vr->indentation; ++c)
@@ -108,8 +109,10 @@ char *RouteList::format(RouteList::Route
    strcat(line, "    ");
 
    RouteList::Route::db_as* p;
-   for (p = vr->db_as_l.head(); p; p = vr->db_as_l.next(p))
-      sprintf(line + strlen(line), "  %s:AS%d", p->db, p->as);
+   for (p = vr->db_as_l.head(); p; p = vr->db_as_l.next(p)) {
+      asnum_string(buf, p->as);
+      sprintf(line + strlen(line), "  %s:%s", p->db, buf);
+   }
 
    return line;
 }
@@ -497,13 +500,17 @@ void RouteList::load(ASt _as) {
    const PrefixRanges *registered_routes = whois->expandAS(as);
 
    if (!registered_routes) 	{
-	tcl_Eval("showWarning { No object for AS%d}", as);
+	char buf[64];
+	asnum_string(buf, as);
+	tcl_Eval("showWarning { No object for %s}", buf);
         return;
    }
 	
    // Added by wlee
    if (registered_routes->isEmpty()) {
-     tcl_Eval("showWarning { No route for AS%d}", as);
+     char buf[64];
+     asnum_string(buf, as);
+     tcl_Eval("showWarning { No route for %s}", buf);
      return;
    }
 
$NetBSD: patch-de,v 1.1 2007/09/07 21:26:33 spz Exp $

--- src/roe/object.cc.orig	2002-04-09 13:48:48.000000000 +0200
+++ src/roe/object.cc
@@ -107,7 +107,8 @@ void RoeObject::del(int index) {
    RouteList::Route *vr = routelist(index);
 
    // Modified by wlee at isi.edu
-   tcl_Eval("set AS AS%d", routelist.as);
+   asnum_string(buffer, routelist.as);
+   tcl_Eval("set AS %s", buffer);
    //   tcl_Eval("set AS %s", routelist.as);
    tcl_Eval("set ROUTE %s", vr->route.get_text(buffer));
    tcl_Eval("set DATE %s", configure.date);
@@ -123,7 +124,8 @@ void RoeObject::add(int index) {
    RouteList::Route *vr = routelist(index);
 
    // Modified by wlee at isi.edu
-   tcl_Eval("set AS AS%d", routelist.as);
+   asnum_string(buffer, routelist.as);
+   tcl_Eval("set AS %s", buffer);
    //   tcl_Eval("set AS %s", routelist.as);
    tcl_Eval("set ROUTE %s", vr->route.get_text(buffer));
    tcl_Eval("set DATE %s", configure.date);
@@ -140,7 +142,8 @@ void RoeObject::upd(int index) {
    RouteList::Route *vr = routelist(index);
 
    // Modified by wlee at isi.edu
-   tcl_Eval("set AS AS%d", routelist.as);
+   asnum_string(buffer, routelist.as);
+   tcl_Eval("set AS %s", buffer);
    //   tcl_Eval("set AS %s", routelist.as);
    tcl_Eval("set ROUTE %s", vr->route.get_text(buffer));
    tcl_Eval("set DATE %s", configure.date);
$NetBSD: patch-df,v 1.2 2009/02/14 16:17:06 spz Exp $

--- src/prtraceroute/prtraceroute.cc.orig	2002-04-09 13:48:47.000000000 +0200
+++ src/prtraceroute/prtraceroute.cc
@@ -103,6 +103,7 @@
 extern IRR * irr;  // defined in irr.cc
 
 int  opt_rusage         = 0;
+int  opt_asdot          = true;
 
 int policy_flag = 1;
 int nflag = 0;
@@ -171,6 +172,7 @@ main (int argc, char **argv, char **envp
   ICMPProbeReply reply;		    // wait for incoming icmp's
   Timer t1, t2;
   int ttl, got_there = 0, unreachable = 0;
+  char buf[64];
 
   printf ("prtraceroute to %s (%s), %d hops max, %d byte packets\n",
           dst, dstip->getIpaddr(), max_ttl, datalen);
@@ -192,7 +194,8 @@ main (int argc, char **argv, char **envp
             ipAddr *ipaddr = new ipAddr (newaddr);
             if (policy_flag) {
               path.addHop(ipaddr, ttl);
-              printf (" [AS%d]", path.getHopAS(ttl));
+              asnum_string(buf, path.getHopAS(ttl));
+			  printf (" [%s]", buf);
             }
             if (!nflag) {
               printf (" %s (%s)", ipaddr->getName(),
@@ -401,6 +404,9 @@ init_and_set_options (int argc, char **a
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
+       "print AS numbers in asplain format."},
+
       // prtraceroute specific arguments
       {"-g", ARGV_FUNC, (char *)gFlag, (char *)NULL,
        "Gateway"},
@@ -690,6 +696,7 @@ Path::process_policies()  {
   const AutNum * autnum;
   
   char test[80];
+  char buf[64];
   
   actiondictionary = new ActionDictionary;
 
@@ -796,7 +803,8 @@ Path::process_policies()  {
   for (i = last_ttl; i >= 0; i--) {
     if (hops[i] != NULL) {
       //cout << i << "   AS" << getHopAS(i) << " ";
-      printf ("%3d  AS%d", i, getHopAS(i));
+      asnum_string(buf, getHopAS(i));
+	  printf ("%3d  %s", i, buf);
       if (nflag)		// XXX, this is a global, and is bad!!!
         //cout << hops[i]->ipaddr->getIpaddr();
         printf (" %-35s", hops[i]->ipaddr->getIpaddr());
$NetBSD: patch-dg,v 1.1 2007/09/07 21:26:33 spz Exp $

--- src/rpsl/rpsl/symbols.hh.orig	2002-04-09 13:48:49.000000000 +0200
+++ src/rpsl/rpsl/symbols.hh
@@ -58,6 +58,7 @@
 #include "util/Allocator.hh"
 #include "gnu/SetOfSymID.hh"
 #include "util/xstring.h"
+#include "rpsl/rpsl_asnum.hh"
 #include <cstdio>
 
 typedef unsigned int ASt;
@@ -114,7 +115,7 @@ public:
    }
 
    SymID resolvePeerAS(SymID sid, ASt peerAS) {
-      char *buffer = (char *) malloc(strlen(sid) * 2);
+      char *buffer = (char *) malloc(strlen(sid) * 3);
       char *head, *tail, *ptr;
       int  written;
       ptr = buffer;
@@ -123,7 +124,7 @@ public:
 	   tail = head + 6, head++, head = strstr(head, "PEERAS")) {
 	 strncpy(ptr, tail, head - tail);
 	 ptr += (head - tail);
-	 sprintf(ptr, "AS%d", peerAS);
+	 asnum_string(ptr, peerAS);
 	 written = strlen(ptr);
 	 ptr += written;
       }
$NetBSD: patch-dh,v 1.1 2007/09/07 21:26:34 spz Exp $

--- src/rpsl/rpsl/rpsl.l.orig	2006-10-01 13:23:32.000000000 +0200
+++ src/rpsl/rpsl/rpsl.l
@@ -74,7 +74,7 @@ INT            [[:digit:]]+
 SINT           [+-]?{INT}
 REAL           [+-]?{INT}?\.{INT}({WS}*E{WS}*[+-]?{INT})?
 NAME           [[:alpha:]]([[:alnum:]_-]*[[:alnum:]])?
-ASNO           AS{INT}
+ASNO           AS{INT}\.{INT}|AS{INT}
 ASNAME         AS-[[:alnum:]_-]*[[:alnum:]]
 RSNAME         RS-[[:alnum:]_-]*[[:alnum:]]
 RTRSNAME       RTRS-[[:alnum:]_-]*[[:alnum:]]
@@ -455,7 +455,11 @@ extern void atollRA(...);
 
   /* The order of these rules are important */
   {ASNO} {
-     yylval.i = atoi(yytext+2);
+     const char *dot = strchr(yytext,'.');
+	 if (dot)
+	   yylval.i = atoi(yytext+2)<<16 | atoi(dot+1);
+	 else
+	   yylval.i = atoi(yytext+2);
      LEXER_RETURN(TKN_ASNO);
   }
 
@@ -751,7 +755,7 @@ void yy_scan_object(Object *o) {
 
    if (rpsl_buffer)
       yy_delete_buffer(rpsl_buffer);
-   rpsl_buffer = yy_scan_bytes(o->contents, o->size);
+   rpsl_buffer = yy_scan_bytes(o->contents, (yy_size_t)o->size);
    BEGIN(INITIAL);
 }
 
$NetBSD: patch-di,v 1.2 2009/02/14 16:17:06 spz Exp $

--- src/irr/birdwhoisc.cc.orig	2006-10-09 18:05:14.000000000 +0200
+++ src/irr/birdwhoisc.cc
@@ -429,7 +429,11 @@ int BirdWhoisClient::getSourceOrigin(cha
 	AttrGenericIterator<ItemASNO> itrOrigin(itrObject, "origin");
 	AttrGenericIterator<ItemWORD> itrSource(itrObject, "source");
 	if (itrOrigin && itrSource)
-	  cBuffer.append("%s AS%d\n", itrSource()->word, itrOrigin()->asno);
+	  {
+	  char buf[64];
+	  asnum_string_dot(buf, itrOrigin()->asno);
+	  cBuffer.append("%s %s\n", itrSource()->word, buf);
+	  }
 	}
     }
   if (cBuffer.empty()) 
$NetBSD: patch-dp,v 1.2 2009/02/14 16:17:06 spz Exp $

--- man/man1/peval.1.orig	2006-10-01 13:23:32.000000000 +0200
+++ man/man1/peval.1
@@ -137,6 +137,9 @@ Do not expand anything.
 Do a prior symbolic evaluation, then do the expansions and then
 re-evaluate.
 This may be faster for some policies.
+.IP \-asplain
+Print AS numbers as asplain, i.e. as unstructured number;
+default is to use the more human readable asdot format.
 .IP -compressed
 Print prefix lists using the more specific operators. 
 Otherwise,
$NetBSD: patch-dr,v 1.3 2009/02/14 22:19:52 spz Exp $

--- man/man1/RtConfig.1.orig	2006-10-01 13:23:32.000000000 +0200
+++ man/man1/RtConfig.1
@@ -123,11 +123,14 @@ database server or parsing policy object
 .IP "\-config <config-format>"
 Produce router configuration in <config-format>
 which is either cisco (default), junos, bcc (for bay), gated or rsd.
 .IP \-no_match_ip_inbound
 In older Cisco IOS versions, 
 in-bound route maps did not support ip access-list matches.
 Use of this option causes RtConfig to use distribute-lists to overcome
 this limitation.
+.IP \-asplain
+Print AS numbers as asplain, i.e. as unstructured number;
+default is to use the more human readable asdot format.
 .IP \-disable_access_list_cache
 RtConfig caches the access-lists (and in the future ip as-path
 access-lists and route-maps) that it generates so that the same
$NetBSD: patch-dt,v 1.1 2009/02/14 16:17:06 spz Exp $

--- src/roe/roe.cc.orig	2002-04-09 13:48:48.000000000 +0200
+++ src/roe/roe.cc
@@ -99,6 +99,7 @@ char *opt_rcfile       = ".roerc";
 char opt_default_rcfile[256] = "";
 char *display  = NULL;
 char *geometry = NULL;
+bool opt_asdot = true;
 ASt myAS;
 
 
@@ -138,6 +139,9 @@ void init_and_set_options (int argc, cha
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
+       "print AS numbers in asplain format."},
+
       // roe specific arguments
       {"-as",  ARGV_STRING,    (char *) NULL,    (char *) &opt_my_as,
        "AS number of the aut-num object to use."},
$NetBSD: patch-du,v 1.1 2009/02/14 16:17:06 spz Exp $

--- src/peval/peval.cc.orig	2006-06-08 17:16:26.000000000 +0200
+++ src/peval/peval.cc
@@ -98,6 +98,7 @@ Rusage ru(clog, &opt_rusage);
 char *opt_prompt                 = "peval> ";
 int  opt_expand                  = EXPAND_ALL;
 int  opt_symbolic                = 0;
+bool opt_asdot                   = true;
 
 const int SIZE = 8*1024;
 char base[SIZE] = "peval: ";
@@ -228,6 +229,9 @@ void init_and_set_options (int argc, cha
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
+       "print AS numbers in asplain format."},
+
       // peval specific arguments
       {"-symbolic",  ARGV_CONSTANT, (char *)1, (char *)&opt_symbolic, 
        "Symbolic"},
$NetBSD: patch-dv,v 1.2 2009/02/14 22:19:52 spz Exp $

--- src/RtConfig/RtConfig.cc.orig	2006-10-01 13:23:32.000000000 +0200
+++ src/RtConfig/RtConfig.cc
@@ -85,6 +85,7 @@ bool opt_rusage                  = false
 Rusage ru(clog, &opt_rusage);
 
 char *opt_prompt                 = "RtConfig> ";
+bool opt_asdot                   = true;
 
 bool         RtConfig::supressMartians          = false;
 int          RtConfig::preferenceCeiling        = 1000;
@@ -182,5 +183,8 @@ void init_and_set_options (int argc, cha
      
      IRR_COMMAND_LINE_OPTIONS,
 
+     {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
+      "print AS numbers in asplain format."},
+
      {"-config", ARGV_FUNC, (char *) &select_config_format, (char *) NULL, 
       "Configuration format (junos, cisco, bcc, gated or rsd)"},
$NetBSD: patch-dw,v 1.2 2009/02/15 10:45:02 spz Exp $

--- src/rpslcheck/rpslcheck.cc.orig	2007-02-09 20:46:31.000000000 +0100
+++ src/rpslcheck/rpslcheck.cc
@@ -72,6 +72,7 @@ bool opt_stats                   = false
 bool opt_rusage                  = false;
 char *opt_prompt                 = "rpslcheck> ";
 bool opt_echo                    = false;
+bool opt_asdot                   = true;
 char *opt_my_as			 = NULL;
 #ifdef DEBUG
 bool opt_debug_rpsl              = false;
@@ -106,6 +107,9 @@ void init_and_set_options (int argc, cha
      
      IRR_COMMAND_LINE_OPTIONS,
 
+     {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
+      "print AS numbers in asplain format."},
+
      {"-rusage", ARGV_BOOL, (char *) NULL,           (char *) &opt_rusage,
       "On termination print resource usage"},
      {"-stats", ARGV_BOOL, (char *) NULL,            (char *) &opt_stats,
@@ -163,7 +167,11 @@ main(int argc, char **argv, char **envp)
    
    while (opt_my_as || cin ) {
        if (opt_my_as) {
-	  myAS = atoi(opt_my_as + 2);
+          const char *dot = strchr(opt_my_as,'.');
+          if (dot)
+             myAS = atoi(opt_my_as + 2)<<16 | atoi(dot+1);
+          else
+	     myAS = atoi(opt_my_as + 2);
 	  const AutNum *autnum = irr->getAutNum(myAS);
           if (!autnum)	{
           	std::cerr << "Error: no object for AS " << myAS << std::endl;
$NetBSD: patch-dx,v 1.1 2009/02/14 16:17:06 spz Exp $

--- man/man1/aoe.1.orig	2002-07-02 14:41:49.000000000 +0200
+++ man/man1/aoe.1
@@ -137,6 +137,9 @@ database server or parsing policy object
 .RS
 .IP "\-as <as-no>"
 Gets aut-num object for <as-no>. 
+.IP \-asplain
+Print AS numbers as asplain, i.e. as unstructured number;
+default is to use the more human readable asdot format.
 .IP "-rcfile <resource filename>"
 .IP "\-display <X Windows Display Specification>"
 .RE
$NetBSD: patch-dy,v 1.1 2009/02/14 16:17:07 spz Exp $

--- man/man1/roe.1.orig	2002-07-02 14:41:50.000000000 +0200
+++ man/man1/roe.1
@@ -115,6 +115,9 @@ database server or parsing policy object
 .RS
 .IP "\-as <as-no>"
 Lists routes of <as-no>. 
+.IP \-asplain
+Print AS numbers as asplain, i.e. as unstructured number;
+default is to use the more human readable asdot format.
 .IP "-rcfile <resource filename>"
 .IP "\-display <X Windows Display Specification>"
 .IP "\-geometry <X Windows Geometry Specification>"
$NetBSD: patch-dz,v 1.1 2009/02/14 16:17:07 spz Exp $

--- man/man1/prtraceroute.1.orig	2002-07-02 14:41:50.000000000 +0200
+++ man/man1/prtraceroute.1
@@ -133,6 +133,9 @@ Consider the sources specified in the co
 If an object is defined in multiple sources in <source-list>,
 pmatch uses the definition first encountered in <source-list>
 from left to right.
+.IP \-asplain
+Print AS numbers as asplain, i.e. as unstructured number;
+default is to use the more human readable asdot format.
 .RE
 .SH ENVIRONMENT VARIABLES
 .RS


More information about the irrtoolset mailing list