peer1->host);
peer = peer_create(&su, peer1->conf_if, peer1->bgp, peer1->local_as,
- peer1->as, peer1->as_type, NULL);
+ peer1->as, peer1->as_type, NULL, false);
peer_xfer_config(peer, peer1);
bgp_peer_gr_flags_update(peer);
}
}
- UNSET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE);
-
peer->doppelganger = peer1;
peer1->doppelganger = peer;
peer->fd = bgp_sock;
{
const struct peer *peer1 = p1;
const struct peer *peer2 = p2;
+
return (sockunion_same(&peer1->su, &peer2->su)
&& CHECK_FLAG(peer1->flags, PEER_FLAG_CONFIG_NODE)
== CHECK_FLAG(peer2->flags, PEER_FLAG_CONFIG_NODE));
*/
struct peer *peer_create(union sockunion *su, const char *conf_if,
struct bgp *bgp, as_t local_as, as_t remote_as,
- int as_type, struct peer_group *group)
+ int as_type, struct peer_group *group,
+ bool config_node)
{
int active;
struct peer *peer;
peer = peer_lock(peer); /* bgp peer list reference */
peer->group = group;
listnode_add_sort(bgp->peer, peer);
+
+ if (config_node)
+ SET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE);
+
(void)hash_get(bgp->peerhash, peer, hash_alloc_intern);
/* Adjust update-group coalesce timer heuristics for # peers. */
/* Default configured keepalives count for shutdown rtt command */
peer->rtt_keepalive_conf = 1;
- SET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE);
-
/* If 'bgp default <afi>-<safi>' is configured, then activate the
* neighbor for the corresponding address family. IPv4 Unicast is
* the only address family enabled by default without expliict
else
local_as = bgp->as;
- peer_create(su, conf_if, bgp, local_as, *as, as_type, NULL);
+ peer_create(su, conf_if, bgp, local_as, *as, as_type, NULL,
+ true);
}
return 0;
}
peer = peer_create(su, NULL, bgp, bgp->as, group->conf->as,
- group->conf->as_type, group);
+ group->conf->as_type, group, true);
peer = peer_lock(peer); /* group->peer list reference */
listnode_add(group->peer, peer);
peer_deactivate(peer, afi, safi);
}
- SET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE);
-
/* Set up peer's events and timers. */
if (peer_active(peer))
bgp_timer_set(peer);
/* Create peer first; we've already checked group config is valid. */
peer = peer_create(su, NULL, bgp, bgp->as, group->conf->as,
- group->conf->as_type, group);
+ group->conf->as_type, group, true);
if (!peer)
return NULL;
/* Mark as dynamic, but also as a "config node" for other things to
* work. */
SET_FLAG(peer->flags, PEER_FLAG_DYNAMIC_NEIGHBOR);
- SET_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE);
return peer;
}
extern bool peer_afc_received(struct peer *peer);
extern bool peer_afc_advertised(struct peer *peer);
extern void bgp_recalculate_all_bestpaths(struct bgp *bgp);
-extern struct peer *peer_create(union sockunion *, const char *, struct bgp *,
- as_t, as_t, int, struct peer_group *);
+extern struct peer *peer_create(union sockunion *su, const char *conf_if,
+ struct bgp *bgp, as_t local_as, as_t remote_as,
+ int as_type, struct peer_group *group,
+ bool config_node);
extern struct peer *peer_create_accept(struct bgp *);
extern void peer_xfer_config(struct peer *dst, struct peer *src);
extern char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,