mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 01:40:16 +00:00
bgpd: Allow peer-groups to have ttl-security hops
configured
The command `neighbor PGROUP ttl-security hops X` was being accepted but ignored. Allow it to be stored. I am still not sure that this is applied correctly, but that is another problem. Fixes: #7848 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
c780fef631
commit
4ec7a71a93
32
bgpd/bgpd.c
32
bgpd/bgpd.c
@ -7150,6 +7150,7 @@ int is_ebgp_multihop_configured(struct peer *peer)
|
|||||||
int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops)
|
int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops)
|
||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
struct peer *gpeer;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -7186,9 +7187,10 @@ int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops)
|
|||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
group = peer->group;
|
group = peer->group;
|
||||||
|
group->conf->gtsm_hops = gtsm_hops;
|
||||||
for (ALL_LIST_ELEMENTS(group->peer, node, nnode,
|
for (ALL_LIST_ELEMENTS(group->peer, node, nnode,
|
||||||
peer)) {
|
gpeer)) {
|
||||||
peer->gtsm_hops = group->conf->gtsm_hops;
|
gpeer->gtsm_hops = group->conf->gtsm_hops;
|
||||||
|
|
||||||
/* Calling ebgp multihop also resets the
|
/* Calling ebgp multihop also resets the
|
||||||
* session.
|
* session.
|
||||||
@ -7198,7 +7200,7 @@ int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops)
|
|||||||
* value is
|
* value is
|
||||||
* irrelevant.
|
* irrelevant.
|
||||||
*/
|
*/
|
||||||
peer_ebgp_multihop_set(peer, MAXTTL);
|
peer_ebgp_multihop_set(gpeer, MAXTTL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -7219,9 +7221,10 @@ int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops)
|
|||||||
MAXTTL + 1 - gtsm_hops);
|
MAXTTL + 1 - gtsm_hops);
|
||||||
} else {
|
} else {
|
||||||
group = peer->group;
|
group = peer->group;
|
||||||
|
group->conf->gtsm_hops = gtsm_hops;
|
||||||
for (ALL_LIST_ELEMENTS(group->peer, node, nnode,
|
for (ALL_LIST_ELEMENTS(group->peer, node, nnode,
|
||||||
peer)) {
|
gpeer)) {
|
||||||
peer->gtsm_hops = group->conf->gtsm_hops;
|
gpeer->gtsm_hops = group->conf->gtsm_hops;
|
||||||
|
|
||||||
/* Change setting of existing peer
|
/* Change setting of existing peer
|
||||||
* established then change value (may break
|
* established then change value (may break
|
||||||
@ -7231,17 +7234,18 @@ int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops)
|
|||||||
* no session then do nothing (will get
|
* no session then do nothing (will get
|
||||||
* handled by next connection)
|
* handled by next connection)
|
||||||
*/
|
*/
|
||||||
if (peer->fd >= 0
|
if (gpeer->fd >= 0
|
||||||
&& peer->gtsm_hops
|
&& gpeer->gtsm_hops
|
||||||
!= BGP_GTSM_HOPS_DISABLED)
|
!= BGP_GTSM_HOPS_DISABLED)
|
||||||
sockopt_minttl(
|
sockopt_minttl(
|
||||||
peer->su.sa.sa_family, peer->fd,
|
gpeer->su.sa.sa_family,
|
||||||
MAXTTL + 1 - peer->gtsm_hops);
|
gpeer->fd,
|
||||||
if ((peer->status < Established)
|
MAXTTL + 1 - gpeer->gtsm_hops);
|
||||||
&& peer->doppelganger
|
if ((gpeer->status < Established)
|
||||||
&& (peer->doppelganger->fd >= 0))
|
&& gpeer->doppelganger
|
||||||
sockopt_minttl(peer->su.sa.sa_family,
|
&& (gpeer->doppelganger->fd >= 0))
|
||||||
peer->doppelganger->fd,
|
sockopt_minttl(gpeer->su.sa.sa_family,
|
||||||
|
gpeer->doppelganger->fd,
|
||||||
MAXTTL + 1 - gtsm_hops);
|
MAXTTL + 1 - gtsm_hops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user