diff --git a/.gitignore b/.gitignore index a66e3ccd3c6a..5f8edfff6d2c 100644 --- a/.gitignore +++ b/.gitignore @@ -117,3 +117,5 @@ refix /test-suite.log pceplib/test/*.log pceplib/test/*.trs +*.si4project* +*gitignore* diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index f322de76833f..2b9da0cb04fe 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -341,6 +341,7 @@ int bgp_tcp_mss_set(struct peer *peer) struct bgp_listener *listener; uint32_t min_mss = 0; struct peer *p; + struct peer_group *group; for (ALL_LIST_ELEMENTS_RO(peer->bgp->peer, node, p)) { if (!CHECK_FLAG(p->flags, PEER_FLAG_TCP_MSS)) @@ -355,6 +356,21 @@ int bgp_tcp_mss_set(struct peer *peer) min_mss = MIN(min_mss, p->tcp_mss); } + for (ALL_LIST_ELEMENTS_RO(peer->bgp->group, node, group)) { + p = group->conf; + if (!CHECK_FLAG(p->flags, PEER_FLAG_TCP_MSS)) + continue; + + if (!p->tcp_mss) + continue; + + if (!min_mss) + min_mss = p->tcp_mss; + + min_mss = MIN(min_mss, p->tcp_mss); + } + + frr_with_privs(&bgpd_privs) { for (ALL_LIST_ELEMENTS_RO(bm->listen_sockets, node, listener)) { if (listener->su.sa.sa_family != @@ -371,7 +387,7 @@ int bgp_tcp_mss_set(struct peer *peer) * one peer that is in passive mode. Otherwise, TCP MSS * is set per socket via bgp_connect(). */ - if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE)) + if (min_mss != 0) sockopt_tcp_mss_set(listener->fd, min_mss); break; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 585863954cc0..4b88c4e98077 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -5777,8 +5777,19 @@ void peer_port_unset(struct peer *peer) */ void peer_tcp_mss_set(struct peer *peer, uint32_t tcp_mss) { + struct listnode *node; + struct peer *p; + peer->tcp_mss = tcp_mss; SET_FLAG(peer->flags, PEER_FLAG_TCP_MSS); + + if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { + for (ALL_LIST_ELEMENTS_RO(peer->group->peer, node, p)) { + p->tcp_mss = tcp_mss; + SET_FLAG(p->flags, PEER_FLAG_TCP_MSS); + } + } + bgp_tcp_mss_set(peer); } @@ -5788,8 +5799,19 @@ void peer_tcp_mss_set(struct peer *peer, uint32_t tcp_mss) */ void peer_tcp_mss_unset(struct peer *peer) { + struct listnode *node; + struct peer *p; + UNSET_FLAG(peer->flags, PEER_FLAG_TCP_MSS); peer->tcp_mss = 0; + + if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { + for (ALL_LIST_ELEMENTS_RO(peer->group->peer, node, p)) { + UNSET_FLAG(p->flags, PEER_FLAG_TCP_MSS); + p->tcp_mss = 0; + } + } + bgp_tcp_mss_set(peer); }