summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/name2id.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-05-17 12:25:16 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-05-17 12:25:16 +0000
commitd0639da8e997204d85f43940c8f7fd5363f5353b (patch)
treed1034cbc5d45af05eb70883725729e0babb01437 /usr.sbin/bgpd/name2id.c
parenta0ffb8889701c4cf39c676b95379748401b916b9 (diff)
Rework most of the RDE to allow multiple RIBs. This is mostly preparation
work by changing the way the RDE DB is built. struct prefix and struct pt_entry are simplified and extended with a rib_entry where the decision tree is run on. From now on a prefix can only reside on one particular RIB which simplifies the code a bit. Currently there are two fixed ribs (adj-rib-in and the local-rib) which needs to be made more dynamic in upcomming commits. This is work in progress, the RDE seems to work for me and sthen@ (no flames comming out of our testrouters but there is still a lot missing) Move into the tree to simplify developement -- henning@
Diffstat (limited to 'usr.sbin/bgpd/name2id.c')
-rw-r--r--usr.sbin/bgpd/name2id.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/name2id.c b/usr.sbin/bgpd/name2id.c
index a6c09640b7c..9e8774fd628 100644
--- a/usr.sbin/bgpd/name2id.c
+++ b/usr.sbin/bgpd/name2id.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: name2id.c,v 1.7 2006/05/02 14:41:26 claudio Exp $ */
+/* $OpenBSD: name2id.c,v 1.8 2009/05/17 12:25:15 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -43,10 +43,35 @@ const char *_id2name(struct n2id_labels *, u_int16_t);
void _unref(struct n2id_labels *, u_int16_t);
void _ref(struct n2id_labels *, u_int16_t);
+struct n2id_labels rib_labels = TAILQ_HEAD_INITIALIZER(rib_labels);
struct n2id_labels rt_labels = TAILQ_HEAD_INITIALIZER(rt_labels);
struct n2id_labels pftable_labels = TAILQ_HEAD_INITIALIZER(pftable_labels);
u_int16_t
+rib_name2id(const char *name)
+{
+ return (_name2id(&rib_labels, name));
+}
+
+const char *
+rib_id2name(u_int16_t id)
+{
+ return (_id2name(&rib_labels, id));
+}
+
+void
+rib_unref(u_int16_t id)
+{
+ _unref(&rib_labels, id);
+}
+
+void
+rib_ref(u_int16_t id)
+{
+ _ref(&rib_labels, id);
+}
+
+u_int16_t
rtlabel_name2id(const char *name)
{
return (_name2id(&rt_labels, name));