diff options
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/ensure.h | 32 | ||||
-rw-r--r-- | usr.sbin/bgpd/log.c | 13 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 20 |
4 files changed, 9 insertions, 59 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 4c046676b65..1b2e05bd62d 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.185 2006/01/05 16:00:07 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.186 2006/01/05 17:33:39 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -687,7 +687,6 @@ void log_info(const char *, ...); void log_debug(const char *, ...); void fatal(const char *); void fatalx(const char *); -void fatal_ensure(const char *, int, const char *); /* parse.y */ int cmdline_symset(char *); diff --git a/usr.sbin/bgpd/ensure.h b/usr.sbin/bgpd/ensure.h deleted file mode 100644 index 8ccf511a9ba..00000000000 --- a/usr.sbin/bgpd/ensure.h +++ /dev/null @@ -1,32 +0,0 @@ -/* $OpenBSD: ensure.h,v 1.3 2004/01/06 10:51:14 claudio Exp $ */ - -/* - * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __ENSURE_H__ -#define __ENSURE_H__ - -#include "bgpd.h" - -#define CHECK_ENSURE 1 - -#if CHECK_ENSURE != 0 -#define ENSURE(cond) \ - ((void) ((cond) || (fatal_ensure(__FILE__, __LINE__, #cond), 0))) -#else -#define ENSURE(cond) -#endif - -#endif diff --git a/usr.sbin/bgpd/log.c b/usr.sbin/bgpd/log.c index 1cea36f0598..e1236a5e9a5 100644 --- a/usr.sbin/bgpd/log.c +++ b/usr.sbin/bgpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.47 2006/01/03 22:19:59 claudio Exp $ */ +/* $OpenBSD: log.c,v 1.48 2006/01/05 17:33:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -229,17 +229,6 @@ fatalx(const char *emsg) } void -fatal_ensure(const char *file, int line, const char *cond) -{ - logit(LOG_CRIT, "ENSURE (%s) failed in file %s on line %d", - cond, file, line); - - /* XXX check which process we are and notify others! */ - sleep(10); - _exit(1); -} - -void log_statechange(struct peer *peer, enum session_state nstate, enum session_events event) { diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 7c371d372de..56fd55f55ed 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.74 2006/01/05 16:00:07 claudio Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.75 2006/01/05 17:33:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -24,7 +24,6 @@ #include <string.h> #include "bgpd.h" -#include "ensure.h" #include "rde.h" /* @@ -207,8 +206,8 @@ void path_destroy(struct rde_aspath *asp) { /* path_destroy can only unlink and free empty rde_aspath */ - ENSURE(path_empty(asp)); - ENSURE(asp->prefix_cnt == 0 && asp->active_cnt == 0); + if (asp->prefix_cnt == 0 && asp->active_cnt == 0) + log_warnx("path_destroy: prefix count out of sync"); nexthop_unlink(asp); LIST_REMOVE(asp, path_l); @@ -414,7 +413,8 @@ prefix_move(struct rde_aspath *asp, struct prefix *p) struct prefix *np; struct rde_aspath *oasp; - ENSURE(asp->peer == p->aspath->peer); + if (asp->peer != p->aspath->peer) + fatalx("prefix_move: cross peer move"); /* create new prefix node */ np = prefix_alloc(); @@ -522,9 +522,9 @@ prefix_bypeer(struct pt_entry *pte, struct rde_peer *peer) LIST_FOREACH(p, &pte->prefix_h, prefix_l) { if (p->aspath->peer == peer) - return p; + return (p); } - return NULL; + return (NULL); } void @@ -601,10 +601,6 @@ prefix_network_clean(struct rde_peer *peer, time_t reloadtime) static void prefix_link(struct prefix *pref, struct pt_entry *pte, struct rde_aspath *asp) { - ENSURE(pref->aspath == NULL && - pref->prefix == NULL); - ENSURE(prefix_bypeer(pte, asp->peer) == NULL); - LIST_INSERT_HEAD(&asp->prefix_h, pref, path_l); asp->prefix_cnt++; asp->peer->prefix_cnt++; @@ -658,8 +654,6 @@ prefix_alloc(void) static void prefix_free(struct prefix *pref) { - ENSURE(pref->aspath == NULL && - pref->prefix == NULL); rdemem.prefix_cnt--; free(pref); } |