diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-24 17:38:31 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-24 17:38:31 +0000 |
commit | 8f39a2f782dbc9d1e49e052a3e82a89c36c9534e (patch) | |
tree | 64e86bc260e65456280d83b365980313114dfb2f /usr.sbin/bgpd/config.c | |
parent | 2c99a1369256d038d06cb3342cf2b1567d87e26e (diff) |
we can use memcpy for the whole thing in merge_config now instead of
copying each and every thing on its own
yes, there was a reason to do it this way once, but it vanished
ok claudio@
Diffstat (limited to 'usr.sbin/bgpd/config.c')
-rw-r--r-- | usr.sbin/bgpd/config.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c index 56b0823d91a..380ee3cc3f9 100644 --- a/usr.sbin/bgpd/config.c +++ b/usr.sbin/bgpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.18 2004/01/22 20:34:55 henning Exp $ */ +/* $OpenBSD: config.c,v 1.19 2004/01/24 17:38:30 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -40,46 +40,25 @@ merge_config(struct bgpd_config *xconf, struct bgpd_config *conf, { struct peer *p; - /* merge conf (new) into xconf (old) */ if (!conf->as) { log_warnx("configuration error: AS not given"); return (1); } - if (xconf->as != conf->as) - xconf->as = conf->as; - if (conf->bgpid && xconf->bgpid != conf->bgpid) - xconf->bgpid = conf->bgpid; + if (!conf->min_holdtime) + conf->min_holdtime = MIN_HOLDTIME; - if (!xconf->bgpid) - xconf->bgpid = get_bgpid(); - - if (conf->holdtime && !xconf->holdtime) - xconf->holdtime = conf->holdtime; - if (!conf->holdtime && xconf->holdtime) - conf->holdtime = xconf->holdtime; - - if (conf->min_holdtime && !xconf->min_holdtime) - xconf->min_holdtime = conf->min_holdtime; - if (!conf->min_holdtime && xconf->min_holdtime) - conf->min_holdtime = xconf->min_holdtime; - if (!xconf->min_holdtime) - xconf->min_holdtime = conf->min_holdtime = MIN_HOLDTIME; - - memcpy(&xconf->listen_addr, &conf->listen_addr, - sizeof(xconf->listen_addr)); - - xconf->flags = conf->flags; - xconf->log = conf->log; - xconf->holdtime = conf->holdtime; - xconf->min_holdtime = conf->min_holdtime; + if (!conf->bgpid) + conf->bgpid = get_bgpid(); for (p = peer_l; p != NULL; p = p->next) { - p->conf.ebgp = (p->conf.remote_as != xconf->as); + p->conf.ebgp = (p->conf.remote_as != conf->as); if (!p->conf.id) p->conf.id = get_id(p); } + memcpy(xconf, conf, sizeof(struct bgpd_config)); + return (0); } |