summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/bgpctl.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-03-03 11:45:31 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-03-03 11:45:31 +0000
commitdc779fa437a559de7417c6ea1f86bb1311bf5485 (patch)
tree3560734cef80f5e4eb4379199fc54e5170bb7d1c /usr.sbin/bgpctl/bgpctl.c
parent4099dde713a48bd641ab9efc20045f56a166994f (diff)
add irrfilter mode.
generates bgpd filter rules from the Internet Routing Registry aka IRR aka the aut-num, as-set and route objects in the RIPE, ARIN, APNIC ... databases accessed via whois, using the Routing Policy Specificaion Language RPSL. implement the whois query interface, an RPSL parser (of course only the parts we need), recursive as-set resolver, prefixes per AS lookup, and an ouput module to make up the rules. work in progress, not ready for general consumption yet. import agreed by theo & claudio
Diffstat (limited to 'usr.sbin/bgpctl/bgpctl.c')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index adfb300fc51..768c4e680d8 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.115 2007/02/22 08:38:19 henning Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.116 2007/03/03 11:45:30 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -36,6 +36,7 @@
#include "rde.h"
#include "log.h"
#include "parser.h"
+#include "irrfilter.h"
enum neighbor_views {
NV_DEFAULT,
@@ -102,10 +103,11 @@ main(int argc, char *argv[])
struct parse_result *res;
struct ctl_neighbor neighbor;
struct ctl_show_rib_request ribreq;
- char *sockname;
+ char *sockname, *outdir;
enum imsg_type type;
sockname = SOCKET_NAME;
+ outdir = getcwd(NULL, 0);
while ((ch = getopt(argc, argv, "ns:")) != -1) {
switch (ch) {
case 'n':
@@ -126,6 +128,9 @@ main(int argc, char *argv[])
if ((res = parse(argc, argv)) == NULL)
exit(1);
+ if (res->action == IRRFILTER)
+ irr_main(res->as.as, res->flags, outdir);
+
memcpy(&neighbor.addr, &res->peeraddr, sizeof(neighbor.addr));
strlcpy(neighbor.descr, res->peerdesc, sizeof(neighbor.descr));
@@ -147,6 +152,7 @@ main(int argc, char *argv[])
switch (res->action) {
case NONE:
+ case IRRFILTER:
usage();
/* not reached */
case SHOW:
@@ -352,6 +358,7 @@ main(int argc, char *argv[])
case NETWORK_ADD:
case NETWORK_REMOVE:
case NETWORK_FLUSH:
+ case IRRFILTER:
break;
}
imsg_free(&imsg);