From: claudio Date: Sat, 7 Aug 2010 17:59:02 +0000 (+0000) Subject: Fix carp demotion on tables. For some reason the default values were X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0db66ba9ac3e56bc60c475fbbb3738c064234bef;p=openbsd Fix carp demotion on tables. For some reason the default values were inherited from the table definition even though these values could not be changed there. While there fix a memory leak in a rather strange case. OK phessler, jsg, pyr, sthen, deraadt --- diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 3f235081565..023bea5a37e 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.145 2010/08/03 18:42:41 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.146 2010/08/07 17:59:02 claudio Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter @@ -2610,8 +2610,10 @@ table_inherit(struct table *tb) return (NULL); } (void)strlcpy(tb->conf.name, pname, sizeof(tb->conf.name)); - if ((oldtb = table_findbyconf(conf, tb)) != NULL) + if ((oldtb = table_findbyconf(conf, tb)) != NULL) { + purge_table(NULL, tb); return (oldtb); + } /* Create a new table */ tb->conf.id = ++last_table_id; @@ -2624,9 +2626,6 @@ table_inherit(struct table *tb) /* Inherit global table options */ bcopy(&dsttb->conf.timeout, &tb->conf.timeout, sizeof(struct timeval)); - tb->conf.skip_cnt = dsttb->conf.skip_cnt; - strlcpy(tb->conf.demote_group, dsttb->conf.demote_group, - sizeof(tb->conf.demote_group)); /* Copy the associated hosts */ TAILQ_INIT(&tb->hosts);