mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 11:18:52 +00:00
bgpd: Do not use an existing peer pointer for ALL_LIST_ELEMENTS()
Use a separate `member` in this case. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
1dcb4bb2d3
commit
6e92e25518
48
bgpd/bgpd.c
48
bgpd/bgpd.c
@ -5394,7 +5394,7 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
|
|||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
struct peer *peer1;
|
struct peer *member;
|
||||||
|
|
||||||
if (peer->sort == BGP_PEER_IBGP || peer->conf_if)
|
if (peer->sort == BGP_PEER_IBGP || peer->conf_if)
|
||||||
return 0;
|
return 0;
|
||||||
@ -5410,12 +5410,11 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
|
|||||||
if (group->conf->gtsm_hops != BGP_GTSM_HOPS_DISABLED)
|
if (group->conf->gtsm_hops != BGP_GTSM_HOPS_DISABLED)
|
||||||
return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK;
|
return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(group->peer, node, nnode,
|
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, member)) {
|
||||||
peer1)) {
|
if (member->sort == BGP_PEER_IBGP)
|
||||||
if (peer1->sort == BGP_PEER_IBGP)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (peer1->gtsm_hops != BGP_GTSM_HOPS_DISABLED)
|
if (member->gtsm_hops != BGP_GTSM_HOPS_DISABLED)
|
||||||
return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK;
|
return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -5442,23 +5441,21 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
group = peer->group;
|
group = peer->group;
|
||||||
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) {
|
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, member)) {
|
||||||
if (peer->sort == BGP_PEER_IBGP)
|
if (member->sort == BGP_PEER_IBGP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
peer->ttl = group->conf->ttl;
|
member->ttl = group->conf->ttl;
|
||||||
|
|
||||||
if (BGP_IS_VALID_STATE_FOR_NOTIF(
|
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
|
||||||
peer->connection->status))
|
bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
|
||||||
bgp_notify_send(peer->connection,
|
|
||||||
BGP_NOTIFY_CEASE,
|
|
||||||
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
|
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
|
||||||
else
|
else
|
||||||
bgp_session_reset(peer);
|
bgp_session_reset(member);
|
||||||
|
|
||||||
/* Reconfigure BFD peer with new TTL. */
|
/* Reconfigure BFD peer with new TTL. */
|
||||||
if (peer->bfd_config)
|
if (member->bfd_config)
|
||||||
bgp_peer_bfd_update_source(peer);
|
bgp_peer_bfd_update_source(member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -5466,6 +5463,7 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
|
|||||||
|
|
||||||
int peer_ebgp_multihop_unset(struct peer *peer)
|
int peer_ebgp_multihop_unset(struct peer *peer)
|
||||||
{
|
{
|
||||||
|
struct peer *member;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
int ttl;
|
int ttl;
|
||||||
@ -5498,25 +5496,23 @@ int peer_ebgp_multihop_unset(struct peer *peer)
|
|||||||
bgp_peer_bfd_update_source(peer);
|
bgp_peer_bfd_update_source(peer);
|
||||||
} else {
|
} else {
|
||||||
group = peer->group;
|
group = peer->group;
|
||||||
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) {
|
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, member)) {
|
||||||
if (peer->sort == BGP_PEER_IBGP)
|
if (member->sort == BGP_PEER_IBGP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
peer->ttl = BGP_DEFAULT_TTL;
|
member->ttl = BGP_DEFAULT_TTL;
|
||||||
|
|
||||||
if (peer->connection->fd >= 0) {
|
if (member->connection->fd >= 0) {
|
||||||
if (BGP_IS_VALID_STATE_FOR_NOTIF(
|
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
|
||||||
peer->connection->status))
|
bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
|
||||||
bgp_notify_send(peer->connection,
|
|
||||||
BGP_NOTIFY_CEASE,
|
|
||||||
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
|
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
|
||||||
else
|
else
|
||||||
bgp_session_reset(peer);
|
bgp_session_reset(member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reconfigure BFD peer with new TTL. */
|
/* Reconfigure BFD peer with new TTL. */
|
||||||
if (peer->bfd_config)
|
if (member->bfd_config)
|
||||||
bgp_peer_bfd_update_source(peer);
|
bgp_peer_bfd_update_source(member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user