summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgpd.c')
-rw-r--r--bgpd/bgpd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 30b882b6..f9e2ed93 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -761,6 +761,10 @@ peer_remote_as (struct bgp *bgp, union sockunion *su, as_t *as,
else
local_as = bgp->as;
+ /* Check that the neighbor IP is unique */
+ if (peer_lookup (NULL, su) != NULL)
+ return BGP_ERR_PEER_EXISTS ;
+
/* TODO: report bug... if is IPv4 unicast, may implicitly activate */
/* If this is IPv4 unicast configuration and "no bgp default
@@ -1340,6 +1344,10 @@ peer_group_bind (struct bgp *bgp, union sockunion *su,
if (! group->conf->as)
return BGP_ERR_PEER_GROUP_NO_REMOTE_AS;
+ /* Check that the neighbor IP is unique */
+ if (peer_lookup (NULL, su) != NULL)
+ return BGP_ERR_PEER_EXISTS ;
+
peer = bgp_peer_create (su, bgp, bgp->as, group->conf->as, afi, safi);
peer->group = group;
peer->af_group[afi][safi] = 1;