mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-25 22:01:08 +00:00
bgpd: add bgp ipv6-auto-ra
command
Introduce a command to stop bgpd from enabling IPv6 router advertisement messages sending on interfaces. Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
This commit is contained in:
parent
c12af9f2a7
commit
7b1c0c23fc
@ -652,11 +652,12 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
|
|||||||
* we receive from bgp. This is to allow us
|
* we receive from bgp. This is to allow us
|
||||||
* to work with v4 routing over v6 nexthops
|
* to work with v4 routing over v6 nexthops
|
||||||
*/
|
*/
|
||||||
if (peer && !peer->ifp
|
if (peer && !peer->ifp &&
|
||||||
&& CHECK_FLAG(peer->flags,
|
CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE) &&
|
||||||
PEER_FLAG_CAPABILITY_ENHE)
|
!CHECK_FLAG(bnc->bgp->flags,
|
||||||
&& nhr->prefix.family == AF_INET6
|
BGP_FLAG_IPV6_NO_AUTO_RA) &&
|
||||||
&& nexthop->type != NEXTHOP_TYPE_BLACKHOLE) {
|
nhr->prefix.family == AF_INET6 &&
|
||||||
|
nexthop->type != NEXTHOP_TYPE_BLACKHOLE) {
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
ifp = if_lookup_by_index(nexthop->ifindex,
|
ifp = if_lookup_by_index(nexthop->ifindex,
|
||||||
@ -1527,6 +1528,10 @@ void bgp_nht_reg_enhe_cap_intfs(struct peer *peer)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
bgp = peer->bgp;
|
bgp = peer->bgp;
|
||||||
|
|
||||||
|
if (CHECK_FLAG(bgp->flags, BGP_FLAG_IPV6_NO_AUTO_RA))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!sockunion2hostprefix(&peer->connection->su, &p)) {
|
if (!sockunion2hostprefix(&peer->connection->su, &p)) {
|
||||||
zlog_warn("%s: Unable to convert sockunion to prefix for %s",
|
zlog_warn("%s: Unable to convert sockunion to prefix for %s",
|
||||||
__func__, peer->host);
|
__func__, peer->host);
|
||||||
|
@ -5045,6 +5045,27 @@ DEFUN(no_bgp_fast_convergence, no_bgp_fast_convergence_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFPY (bgp_ipv6_auto_ra,
|
||||||
|
bgp_ipv6_auto_ra_cmd,
|
||||||
|
"[no] bgp ipv6-auto-ra",
|
||||||
|
NO_STR
|
||||||
|
BGP_STR
|
||||||
|
"Allow enabling IPv6 ND RA sending\n")
|
||||||
|
{
|
||||||
|
if (vty->node == CONFIG_NODE) {
|
||||||
|
struct listnode *node, *nnode;
|
||||||
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
COND_FLAG(bm->flags, BM_FLAG_IPV6_NO_AUTO_RA, no);
|
||||||
|
for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
|
||||||
|
COND_FLAG(bgp->flags, BGP_FLAG_IPV6_NO_AUTO_RA, no);
|
||||||
|
} else {
|
||||||
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
COND_FLAG(bgp->flags, BGP_FLAG_IPV6_NO_AUTO_RA, no);
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static int peer_conf_interface_get(struct vty *vty, const char *conf_if,
|
static int peer_conf_interface_get(struct vty *vty, const char *conf_if,
|
||||||
int v6only,
|
int v6only,
|
||||||
const char *peer_group_name,
|
const char *peer_group_name,
|
||||||
@ -19455,6 +19476,9 @@ int bgp_config_write(struct vty *vty)
|
|||||||
if (CHECK_FLAG(bm->flags, BM_FLAG_SEND_EXTRA_DATA_TO_ZEBRA))
|
if (CHECK_FLAG(bm->flags, BM_FLAG_SEND_EXTRA_DATA_TO_ZEBRA))
|
||||||
vty_out(vty, "bgp send-extra-data zebra\n");
|
vty_out(vty, "bgp send-extra-data zebra\n");
|
||||||
|
|
||||||
|
if (CHECK_FLAG(bm->flags, BM_FLAG_IPV6_NO_AUTO_RA))
|
||||||
|
vty_out(vty, "no bgp ipv6-auto-ra\n");
|
||||||
|
|
||||||
/* DSCP value for outgoing packets in BGP connections */
|
/* DSCP value for outgoing packets in BGP connections */
|
||||||
if (bm->ip_tos != IPTOS_PREC_INTERNETCONTROL)
|
if (bm->ip_tos != IPTOS_PREC_INTERNETCONTROL)
|
||||||
vty_out(vty, "bgp session-dscp %u\n", bm->ip_tos >> 2);
|
vty_out(vty, "bgp session-dscp %u\n", bm->ip_tos >> 2);
|
||||||
@ -19876,6 +19900,11 @@ int bgp_config_write(struct vty *vty)
|
|||||||
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN))
|
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN))
|
||||||
vty_out(vty, " bgp shutdown\n");
|
vty_out(vty, " bgp shutdown\n");
|
||||||
|
|
||||||
|
/* Automatic RA enabling by BGP */
|
||||||
|
if (!CHECK_FLAG(bm->flags, BM_FLAG_IPV6_NO_AUTO_RA))
|
||||||
|
if (CHECK_FLAG(bgp->flags, BGP_FLAG_IPV6_NO_AUTO_RA))
|
||||||
|
vty_out(vty, " no bgp ipv6-auto-ra\n");
|
||||||
|
|
||||||
if (bgp->allow_martian)
|
if (bgp->allow_martian)
|
||||||
vty_out(vty, " bgp allow-martian-nexthop\n");
|
vty_out(vty, " bgp allow-martian-nexthop\n");
|
||||||
|
|
||||||
@ -20416,6 +20445,12 @@ void bgp_vty_init(void)
|
|||||||
install_element(BGP_NODE, &bgp_fast_convergence_cmd);
|
install_element(BGP_NODE, &bgp_fast_convergence_cmd);
|
||||||
install_element(BGP_NODE, &no_bgp_fast_convergence_cmd);
|
install_element(BGP_NODE, &no_bgp_fast_convergence_cmd);
|
||||||
|
|
||||||
|
/* global bgp ipv6-auto-ra command */
|
||||||
|
install_element(CONFIG_NODE, &bgp_ipv6_auto_ra_cmd);
|
||||||
|
|
||||||
|
/* bgp ipv6-auto-ra command */
|
||||||
|
install_element(BGP_NODE, &bgp_ipv6_auto_ra_cmd);
|
||||||
|
|
||||||
/* global bgp update-delay command */
|
/* global bgp update-delay command */
|
||||||
install_element(CONFIG_NODE, &bgp_global_update_delay_cmd);
|
install_element(CONFIG_NODE, &bgp_global_update_delay_cmd);
|
||||||
install_element(CONFIG_NODE, &no_bgp_global_update_delay_cmd);
|
install_element(CONFIG_NODE, &no_bgp_global_update_delay_cmd);
|
||||||
|
@ -2327,6 +2327,9 @@ void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer)
|
|||||||
{
|
{
|
||||||
uint32_t ra_interval = BGP_UNNUM_DEFAULT_RA_INTERVAL;
|
uint32_t ra_interval = BGP_UNNUM_DEFAULT_RA_INTERVAL;
|
||||||
|
|
||||||
|
if (CHECK_FLAG(bgp->flags, BGP_FLAG_IPV6_NO_AUTO_RA))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Don't try to initiate if we're not connected to Zebra */
|
/* Don't try to initiate if we're not connected to Zebra */
|
||||||
if (zclient->sock < 0)
|
if (zclient->sock < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1411,6 +1411,8 @@ int bgp_global_gr_init(struct bgp *bgp)
|
|||||||
bgp->rib_stale_time = bm->rib_stale_time;
|
bgp->rib_stale_time = bm->rib_stale_time;
|
||||||
if (CHECK_FLAG(bm->flags, BM_FLAG_GR_PRESERVE_FWD))
|
if (CHECK_FLAG(bm->flags, BM_FLAG_GR_PRESERVE_FWD))
|
||||||
SET_FLAG(bgp->flags, BGP_FLAG_GR_PRESERVE_FWD);
|
SET_FLAG(bgp->flags, BGP_FLAG_GR_PRESERVE_FWD);
|
||||||
|
if (CHECK_FLAG(bm->flags, BM_FLAG_IPV6_NO_AUTO_RA))
|
||||||
|
SET_FLAG(bgp->flags, BGP_FLAG_IPV6_NO_AUTO_RA);
|
||||||
|
|
||||||
bgp->present_zebra_gr_state = ZEBRA_GR_DISABLE;
|
bgp->present_zebra_gr_state = ZEBRA_GR_DISABLE;
|
||||||
|
|
||||||
|
@ -172,6 +172,7 @@ struct bgp_master {
|
|||||||
#define BM_FLAG_GR_PRESERVE_FWD (1 << 5)
|
#define BM_FLAG_GR_PRESERVE_FWD (1 << 5)
|
||||||
#define BM_FLAG_GRACEFUL_RESTART (1 << 6)
|
#define BM_FLAG_GRACEFUL_RESTART (1 << 6)
|
||||||
#define BM_FLAG_GR_COMPLETE (1 << 7)
|
#define BM_FLAG_GR_COMPLETE (1 << 7)
|
||||||
|
#define BM_FLAG_IPV6_NO_AUTO_RA (1 << 8)
|
||||||
|
|
||||||
#define BM_FLAG_GR_CONFIGURED (BM_FLAG_GR_RESTARTER | BM_FLAG_GR_DISABLED)
|
#define BM_FLAG_GR_CONFIGURED (BM_FLAG_GR_RESTARTER | BM_FLAG_GR_DISABLED)
|
||||||
|
|
||||||
@ -551,6 +552,8 @@ struct bgp {
|
|||||||
#define BGP_FLAG_DYNAMIC_CAPABILITY (1ULL << 37)
|
#define BGP_FLAG_DYNAMIC_CAPABILITY (1ULL << 37)
|
||||||
#define BGP_FLAG_VNI_DOWN (1ULL << 38)
|
#define BGP_FLAG_VNI_DOWN (1ULL << 38)
|
||||||
#define BGP_FLAG_INSTANCE_HIDDEN (1ULL << 39)
|
#define BGP_FLAG_INSTANCE_HIDDEN (1ULL << 39)
|
||||||
|
/* Prohibit BGP from enabling IPv6 RA on interfaces */
|
||||||
|
#define BGP_FLAG_IPV6_NO_AUTO_RA (1ULL << 40)
|
||||||
|
|
||||||
/* BGP default address-families.
|
/* BGP default address-families.
|
||||||
* New peers inherit enabled afi/safis from bgp instance.
|
* New peers inherit enabled afi/safis from bgp instance.
|
||||||
|
@ -1282,6 +1282,13 @@ IPv6 Support
|
|||||||
address family is enabled by default for all new neighbors.
|
address family is enabled by default for all new neighbors.
|
||||||
|
|
||||||
|
|
||||||
|
.. clicmd:: bgp ipv6-auto-ra
|
||||||
|
|
||||||
|
By default, bgpd can ask Zebra to enable sending IPv6 router advertisement
|
||||||
|
messages on interfaces. For example, this happens for unnumbered peers
|
||||||
|
support or when extended-nexthop capability is used. The ``no`` form of this
|
||||||
|
command disables such behaviour.
|
||||||
|
|
||||||
.. _bgp-route-aggregation:
|
.. _bgp-route-aggregation:
|
||||||
|
|
||||||
Route Aggregation
|
Route Aggregation
|
||||||
|
@ -25,7 +25,8 @@ Router Advertisement
|
|||||||
.. clicmd:: ipv6 nd suppress-ra
|
.. clicmd:: ipv6 nd suppress-ra
|
||||||
|
|
||||||
Don't send router advertisement messages. The ``no`` form of this command
|
Don't send router advertisement messages. The ``no`` form of this command
|
||||||
enables sending RA messages.
|
enables sending RA messages. Note that while being suppressed, RA messages
|
||||||
|
might still be enabled by other daemons, such as bgpd or vrrpd.
|
||||||
|
|
||||||
.. clicmd:: ipv6 nd prefix ipv6prefix [valid-lifetime] [preferred-lifetime] [off-link] [no-autoconfig] [router-address]
|
.. clicmd:: ipv6 nd prefix ipv6prefix [valid-lifetime] [preferred-lifetime] [off-link] [no-autoconfig] [router-address]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user