mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 17:13:46 +00:00
Merge pull request #9538 from donaldsharp/bgp_view_not_working
Bgp view not working
This commit is contained in:
commit
3cb67fef98
@ -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,
|
||||||
@ -706,7 +706,8 @@ int bgp_connect(struct peer *peer)
|
|||||||
ifindex_t ifindex = 0;
|
ifindex_t ifindex = 0;
|
||||||
|
|
||||||
if (peer->conf_if && BGP_PEER_SU_UNSPEC(peer)) {
|
if (peer->conf_if && BGP_PEER_SU_UNSPEC(peer)) {
|
||||||
zlog_debug("Peer address not learnt: Returning from connect");
|
if (bgp_debug_neighbor_events(peer))
|
||||||
|
zlog_debug("Peer address not learnt: Returning from connect");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
frr_with_privs(&bgpd_privs) {
|
frr_with_privs(&bgpd_privs) {
|
||||||
@ -714,8 +715,13 @@ int bgp_connect(struct peer *peer)
|
|||||||
peer->fd = vrf_sockunion_socket(&peer->su, peer->bgp->vrf_id,
|
peer->fd = vrf_sockunion_socket(&peer->su, peer->bgp->vrf_id,
|
||||||
bgp_get_bound_name(peer));
|
bgp_get_bound_name(peer));
|
||||||
}
|
}
|
||||||
if (peer->fd < 0)
|
if (peer->fd < 0) {
|
||||||
|
if (bgp_debug_neighbor_events(peer))
|
||||||
|
zlog_debug("%s: Failure to create socket for connection to %s, error received: %s(%d)",
|
||||||
|
__func__, peer->host, safe_strerror(errno),
|
||||||
|
errno);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
set_nonblocking(peer->fd);
|
set_nonblocking(peer->fd);
|
||||||
|
|
||||||
@ -725,8 +731,13 @@ int bgp_connect(struct peer *peer)
|
|||||||
|
|
||||||
bgp_socket_set_buffer_size(peer->fd);
|
bgp_socket_set_buffer_size(peer->fd);
|
||||||
|
|
||||||
if (bgp_set_socket_ttl(peer, peer->fd) < 0)
|
if (bgp_set_socket_ttl(peer, peer->fd) < 0) {
|
||||||
|
if (bgp_debug_neighbor_events(peer))
|
||||||
|
zlog_debug("%s: Failure to set socket ttl for connection to %s, error received: %s(%d)",
|
||||||
|
__func__, peer->host, safe_strerror(errno),
|
||||||
|
errno);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
sockopt_reuseaddr(peer->fd);
|
sockopt_reuseaddr(peer->fd);
|
||||||
sockopt_reuseport(peer->fd);
|
sockopt_reuseport(peer->fd);
|
||||||
|
17
bgpd/bgpd.c
17
bgpd/bgpd.c
@ -3409,8 +3409,21 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
bgp = bgp_create(as, name, inst_type);
|
bgp = bgp_create(as, name, inst_type);
|
||||||
if (bgp_option_check(BGP_OPT_NO_ZEBRA) && name)
|
|
||||||
bgp->vrf_id = vrf_generate_id();
|
/*
|
||||||
|
* view instances will never work inside of a vrf
|
||||||
|
* as such they must always be in the VRF_DEFAULT
|
||||||
|
* Also we must set this to something useful because
|
||||||
|
* of the vrf socket code needing an actual useful
|
||||||
|
* default value to send to the underlying OS.
|
||||||
|
*
|
||||||
|
* This code is currently ignoring vrf based
|
||||||
|
* code using the -Z option( and that is probably
|
||||||
|
* best addressed elsewhere in the code )
|
||||||
|
*/
|
||||||
|
if (inst_type == BGP_INSTANCE_TYPE_VIEW)
|
||||||
|
bgp->vrf_id = VRF_DEFAULT;
|
||||||
|
|
||||||
bgp_router_id_set(bgp, &bgp->router_id_zebra, true);
|
bgp_router_id_set(bgp, &bgp->router_id_zebra, true);
|
||||||
bgp_address_init(bgp);
|
bgp_address_init(bgp);
|
||||||
bgp_tip_hash_init(bgp);
|
bgp_tip_hash_init(bgp);
|
||||||
|
@ -1068,13 +1068,6 @@ int vrf_sockunion_socket(const union sockunion *su, vrf_id_t vrf_id,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
vrf_id_t vrf_generate_id(void)
|
|
||||||
{
|
|
||||||
static int vrf_id_local;
|
|
||||||
|
|
||||||
return ++vrf_id_local;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------- Northbound callbacks ------- */
|
/* ------- Northbound callbacks ------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -323,7 +323,6 @@ extern int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf,
|
|||||||
extern void vrf_disable(struct vrf *vrf);
|
extern void vrf_disable(struct vrf *vrf);
|
||||||
extern int vrf_enable(struct vrf *vrf);
|
extern int vrf_enable(struct vrf *vrf);
|
||||||
extern void vrf_delete(struct vrf *vrf);
|
extern void vrf_delete(struct vrf *vrf);
|
||||||
extern vrf_id_t vrf_generate_id(void);
|
|
||||||
|
|
||||||
extern const struct frr_yang_module_info frr_vrf_info;
|
extern const struct frr_yang_module_info frr_vrf_info;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user