summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-03-05 11:07:48 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-03-05 11:07:48 +0000
commit2ceb6388cee5686046ca641a4107c7045cfef44d (patch)
tree4f1a7587e3221811b6095ecbecde7627bd879b38 /usr.sbin/bgpctl
parentbd3e8e4f42af7a52235a65648af3383da145dee5 (diff)
store a maxlen with each prefix. if that is set, this prefix covers
multiple route objects (i. e. is the result of maksing out longer prefixes or aggregation we'll do later). if maxlen is > prefixlen, generate rules accordingly (prefixlen <= maxlen)
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/irr_output.c11
-rw-r--r--usr.sbin/bgpctl/irrfilter.h3
2 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/bgpctl/irr_output.c b/usr.sbin/bgpctl/irr_output.c
index 5a90e8c6646..8e32c4810b6 100644
--- a/usr.sbin/bgpctl/irr_output.c
+++ b/usr.sbin/bgpctl/irr_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: irr_output.c,v 1.10 2007/03/05 10:10:40 henning Exp $ */
+/* $OpenBSD: irr_output.c,v 1.11 2007/03/05 11:07:47 henning Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
@@ -202,7 +202,7 @@ print_rule(FILE *fh, struct policy_item *pi, char *sourceas,
char *action = "";
char *dir;
char *srcas[2] = { "", "" };
- char pbuf[8 + NI_MAXHOST + 4];
+ char pbuf[8 + NI_MAXHOST + 4 + 14 + 3];
size_t offset;
if (pi->dir == IMPORT)
@@ -228,6 +228,13 @@ print_rule(FILE *fh, struct policy_item *pi, char *sourceas,
"/%u", prefix->len) == -1)
err(1, "print_rule snprintf");
+ if (prefix->maxlen > prefix->len) {
+ offset = strlen(pbuf);
+ if (snprintf(pbuf + offset, sizeof(pbuf) - offset,
+ " prefixlen <= %u", prefix->maxlen) == -1)
+ err(1, "print_rule snprintf");
+ }
+
if (pi->dir == IMPORT) {
srcas[0] = " source-as ";
srcas[1] = sourceas;
diff --git a/usr.sbin/bgpctl/irrfilter.h b/usr.sbin/bgpctl/irrfilter.h
index 386953fea7c..8c00626b180 100644
--- a/usr.sbin/bgpctl/irrfilter.h
+++ b/usr.sbin/bgpctl/irrfilter.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: irrfilter.h,v 1.4 2007/03/04 20:31:22 henning Exp $ */
+/* $OpenBSD: irrfilter.h,v 1.5 2007/03/05 11:07:47 henning Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
@@ -74,6 +74,7 @@ struct irr_prefix {
} addr;
sa_family_t af;
u_int8_t len;
+ u_int8_t maxlen;
};
struct prefix_set {