summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_vty.c3
-rw-r--r--bgpd/bgpd.c8
-rw-r--r--bgpd/bgpd.h3
-rwxr-xr-xconfigure.ac2
4 files changed, 14 insertions, 2 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index d99638b2..222e4485 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -219,6 +219,9 @@ bgp_vty_return (struct vty *vty, int ret)
case BGP_ERR_TCPSIG_FAILED:
str = "Error while applying TCP-Sig to session(s)";
break;
+ case BGP_ERR_PEER_EXISTS:
+ str = "Cannot have the same neighbor in different bgp views";
+ break;
}
if (str)
{
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;
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 7a53c511..ee8efa1b 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -398,7 +398,8 @@ enum bgp_clear_type
#define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27
#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28
#define BGP_ERR_TCPSIG_FAILED -29
-#define BGP_ERR_MAX -30
+#define BGP_ERR_PEER_EXISTS -30
+#define BGP_ERR_MAX -31
extern struct bgp_master *bm;
diff --git a/configure.ac b/configure.ac
index b34c69ff..865e84ed 100755
--- a/configure.ac
+++ b/configure.ac
@@ -128,7 +128,7 @@ if test "x${cflags_specified}" = "x" ; then
CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
- CFLAGS="${CFLAGS} -pthread"
+ CFLAGS="${CFLAGS} -pthread -rdynamic"
# TODO: conditionally addd -Wpacked if handled
AC_MSG_RESULT([gcc default])
;;