summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl/irr_output.c
diff options
context:
space:
mode:
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;