forked from Mirror/frr
zebra: add command for setting protodown bit
Add command for use to set protodown via frr.conf in the case our default conflicts with another application they are using. Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
parent
f9a1140c9a
commit
c40e1b1cfb
|
@ -255,6 +255,17 @@ Link Parameters Commands
|
||||||
for InterASv2 link in OSPF (RFC5392). Note that this option is not yet
|
for InterASv2 link in OSPF (RFC5392). Note that this option is not yet
|
||||||
supported for ISIS (RFC5316).
|
supported for ISIS (RFC5316).
|
||||||
|
|
||||||
|
Global Commands
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. clicmd:: zebra protodown reason-bit (0-31)
|
||||||
|
|
||||||
|
This command is only supported for linux and a kernel > 5.1.
|
||||||
|
Change reason-bit frr uses for setting protodown. We default to 7, but
|
||||||
|
if another userspace app ever conflicts with this, you can change it here.
|
||||||
|
The descriptor for this bit should exist in :file:`/etc/iproute2/protodown_reasons.d/`
|
||||||
|
to display with :clicmd:`ip -d link show`.
|
||||||
|
|
||||||
Nexthop Tracking
|
Nexthop Tracking
|
||||||
================
|
================
|
||||||
|
|
||||||
|
|
|
@ -2214,4 +2214,34 @@ void interface_list(struct zebra_ns *zns)
|
||||||
interface_addr_lookup_netlink(zns);
|
interface_addr_lookup_netlink(zns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void if_netlink_set_frr_protodown_r_bit(uint8_t bit)
|
||||||
|
{
|
||||||
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
|
zlog_debug("FRR protodown reason bit change %u -> %u",
|
||||||
|
frr_protodown_r_bit, bit);
|
||||||
|
|
||||||
|
frr_protodown_r_bit = bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void if_netlink_unset_frr_protodown_r_bit(void)
|
||||||
|
{
|
||||||
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
|
zlog_debug("FRR protodown reason bit change %u -> %u",
|
||||||
|
frr_protodown_r_bit,
|
||||||
|
FRR_PROTODOWN_REASON_DEFAULT_BIT);
|
||||||
|
|
||||||
|
frr_protodown_r_bit = FRR_PROTODOWN_REASON_DEFAULT_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool if_netlink_frr_protodown_r_bit_is_set(void)
|
||||||
|
{
|
||||||
|
return (frr_protodown_r_bit != FRR_PROTODOWN_REASON_DEFAULT_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t if_netlink_get_frr_protodown_r_bit(void)
|
||||||
|
{
|
||||||
|
return frr_protodown_r_bit;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* GNU_LINUX */
|
#endif /* GNU_LINUX */
|
||||||
|
|
|
@ -72,6 +72,16 @@ netlink_put_intf_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx);
|
||||||
*/
|
*/
|
||||||
int netlink_protodown(struct interface *ifp, bool down, uint32_t r_bitfield);
|
int netlink_protodown(struct interface *ifp, bool down, uint32_t r_bitfield);
|
||||||
|
|
||||||
|
/* Protodown bit setter/getter
|
||||||
|
*
|
||||||
|
* Allow users to change the bit if it conflicts with another
|
||||||
|
* on their system.
|
||||||
|
*/
|
||||||
|
extern void if_netlink_set_frr_protodown_r_bit(uint8_t bit);
|
||||||
|
extern void if_netlink_unset_frr_protodown_r_bit(void);
|
||||||
|
extern bool if_netlink_frr_protodown_r_bit_is_set(void);
|
||||||
|
extern uint8_t if_netlink_get_frr_protodown_r_bit(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -210,6 +210,10 @@ int netlink_config_write_helper(struct vty *vty)
|
||||||
vty_out(vty, "zebra kernel netlink batch-tx-buf %u %u\n", size,
|
vty_out(vty, "zebra kernel netlink batch-tx-buf %u %u\n", size,
|
||||||
threshold);
|
threshold);
|
||||||
|
|
||||||
|
if (if_netlink_frr_protodown_r_bit_is_set())
|
||||||
|
vty_out(vty, "zebra protodown reason-bit %u\n",
|
||||||
|
if_netlink_get_frr_protodown_r_bit());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#include "northbound_cli.h"
|
#include "northbound_cli.h"
|
||||||
#include "zebra/zebra_nb.h"
|
#include "zebra/zebra_nb.h"
|
||||||
#include "zebra/kernel_netlink.h"
|
#include "zebra/kernel_netlink.h"
|
||||||
|
#include "zebra/if_netlink.h"
|
||||||
#include "zebra/table_manager.h"
|
#include "zebra/table_manager.h"
|
||||||
#include "zebra/zebra_script.h"
|
#include "zebra/zebra_script.h"
|
||||||
#include "zebra/rtadv.h"
|
#include "zebra/rtadv.h"
|
||||||
|
@ -4356,6 +4357,31 @@ DEFUN_HIDDEN(no_zebra_kernel_netlink_batch_tx_buf,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFPY (zebra_protodown_bit,
|
||||||
|
zebra_protodown_bit_cmd,
|
||||||
|
"zebra protodown reason-bit (0-31)$bit",
|
||||||
|
ZEBRA_STR
|
||||||
|
"Protodown Configuration\n"
|
||||||
|
"Reason Bit used in the kernel for application\n"
|
||||||
|
"Reason Bit range\n")
|
||||||
|
{
|
||||||
|
if_netlink_set_frr_protodown_r_bit(bit);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY (no_zebra_protodown_bit,
|
||||||
|
no_zebra_protodown_bit_cmd,
|
||||||
|
"no zebra protodown reason-bit [(0-31)$bit]",
|
||||||
|
NO_STR
|
||||||
|
ZEBRA_STR
|
||||||
|
"Protodown Configuration\n"
|
||||||
|
"Reason Bit used in the kernel for setting protodown\n"
|
||||||
|
"Reason Bit Range\n")
|
||||||
|
{
|
||||||
|
if_netlink_unset_frr_protodown_r_bit();
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
|
|
||||||
DEFUN(ip_table_range, ip_table_range_cmd,
|
DEFUN(ip_table_range, ip_table_range_cmd,
|
||||||
|
@ -4561,6 +4587,8 @@ void zebra_vty_init(void)
|
||||||
#ifdef HAVE_NETLINK
|
#ifdef HAVE_NETLINK
|
||||||
install_element(CONFIG_NODE, &zebra_kernel_netlink_batch_tx_buf_cmd);
|
install_element(CONFIG_NODE, &zebra_kernel_netlink_batch_tx_buf_cmd);
|
||||||
install_element(CONFIG_NODE, &no_zebra_kernel_netlink_batch_tx_buf_cmd);
|
install_element(CONFIG_NODE, &no_zebra_kernel_netlink_batch_tx_buf_cmd);
|
||||||
|
install_element(CONFIG_NODE, &zebra_protodown_bit_cmd);
|
||||||
|
install_element(CONFIG_NODE, &no_zebra_protodown_bit_cmd);
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
|
|
||||||
#ifdef HAVE_SCRIPTING
|
#ifdef HAVE_SCRIPTING
|
||||||
|
|
Loading…
Reference in a new issue