RtConfig and rpsl.ripe.net
Shane Kerr shane at ripe.net
Thu Feb 1 15:58:29 CET 2001
On Thu, 1 Feb 2001, Wilfried Woeber, UniVie/ACOnet wrote:
> >Do you have an idea, why i can't use rpsl.ripe.net with RtConfig ?
>
> I seem to remember a bug report on some (minor?) problems with RaToolSet
> and the new v3 code. NCC was/is applying a path to RaToolSet, I think.
First, make sure you're specifying the Bird protocol (it's the closest
to the RIPE protocol). As soon as RIPE begins maintenance of the
RAToolSet we'll add the RIPE protocol specifically. :)
Second, you'll need to modify the sources somewhat. If you look in the
file src/irr/birdwhoisc.cc you need to add the following function:
// remove RIPE-style comments
static void stripRipeComments(Buffer &buf)
{
// remove leading '\n' characters, if any
while ((buf.getSize() > 0) && ((buf.getContents())[0] == '\n')) {
buf.flush(1);
}
// remove comments at beginning of buffer
while ((buf.getSize() >= 2) && ((buf.getContents())[0] == '%')) {
char *contents = buf.getContents();
char *eol = (char *)memchr(contents, '\n', buf.getSize());
if (eol == NULL) {
// no EOL, no comment to strip (yet)
return;
}
buf.flush(eol-contents+1);
}
}
This stips comments that begin with '%', which are RIPE-specific. This
needs to be called from the method BirdWhoisClient::getResponse().
You'll see the following line:
} while (!found);
Change this to:
stripRipeComments(*response);
} while (!found);
Finally, you need to handle the case where no output except for comments
are returned. Change the lines:
if (found)
break;
To be:
if ((response->size == 2) &&
(response->contents[0] == '\n') && (response->contents[1] == '\n'))
{
found = true;
}
if (found)
break;
Compile, install, and you should be able to produce router configs. If
necessary, I can send the entire file to somebody who doesn't feel
comfortable with editing the code by hand.
--
Shane