summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-03-16 10:50:27 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-03-16 10:50:27 +0000
commit308a84ee4deeee2b37dee7a890585e0901f2fb22 (patch)
treeeb301a36cd1f83092ad2dd3a289153b28c855e42 /usr.sbin/bgpd/parse.y
parentdef4061f3e12c72aacf143145358c5a59bd68e40 (diff)
don't try to merge the freshly parsed config into the running one if
we had parser failures... debugging session with claudio and jason ackley ok claudio norby deraadt
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y24
1 files changed, 17 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 8e13288efcb..5fdff88575c 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.152 2005/03/14 17:32:04 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.153 2005/03/16 10:50:26 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1629,6 +1629,7 @@ parse_config(char *filename, struct bgpd_config *xconf,
{
struct sym *sym, *next;
struct peer *p, *pnext;
+ struct listen_addr *la;
if ((fin = fopen(filename, "r")) == NULL) {
warn("%s", filename);
@@ -1681,13 +1682,22 @@ parse_config(char *filename, struct bgpd_config *xconf,
}
}
- errors += merge_config(xconf, conf, peer_l, listen_addrs);
- errors += mrt_mergeconfig(xmconf, mrtconf);
- *xpeers = peer_l;
+ if (errors) {
+ /* XXX more leaks in this case? */
+ while ((la = TAILQ_FIRST(listen_addrs)) != NULL) {
+ TAILQ_REMOVE(listen_addrs, la, entry);
+ free(la);
+ }
+ free(listen_addrs);
+ } else {
+ errors += merge_config(xconf, conf, peer_l, listen_addrs);
+ errors += mrt_mergeconfig(xmconf, mrtconf);
+ *xpeers = peer_l;
- for (p = peer_l_old; p != NULL; p = pnext) {
- pnext = p->next;
- free(p);
+ for (p = peer_l_old; p != NULL; p = pnext) {
+ pnext = p->next;
+ free(p);
+ }
}
free(conf);