diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-03-07 19:47:04 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-03-07 19:47:04 +0000 |
commit | ff97539871b6ded465cd91d6e8089b569177d28d (patch) | |
tree | 68aa6bda69b169d6d114cb7b2913e108009c5ed5 /usr.sbin | |
parent | 9aeb6657aa4e3221af6268cee826d51259d02a8d (diff) |
Fix a bug reported by Xavier Beaudouin. On config reloads set parameters
inside group blocks were reset to default values. The problem was that
group ids changed on reload as soon as a new peer was added to one group.
Make sure that group ids remain the same over reloads a similar thing is
already done for peer ids. ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 5bf2242fc6f..4bf94d4acd8 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.182 2006/03/04 19:33:22 miod Exp $ */ +/* $OpenBSD: parse.y,v 1.183 2006/03/07 19:47:03 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2200,18 +2200,25 @@ get_id(struct peer *newpeer) { struct peer *p; - if (newpeer->conf.remote_addr.af) - for (p = peer_l_old; p != NULL; p = p->next) + for (p = peer_l_old; p != NULL; p = p->next) + if (newpeer->conf.remote_addr.af) { if (!memcmp(&p->conf.remote_addr, &newpeer->conf.remote_addr, sizeof(p->conf.remote_addr))) { newpeer->conf.id = p->conf.id; return (0); } + } else { /* newpeer is a group */ + if (strcmp(newpeer->conf.group, p->conf.group) == 0) { + newpeer->conf.id = p->conf.groupid; + return (0); + } + } /* new one */ for (; id < UINT_MAX / 2; id++) { - for (p = peer_l_old; p != NULL && p->conf.id != id; p = p->next) + for (p = peer_l_old; p != NULL && + p->conf.id != id && p->conf.groupid != id; p = p->next) ; /* nothing */ if (p == NULL) { /* we found a free id */ newpeer->conf.id = id++; |