summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y15
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++;