diff options
Diffstat (limited to 'usr.sbin/bgpd/rde_rib.c')
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 761db5db985..b3b6bdab6dd 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.113 2009/06/04 04:46:42 claudio Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.114 2009/06/04 21:53:43 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -62,6 +62,9 @@ rib_new(int id, char *name, u_int16_t flags) } } + if (id == RIB_FAILED) + fatalx("rib_new: trying to use reserved id"); + if (id >= rib_size) { newsize = sizeof(struct rib) * (id + 1); if ((xribs = realloc(ribs, newsize)) == NULL) { @@ -82,6 +85,22 @@ rib_new(int id, char *name, u_int16_t flags) return (id); } +u_int16_t +rib_find(char *name) +{ + u_int16_t id; + + if (name == NULL || *name == '\0') + return (1); /* XXX */ + + for (id = 0; id < rib_size; id++) { + if (!strcmp(ribs[id].name, name)) + return (id); + } + + return (RIB_FAILED); +} + void rib_free(struct rib *rib) { |