summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_rib.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-06-29 09:43:27 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-06-29 09:43:27 +0000
commit594757d5f959a472146827a74c37df70dae806f1 (patch)
treeb9f724ee6b9b82a70fa8e500966f6bd069c79992 /usr.sbin/bgpd/rde_rib.c
parent78885a9a4f071e782047df91843c9f08dfc7b24c (diff)
rtlabel support via filter sets. Just use "set rtlabel foobar" in filters
network and neighbor statements and the routes are labeled accordingly. While doing that fix some mem-leaks by introducing filterset_free() and remove the free on send option of send_filterset(). This took a bit longer because we need to carefully track the rtlabel id refcnts or bad things may happen on reloads. henning@ looks fine
Diffstat (limited to 'usr.sbin/bgpd/rde_rib.c')
-rw-r--r--usr.sbin/bgpd/rde_rib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index 6a47462580e..61b36d56792 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.66 2005/04/12 14:32:01 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.67 2005/06/29 09:43:26 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -132,6 +132,10 @@ path_compare(struct rde_aspath *a, struct rde_aspath *b)
return (1);
if (a->weight < b->weight)
return (-1);
+ if (a->rtlabelid > b->rtlabelid)
+ return (1);
+ if (a->rtlabelid < b->rtlabelid)
+ return (-1);
r = strcmp(a->pftable, b->pftable);
if (r == 0)
@@ -272,6 +276,8 @@ path_copy(struct rde_aspath *asp)
nasp->lpref = asp->lpref;
nasp->weight = asp->weight;
nasp->origin = asp->origin;
+ nasp->rtlabelid = asp->rtlabelid;
+ rtlabel_ref(nasp->rtlabelid);
nasp->flags = asp->flags & ~F_ATTR_LINKED;
@@ -296,6 +302,7 @@ path_get(void)
asp->lpref = DEFAULT_LPREF;
/* med = 0 */
/* weight = 0 */
+ /* rtlabel = 0 */
return (asp);
}
@@ -307,6 +314,7 @@ path_put(struct rde_aspath *asp)
if (asp->flags & F_ATTR_LINKED)
fatalx("path_put: linked object");
+ rtlabel_unref(asp->rtlabelid);
aspath_put(asp->aspath);
attr_optfree(asp);
free(asp);