summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-12-12 16:05:31 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-12-12 16:05:31 +0000
commit1f8330eb95cb49b2fc82d993234e1cbe29827e0a (patch)
tree77cd91b900a143d152552cbf59582c72c3fb88e7 /usr.sbin
parentaf6489ddb740cd0bd27092d5b9ef8fea60d5822d (diff)
Correctly set the partial bit on the AS4_PATH and AS4_AGGREGATOR attribute.
Per RFC4271 the partial bit must be set if the attribute was not generated on the originating router. This is mostly cosmetics. OK sthen@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/rde_update.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c
index b51f38ac085..ecc619c38b8 100644
--- a/usr.sbin/bgpd/rde_update.c
+++ b/usr.sbin/bgpd/rde_update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_update.c,v 1.62 2008/11/01 19:56:27 claudio Exp $ */
+/* $OpenBSD: rde_update.c,v 1.63 2008/12/12 16:05:30 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -617,7 +617,7 @@ up_generate_attr(struct rde_peer *peer, struct update_attr *upa,
u_char *pdata;
u_int32_t tmp32;
in_addr_t nexthop;
- int r, ismp = 0, neednewpath = 0;
+ int flags, r, ismp = 0, neednewpath = 0;
u_int16_t len = sizeof(up_attr_buf), wlen = 0, plen;
u_int8_t l;
@@ -768,19 +768,23 @@ up_generate_attr(struct rde_peer *peer, struct update_attr *upa,
else
pdata = aspath_prepend(a->aspath, rde_local_as(), 1,
&plen);
+ flags = ATTR_OPTIONAL|ATTR_TRANSITIVE;
+ if (!(a->flags & F_PREFIX_ANNOUNCED))
+ flags |= ATTR_PARTIAL;
if (plen == 0)
r = 0;
- else if ((r = attr_write(up_attr_buf + wlen, len,
- ATTR_OPTIONAL|ATTR_TRANSITIVE, ATTR_NEW_ASPATH,
- pdata, plen)) == -1)
+ else if ((r = attr_write(up_attr_buf + wlen, len, flags,
+ ATTR_NEW_ASPATH, pdata, plen)) == -1)
return (-1);
wlen += r; len -= r;
free(pdata);
}
if (newaggr) {
- if ((r = attr_write(up_attr_buf + wlen, len,
- ATTR_OPTIONAL|ATTR_TRANSITIVE, ATTR_NEW_AGGREGATOR,
- newaggr->data, newaggr->len)) == -1)
+ flags = ATTR_OPTIONAL|ATTR_TRANSITIVE;
+ if (!(a->flags & F_PREFIX_ANNOUNCED))
+ flags |= ATTR_PARTIAL;
+ if ((r = attr_write(up_attr_buf + wlen, len, flags,
+ ATTR_NEW_AGGREGATOR, newaggr->data, newaggr->len)) == -1)
return (-1);
wlen += r; len -= r;
}