summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl/irr_output.c
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2007-03-05 11:07:47 +0000
committerhenning <henning@openbsd.org>2007-03-05 11:07:47 +0000
commit1d052bb99fc621c1085f97a69c6f4e98e0f848a8 (patch)
treec47fda726aecd6f225ccff846bfa55c9e4f92ddb /usr.sbin/bgpctl/irr_output.c
parentIf tty-timestamping is requested, but no PPS signal is present, output a (diff)
downloadwireguard-openbsd-1d052bb99fc621c1085f97a69c6f4e98e0f848a8.tar.xz
wireguard-openbsd-1d052bb99fc621c1085f97a69c6f4e98e0f848a8.zip
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/irr_output.c')
-rw-r--r--usr.sbin/bgpctl/irr_output.c11
1 files changed, 9 insertions, 2 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;