Bit of tweaking to IRRToolSet web site

S.P.Zeidler spz at serpens.de
Tue Jan 27 08:35:51 UTC 2009


Hi,

Thus wrote Nick Hilliard (nick at inex.ie):

> S.P.Zeidler wrote:
> > What's the advantage of asplain? I find asdot a lot better human readable.
> 
> RFC 5396.
> 
> asdot is more readable in many situations for humans.  Unfortunately, if
> you're in the business of writing as-path list regular expressions suitable
> for asn32s, it causes horror beyond all measure. 

Given that you usually care about entities and would ideally allow
macros, your aspaths usually have little numeric meaning. I get the point
about '.' being mistaken for a wildcard, but IMO that asks for asplain
to be allowed, not for asplain to be required.

> It also breaks the
> concept from a computer parsing point of view that an ASN is a number.

As it does with IP addresses?

I've reworked the patch to give a -asplain option to RtConfig and peval et al.
It's somewhat crude (everything uses asnumbers as ASt when they really
ought to use ItemASNO) and it needs testing (not even compile tested yet,
beware).

regards,
	spz
-- 
spz at serpens.de (S.P.Zeidler)
-------------- next part --------------
Index: src/prtraceroute/prtraceroute.cc
===================================================================
--- src/prtraceroute/prtraceroute.cc	(revision 221)
+++ src/prtraceroute/prtraceroute.cc	(working copy)
@@ -171,6 +171,7 @@
   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 +193,8 @@
             ipAddr *ipaddr = new ipAddr (newaddr);
             if (policy_flag) {
               path.addHop(ipaddr, ttl);
-              printf (" [AS%d]", path.getHopAS(ttl));
+              asnum_string(buf, path.getHopAS(ttl), ItemASNO::asdot);
+              printf (" [%s]", buf);
             }
             if (!nflag) {
               printf (" %s (%s)", ipaddr->getName(),
@@ -401,6 +403,9 @@
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &ItemASNO::asdot,
+       "print AS numbers in asplain format."},
+
       // prtraceroute specific arguments
       {"-g", ARGV_FUNC, (char *)gFlag, (char *)NULL,
        "Gateway"},
@@ -690,6 +695,7 @@
   const AutNum * autnum;
   
   char test[80];
+  char buf[64];
   
   actiondictionary = new ActionDictionary;
 
@@ -796,7 +802,8 @@
   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), ItemASNO::asdot);
+      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());
Index: src/rpsl/rpsl/rpsl_item.cc
===================================================================
--- src/rpsl/rpsl/rpsl_item.cc	(revision 221)
+++ src/rpsl/rpsl/rpsl_item.cc	(working copy)
@@ -60,6 +60,8 @@
 
 using namespace std;
 
+bool ItemASNO::asdot = true;
+
 //// printing ////////////////////////////////////////////////////////
 
 ostream &Item::print(ostream &out) const {
@@ -67,14 +69,18 @@
 }
 
 ostream &ItemASNO::print(ostream &out) const {
-   out << "AS" << asno;
+   char buffer[64];
+   asnum_string(buffer, asno, asdot);
+   out << buffer;
    return out;
 }
 
 Buffer *ItemASNO::bufferize(Buffer *buf, bool lcase) const {
+   char buffer[64];
+   asnum_string(buffer, asno, asdot);
    if (!buf)
       buf = new Buffer;
-   buf->appendf("as%d", asno);
+   buf->appendf(buffer);
    return buf;
 }
 
Index: src/rpsl/rpsl/symbols.hh
===================================================================
--- src/rpsl/rpsl/symbols.hh	(revision 221)
+++ src/rpsl/rpsl/symbols.hh	(working copy)
@@ -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 @@
    }
 
    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 @@
 	   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, ItemASNO::asdot);
 	 written = strlen(ptr);
 	 ptr += written;
       }
Index: src/rpsl/rpsl/rpsl.y
===================================================================
--- src/rpsl/rpsl/rpsl.y	(revision 221)
+++ src/rpsl/rpsl/rpsl.y	(working copy)
@@ -755,7 +755,7 @@
 }
 | TKN_ASNO {
    char buffer[64];
-   sprintf(buffer, "AS%d", $1);
+   asnum_string(buffer, $1, ItemASNO::asdot);
    $$ = strdup(buffer);
 }
 | TKN_ASNAME {
Index: src/rpsl/rpsl/rpsl_item.hh
===================================================================
--- src/rpsl/rpsl/rpsl_item.hh	(revision 221)
+++ src/rpsl/rpsl/rpsl_item.hh	(working copy)
@@ -112,7 +112,8 @@
 
 class ItemASNO : public Item {
 public:
-   ASt asno;
+   ASt  asno;
+   bool asdot;
 public:
    ItemASNO(ASt asn) {
       asno = asn;
@@ -127,6 +128,9 @@
 	 && asno <= ((ItemASNO&) b).asno;
    }
    virtual Buffer *bufferize(Buffer *buf = NULL, bool lcase = false) const;
+   virtual const char *sprint(char *buf) {
+      asnum_string(buf, asno, asdot);
+   }
 #ifdef DEBUG
    virtual const char *className(void) const {
       return "ItemASNO";
Index: src/rpsl/rpsl/rptype.cc
===================================================================
--- src/rpsl/rpsl/rptype.cc	(revision 221)
+++ src/rpsl/rpsl/rptype.cc	(working copy)
@@ -254,7 +254,7 @@
 	 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, ItemASNO::asdot);
       return new ItemWORD(strdup(buffer));
    }
 
@@ -285,7 +285,7 @@
 	 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, ItemASNO::asdot);
       return new ItemWORD(strdup(buffer));
    }
 
@@ -367,7 +367,7 @@
 	 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, ItemASNO::asdot);
       w = new ItemWORD(strdup(buffer));
    }
 
@@ -388,8 +388,7 @@
 ////////////////////////////// RPTypeASNumber ////////////////////
 
 bool RPTypeASNumber::validate(const Item *item) const {
-   return ((typeid(*item) == typeid(ItemASNO))
-	   && ((ItemASNO *) item)->asno <= 65535);
+   return ((typeid(*item) == typeid(ItemASNO)));
 }
 
 ////////////////////////////// RPTypeIPv4Address ////////////////////
Index: src/rpsl/rpsl/rpsl.l
===================================================================
--- src/rpsl/rpsl/rpsl.l	(revision 221)
+++ src/rpsl/rpsl/rpsl.l	(working copy)
@@ -74,7 +74,7 @@
 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 @@
 
   /* 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 @@
 
    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);
 }
 
Index: src/roe/schedule.cc
===================================================================
--- src/roe/schedule.cc	(revision 221)
+++ src/roe/schedule.cc	(working copy)
@@ -177,7 +177,8 @@
    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, ItemASNO::asdot);
+      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 @@
    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 @@
          // 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 @@
    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 @@
 
 	    // 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\"", 
Index: src/roe/object.cc
===================================================================
--- src/roe/object.cc	(revision 221)
+++ src/roe/object.cc	(working copy)
@@ -107,7 +107,8 @@
    RouteList::Route *vr = routelist(index);
 
    // Modified by wlee at isi.edu
-   tcl_Eval("set AS AS%d", routelist.as);
+   asnum_string(buffer, routelist.as, ItemASNO::asdot);
+   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 @@
    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 @@
    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);
Index: src/roe/route-list.cc
===================================================================
--- src/roe/route-list.cc	(revision 221)
+++ src/roe/route-list.cc	(working copy)
@@ -67,6 +67,7 @@
 
 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 @@
    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, ItemASNO::asdot);
+      sprintf(line + strlen(line), "  %s:%s", p->db, buf);
+   }
 
    return line;
 }
@@ -497,13 +500,17 @@
    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;
    }
 
Index: src/roe/roe.cc
===================================================================
--- src/roe/roe.cc	(revision 221)
+++ src/roe/roe.cc	(working copy)
@@ -138,6 +138,9 @@
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &ItemASNO::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."},
Index: src/irr/irr.cc
===================================================================
--- src/irr/irr.cc	(revision 221)
+++ src/irr/irr.cc	(working copy)
@@ -316,7 +316,7 @@
    AutNum *result = NULL;
 
    if (! AutNumCache.query(as, result)) {
-      sprintf(buffer, "AS%d", as);
+      asnum_string(buffer, as, ItemASNO::asdot);
       if (getAutNum(buffer, text, len)) {
 	 Buffer b(text, len);
 	 result = new AutNum(b);
@@ -369,7 +369,7 @@
    char *text;
    int  len;
 
-   sprintf(buffer, "AS%d", as);
+   asnum_string(buffer, as, ItemASNO::asdot);
    if (getRoute(rt->get_text(), buffer, text, len)) {
       Buffer b(text, len);
       route = new Route(b);
@@ -383,7 +383,7 @@
   char *text;
   int  len;
 
-  sprintf(buffer, "AS%d", as);
+  asnum_string(buffer, as, ItemASNO::asdot);
   if (getRoute(rt, buffer, text, len)) {
      Buffer b(text, len);
      route = new Route(b);
@@ -423,7 +423,7 @@
       // 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(buffer, as, ItemASNO::asdot);
       if (!expandAS(buffer, result)) {
    expandASCache.nullify(as);
   delete result;
Index: src/irr/birdwhoisc.cc
===================================================================
--- src/irr/birdwhoisc.cc	(revision 221)
+++ src/irr/birdwhoisc.cc	(working copy)
@@ -429,7 +429,11 @@
 	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(buf, itrOrigin()->asno, ItemASNO::asdot);
+	  cBuffer.append("%s %s\n", itrSource()->word, buf);
+	  }
 	}
     }
   if (cBuffer.empty()) 
Index: src/irr/irr.hh
===================================================================
--- src/irr/irr.hh	(revision 221)
+++ src/irr/irr.hh	(working copy)
@@ -59,6 +59,7 @@
 #include "gnug++/SetOfUInt.hh"
 #include "gnu/prefixranges.hh"
 #include "rpsl/prefix.hh"
+#include "rpsl/rpsl_asnum.hh"
 #include "classes.hh"
 
 class AutNum;
Index: src/aoe/aoe.cc
===================================================================
--- src/aoe/aoe.cc	(revision 221)
+++ src/aoe/aoe.cc	(working copy)
@@ -153,6 +153,9 @@
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &ItemASNO::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 +278,7 @@
 	pcASPeer;
 	pcASPeer = lh.next(pcASPeer))
       {
-      sprintf(pzcASPeerNo, "AS%d", pcASPeer->getNo());
+      asnum_string(pzcASPeerNo, pcASPeer->getNo(), ItemASNO::asdot);
       switch (pcASPeer->getType())
 	 {
 	 case dASPeerFromIRR:
@@ -662,8 +665,8 @@
    ASt tPeerAS      = pcApp->getASPeerNo(iPeerASIndex);
    
    char pzcMyAS[16], pzcPeerAS[16];
-   sprintf(pzcMyAS, "AS%d", tMyAS);
-   sprintf(pzcPeerAS, "AS%d", tPeerAS);
+   asnum_string(pzcMyAS, tMyAS, ItemASNO::asdot);
+   asnum_string(pzcPeerAS, tPeerAS, ItemASNO::asdot);
 
    // Setup $PeerAS properly
    if (!pcApp->evalf("set PeerAS %s", pzcPeerAS)) return TCL_ERROR;
@@ -1093,7 +1096,7 @@
    pcPolicyShowButton(NULL),
    pcStatusLine(NULL)
 {
-  sprintf(pzcASNo, "AS%d", tASNo);
+  asnum_string(pzcASNo, tASNo, ItemASNO::asdot);
   if (!(pcIrr = IRR::newClient()))
     {
     usage();
Index: src/aoe/bgp_aspath.cc
===================================================================
--- src/aoe/bgp_aspath.cc	(revision 221)
+++ src/aoe/bgp_aspath.cc	(working copy)
@@ -110,11 +110,16 @@
 	pcFirstAndLastAS; 
 	pcFirstAndLastAS = cFirstAndLastASes.next(pcFirstAndLastAS))
       {
-      printf("AS%d --", pcFirstAndLastAS->getFirst());
+      char buf[64];
+      asnum_string(buf, pcFirstAndLastAS->getFirst(), ItemASNO::asdot);
+      printf("%s --", buf);
       for (int i = pcFirstAndLastAS->getLast().first(); 
 	   i >= 0; 
 	   i = pcFirstAndLastAS->getLast().next(i))
-	 printf(" AS%d", i); 
+         {
+         asnum_string(buf, pcFirstAndLastAS->getFirst(), ItemASNO::asdot);
+	 printf(" %s", buf); 
+         }
       printf("\n");
       }
 }
Index: src/peval/peval.cc
===================================================================
--- src/peval/peval.cc	(revision 221)
+++ src/peval/peval.cc	(working copy)
@@ -228,6 +228,9 @@
 
       IRR_COMMAND_LINE_OPTIONS,
 
+      {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &ItemASNO::asdot,
+       "print AS numbers in asplain format."},
+
       // peval specific arguments
       {"-symbolic",  ARGV_CONSTANT, (char *)1, (char *)&opt_symbolic, 
        "Symbolic"},
Index: src/RtConfig/RtConfig.cc
===================================================================
--- src/RtConfig/RtConfig.cc	(revision 221)
+++ src/RtConfig/RtConfig.cc	(working copy)
@@ -190,6 +190,8 @@
      {"-disable_access_list_cache", ARGV_BOOL, 
       (char *) NULL, (char *) &CiscoConfig::useAclCaches,
       "Do not reuse the old access list numbers.\n\t\t\t\tCisco only."},
+     {"-asplain", ARGV_BOOL, (char *) NULL, (char *) &ItemASNO::asdot,
+      "print AS numbers in asplain format."},
      {"-cisco_skip_route_maps", ARGV_BOOL, 
       (char *) NULL, (char *) &CiscoConfig::printRouteMap,
       "Do not print route maps, only print access lists.\n\t\t\t\tCisco only."},
Index: src/normalform/SetOfSymbol.cc
===================================================================
--- src/normalform/SetOfSymbol.cc	(revision 221)
+++ src/normalform/SetOfSymbol.cc	(working copy)
@@ -271,7 +271,7 @@
 
 void SetOfSymbol::add(ASt as) {
    char buffer[64];
-   sprintf(buffer, "AS%d", as);
+   asnum_string(buffer, as, ItemASNO::asdot);
    add(symbols.symID(buffer));
 }
 
Index: man/man1/aoe.1
===================================================================
--- man/man1/aoe.1	(revision 221)
+++ man/man1/aoe.1	(working copy)
@@ -137,6 +137,9 @@
 .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
Index: man/man1/roe.1
===================================================================
--- man/man1/roe.1	(revision 221)
+++ man/man1/roe.1	(working copy)
@@ -115,6 +115,9 @@
 .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>"
Index: man/man1/peval.1
===================================================================
--- man/man1/peval.1	(revision 221)
+++ man/man1/peval.1	(working copy)
@@ -137,6 +137,9 @@
 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,
Index: man/man1/RtConfig.1
===================================================================
--- man/man1/RtConfig.1	(revision 221)
+++ man/man1/RtConfig.1	(working copy)
@@ -128,6 +128,9 @@
 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
Index: man/man1/prtraceroute.1
===================================================================
--- man/man1/prtraceroute.1	(revision 221)
+++ man/man1/prtraceroute.1	(working copy)
@@ -133,6 +133,9 @@
 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
Index: src/rpsl/rpsl/rpsl_asnum.hh
===================================================================
--- /dev/null	2009-01-27 09:27:00.000000000 +0100
+++ src/rpsl/rpsl/rpsl_asnum.hh	2009-01-27 08:04:09.000000000 +0100
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael van Elst <mlelstv at NetBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ASNUM_HH
+#define ASNUM_HH 1
+
+inline int asnum_string(char *buf, unsigned int asno, bool asdot)
+{
+   if (asno > 65535 && asdot)
+      return sprintf(buf, "AS%d.%d", asno>>16, asno&0xffff);
+   else
+      return sprintf(buf, "AS%d", asno);
+}
+
+#endif
+


More information about the irrtoolset mailing list