mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 07:23:41 +00:00
bgpd: fix bgp_get_bound_name to handle views better
The vrf socket code needs a interface/vrf name to be passed in, in order for it to properly bind to the correct vrf. In the case where bgp is using a view based instance the bgp_get_bound_name should handle views better and not return anything to be bound to. Fixes #9519. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
e7682ccd1b
commit
7224dcd86a
@ -611,8 +611,6 @@ static int bgp_accept(struct thread *thread)
|
|||||||
/* BGP socket bind. */
|
/* BGP socket bind. */
|
||||||
static char *bgp_get_bound_name(struct peer *peer)
|
static char *bgp_get_bound_name(struct peer *peer)
|
||||||
{
|
{
|
||||||
char *name = NULL;
|
|
||||||
|
|
||||||
if (!peer)
|
if (!peer)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -628,14 +626,16 @@ static char *bgp_get_bound_name(struct peer *peer)
|
|||||||
* takes precedence over VRF. For IPv4 peering, explicit interface or
|
* takes precedence over VRF. For IPv4 peering, explicit interface or
|
||||||
* VRF are the situations to bind.
|
* VRF are the situations to bind.
|
||||||
*/
|
*/
|
||||||
if (peer->su.sa.sa_family == AF_INET6)
|
if (peer->su.sa.sa_family == AF_INET6 && peer->conf_if)
|
||||||
name = (peer->conf_if ? peer->conf_if
|
return peer->conf_if;
|
||||||
: (peer->ifname ? peer->ifname
|
|
||||||
: peer->bgp->name));
|
|
||||||
else
|
|
||||||
name = peer->ifname ? peer->ifname : peer->bgp->name;
|
|
||||||
|
|
||||||
return name;
|
if (peer->ifname)
|
||||||
|
return peer->ifname;
|
||||||
|
|
||||||
|
if (peer->bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return peer->bgp->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bgp_update_address(struct interface *ifp, const union sockunion *dst,
|
static int bgp_update_address(struct interface *ifp, const union sockunion *dst,
|
||||||
|
Loading…
Reference in New Issue
Block a user