[PATCH] Remove asdot support
Faidon Liambotis
paravoid at debian.org
Mon Jun 21 14:21:29 UTC 2010
The preferred format is asplain (RFC 5396); irr databases have long
stopped supporting the asdot format, so no reason to clutter our
codebase. Also halves the queries made, plus fixes a few bugs here and
there.
---
src/irr/irr.cc | 53 +++++++++++++++----------------------------
src/peval/peval.1 | 3 --
src/peval/peval.cc | 4 ---
src/rpsl/rpsl_asnum.hh | 18 ---------------
src/rpslcheck/rpslcheck.cc | 4 ---
src/rtconfig/rtconfig.1 | 3 --
src/rtconfig/rtconfig.cc | 4 ---
7 files changed, 19 insertions(+), 70 deletions(-)
diff --git a/src/irr/irr.cc b/src/irr/irr.cc
index 639b36c..2da729e 100644
--- a/src/irr/irr.cc
+++ b/src/irr/irr.cc
@@ -308,20 +308,14 @@ const AutNum *IRR::getAutNum(ASt as) {
AutNum *result = NULL;
if (! AutNumCache.query(as, result)) {
- 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 {
- 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
- }
+ asnum_string(buffer, as);
+ 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;
@@ -368,7 +362,7 @@ void IRR::getRoute(Route *&route, Prefix *rt, ASt as) {
char *text;
int len;
- asnum_string_dot(buffer, as);
+ asnum_string(buffer, as);
if (getRoute(rt->get_text(), buffer, text, len)) {
Buffer b(text, len);
route = new Route(b);
@@ -381,18 +375,12 @@ void IRR::getRoute(Route *&route, char *rt, ASt as)
char *text;
int len;
- asnum_string_dot(buffer, as);
- if (getRoute(rt, buffer, text, len)) {
- Buffer b(text, len);
- route = new Route(b);
- } else {
- asnum_string_plain(buffer, as);
- if (getRoute(rt, buffer, text, len)) {
- Buffer b(text, len);
- route = new Route(b);
- } else
- route = NULL;
- }
+ asnum_string(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)
@@ -425,14 +413,11 @@ const MPPrefixRanges *IRR::expandAS(ASt as) {
// we insert the set to the cache before expanding
// this is needed to avoid recursion if sets are recursively defined
expandASCache.add(as, result);
- asnum_string_dot(buffer, as); // try asdotted
+ asnum_string(buffer, as);
if (!expandAS(buffer, result)) {
- asnum_string_plain(buffer, as); // that failed, try asplained
- if (!expandAS(buffer, result)) {
- expandASCache.nullify(as);
- delete result;
- result = NULL; // A negative cache
- }
+ expandASCache.nullify(as);
+ delete result;
+ result = NULL; // A negative cache
}
}
diff --git a/src/peval/peval.1 b/src/peval/peval.1
index dfda57b..11c8dc5 100644
--- a/src/peval/peval.1
+++ b/src/peval/peval.1
@@ -129,9 +129,6 @@ 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 \-asdot
-Print AS numbers as asdot, i.e. in "X.Y" format;
-the default is to use RFC-5396 recommended "asplain" format.
.IP -compressed
Print prefix lists using the more specific operators.
Otherwise,
diff --git a/src/peval/peval.cc b/src/peval/peval.cc
index 08420f2..79de8c0 100644
--- a/src/peval/peval.cc
+++ b/src/peval/peval.cc
@@ -91,7 +91,6 @@ Rusage ru(clog, &opt_rusage);
char *opt_prompt = (char *)"peval> ";
int opt_expand = EXPAND_ALL;
int opt_symbolic = 0;
-bool opt_asdot = false;
const int SIZE = 8*1024;
char base[SIZE] = "peval: ";
@@ -222,9 +221,6 @@ void init_and_set_options (int argc, char **argv, char **envp) {
IRR_COMMAND_LINE_OPTIONS,
- {"-asdot", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
- "print AS numbers in asdot format."},
-
// peval specific arguments
{"-symbolic", ARGV_CONSTANT, (char *)1, (char *)&opt_symbolic,
"Symbolic"},
diff --git a/src/rpsl/rpsl_asnum.hh b/src/rpsl/rpsl_asnum.hh
index 7d351c6..6179b86 100644
--- a/src/rpsl/rpsl_asnum.hh
+++ b/src/rpsl/rpsl_asnum.hh
@@ -1,26 +1,8 @@
#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);
}
diff --git a/src/rpslcheck/rpslcheck.cc b/src/rpslcheck/rpslcheck.cc
index f40a4aa..b893900 100644
--- a/src/rpslcheck/rpslcheck.cc
+++ b/src/rpslcheck/rpslcheck.cc
@@ -65,7 +65,6 @@ bool opt_stats = false;
bool opt_rusage = false;
char *opt_prompt = (char *)"rpslcheck> ";
bool opt_echo = false;
-bool opt_asdot = false;
char *opt_my_as = NULL;
#ifdef ENABLE_DEBUG
bool opt_debug_rpsl = false;
@@ -100,9 +99,6 @@ void init_and_set_options (int argc, char **argv, char **envp) {
IRR_COMMAND_LINE_OPTIONS,
- {"-asdot", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
- "print AS numbers in asdot format."},
-
{"-rusage", ARGV_BOOL, (char *) NULL, (char *) &opt_rusage,
"On termination print resource usage"},
{"-stats", ARGV_BOOL, (char *) NULL, (char *) &opt_stats,
diff --git a/src/rtconfig/rtconfig.1 b/src/rtconfig/rtconfig.1
index b37d85e..313dad0 100644
--- a/src/rtconfig/rtconfig.1
+++ b/src/rtconfig/rtconfig.1
@@ -120,9 +120,6 @@ 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 \-asdot
-Print AS numbers as asdot, i.e. in "X.Y" format;
-the default is to use RFC-5396 recommended "asplain" 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
diff --git a/src/rtconfig/rtconfig.cc b/src/rtconfig/rtconfig.cc
index 14b1602..7787a53 100644
--- a/src/rtconfig/rtconfig.cc
+++ b/src/rtconfig/rtconfig.cc
@@ -80,7 +80,6 @@ bool opt_rusage = false;
Rusage ru(clog, &opt_rusage);
char *opt_prompt = (char *)"rtconfig> ";
-bool opt_asdot = false;
bool RtConfig::supressMartians = false;
int RtConfig::preferenceCeiling = 1000;
@@ -169,9 +168,6 @@ void init_and_set_options (int argc, char **argv, char **envp) {
IRR_COMMAND_LINE_OPTIONS,
- {"-asdot", ARGV_BOOL, (char *) NULL, (char *) &opt_asdot,
- "print AS numbers in asdot format."},
-
{"-config", ARGV_FUNC, (char *) &select_config_format, (char *) NULL,
"Configuration format (junos, cisco)"},
{"-no_match_ip_inbound", ARGV_BOOL,
--
1.7.0
More information about the irrtoolset
mailing list