diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2007-03-05 11:07:48 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2007-03-05 11:07:48 +0000 |
commit | 2ceb6388cee5686046ca641a4107c7045cfef44d (patch) | |
tree | 4f1a7587e3221811b6095ecbecde7627bd879b38 /usr.sbin/bgpctl/irr_output.c | |
parent | bd3e8e4f42af7a52235a65648af3383da145dee5 (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/irr_output.c')
-rw-r--r-- | usr.sbin/bgpctl/irr_output.c | 11 |
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; |