From: vivek Date: Mon, 28 Mar 2016 16:37:39 +0000 (-0700) Subject: BGP: Fix BGP unnumbered peerings across VRFs X-Git-Tag: frr-2.0-rc1~1032 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=83260f0093509c2ba9072d7e2c12dc919f465240;p=mirror%2Ffrr.git BGP: Fix BGP unnumbered peerings across VRFs Upon receipt of incoming connection, a peer structure (doppelganger) is created internally and the connection processed for it. The problem is that in the case of BGP unnumbered, the sockunion structure within BGP was being updated (in peer_create()) prior to the peer's flags being updated, so it didn't take into account the 'v6only' configuration. This results in subsequent problems when bgp_bind() is done - the socket ends up being bound to the BGP instance instead of the interface. In the case of an incoming connection, we should just use the addresses on which the connection was setup/accepted, there is no need to attempt to derive it again. Further, there is no need to attempt to update addresses at the time of peer_create() since that is done when the connection is attempted in bgp_start(). Signed-off-by: Vivek Venkatraman Reviewed-by: Don Slice Ticket: CM-10028 Reviewed By: CCR-4373 Testing Done: Manual, bgpsmoke --- diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index debb87a1fe..b02eabadca 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -409,6 +409,7 @@ bgp_accept (struct thread *thread) peer = peer_create (&su, peer1->conf_if, peer1->bgp, peer1->local_as, peer1->as, peer1->as_type, 0, 0); + peer->su = su; peer_xfer_config(peer, peer1); UNSET_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index aa470b73fd..478ec85651 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1389,7 +1389,6 @@ peer_create (union sockunion *su, const char *conf_if, struct bgp *bgp, if (conf_if) { peer->conf_if = XSTRDUP (MTYPE_PEER_CONF_IF, conf_if); - bgp_peer_conf_if_to_su_update(peer); if (peer->host) XFREE(MTYPE_BGP_PEER_HOST, peer->host); peer->host = XSTRDUP (MTYPE_BGP_PEER_HOST, conf_if);