mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-01 12:47:16 +00:00
isisd: Add support for isis hello padding sometimes
New configuration to pad ISIS hello packets during adjacency formation only. Signed-off-by: Diogo Oliveira <14191454+dorDiogo@users.noreply.github.com>
This commit is contained in:
parent
617d2b71c0
commit
e36ec6acbc
@ -107,7 +107,7 @@ struct isis_circuit *isis_circuit_new(struct interface *ifp, const char *tag)
|
||||
"/frr-interface:lib/interface/frr-isisd:isis/circuit-type");
|
||||
circuit->flags = 0;
|
||||
|
||||
circuit->pad_hellos = yang_get_default_bool(
|
||||
circuit->pad_hellos = yang_get_default_enum(
|
||||
"/frr-interface:lib/interface/frr-isisd:isis/hello/padding");
|
||||
circuit->hello_interval[0] = yang_get_default_uint32(
|
||||
"/frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1");
|
||||
@ -145,7 +145,7 @@ struct isis_circuit *isis_circuit_new(struct interface *ifp, const char *tag)
|
||||
#else
|
||||
circuit->is_type_config = IS_LEVEL_1_AND_2;
|
||||
circuit->flags = 0;
|
||||
circuit->pad_hellos = 1;
|
||||
circuit->pad_hellos = ISIS_HELLO_PADDING_ALWAYS;
|
||||
for (i = 0; i < 2; i++) {
|
||||
circuit->hello_interval[i] = DEFAULT_HELLO_INTERVAL;
|
||||
circuit->hello_multiplier[i] = DEFAULT_HELLO_MULTIPLIER;
|
||||
@ -1029,7 +1029,8 @@ void isis_circuit_print_json(struct isis_circuit *circuit,
|
||||
circuit->hello_multiplier[0]);
|
||||
json_object_string_add(
|
||||
hold_json, "pad",
|
||||
(circuit->pad_hellos ? "yes" : "no"));
|
||||
isis_hello_padding2string(
|
||||
circuit->pad_hellos));
|
||||
json_object_int_add(level_json, "cnsp-interval",
|
||||
circuit->csnp_interval[0]);
|
||||
json_object_int_add(level_json, "psnp-interval",
|
||||
@ -1137,11 +1138,11 @@ void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
|
||||
vty_out(vty, ", Active neighbors: %u\n",
|
||||
circuit->upadjcount[0]);
|
||||
vty_out(vty,
|
||||
" Hello interval: %u, Holddown count: %u %s\n",
|
||||
" Hello interval: %u, Holddown count: %u, Padding: %s\n",
|
||||
circuit->hello_interval[0],
|
||||
circuit->hello_multiplier[0],
|
||||
(circuit->pad_hellos ? "(pad)"
|
||||
: "(no-pad)"));
|
||||
isis_hello_padding2string(
|
||||
circuit->pad_hellos));
|
||||
vty_out(vty,
|
||||
" CNSP interval: %u, PSNP interval: %u\n",
|
||||
circuit->csnp_interval[0],
|
||||
@ -1169,11 +1170,11 @@ void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
|
||||
vty_out(vty, ", Active neighbors: %u\n",
|
||||
circuit->upadjcount[1]);
|
||||
vty_out(vty,
|
||||
" Hello interval: %u, Holddown count: %u %s\n",
|
||||
" Hello interval: %u, Holddown count: %u, Padding: %s\n",
|
||||
circuit->hello_interval[1],
|
||||
circuit->hello_multiplier[1],
|
||||
(circuit->pad_hellos ? "(pad)"
|
||||
: "(no-pad)"));
|
||||
isis_hello_padding2string(
|
||||
circuit->pad_hellos));
|
||||
vty_out(vty,
|
||||
" CNSP interval: %u, PSNP interval: %u\n",
|
||||
circuit->csnp_interval[1],
|
||||
@ -1319,11 +1320,20 @@ static int isis_interface_config_write(struct vty *vty)
|
||||
}
|
||||
}
|
||||
|
||||
/* ISIS - Hello padding - Defaults to true so only
|
||||
* display if false */
|
||||
if (circuit->pad_hellos == 0) {
|
||||
/* ISIS - Hello padding - Defaults to always so only
|
||||
* display if not always */
|
||||
switch (circuit->pad_hellos) {
|
||||
case ISIS_HELLO_PADDING_DISABLED:
|
||||
vty_out(vty, " no " PROTO_NAME " hello padding\n");
|
||||
write++;
|
||||
break;
|
||||
case ISIS_HELLO_PADDING_SOMETIMES:
|
||||
vty_out(vty, PROTO_NAME
|
||||
" hello padding sometimes\n");
|
||||
write++;
|
||||
break;
|
||||
case ISIS_HELLO_PADDING_ALWAYS:
|
||||
break;
|
||||
}
|
||||
|
||||
if (circuit->disable_threeway_adj) {
|
||||
|
||||
@ -63,6 +63,15 @@ struct isis_circuit_arg {
|
||||
struct isis_circuit *circuit;
|
||||
};
|
||||
|
||||
/*
|
||||
* Hello padding types
|
||||
*/
|
||||
enum isis_hello_padding {
|
||||
ISIS_HELLO_PADDING_ALWAYS,
|
||||
ISIS_HELLO_PADDING_DISABLED,
|
||||
ISIS_HELLO_PADDING_SOMETIMES
|
||||
};
|
||||
|
||||
struct isis_circuit {
|
||||
enum isis_circuit_state state;
|
||||
uint8_t circuit_id; /* l1/l2 bcast CircuitID */
|
||||
@ -100,7 +109,7 @@ struct isis_circuit {
|
||||
struct isis_p2p_info p2p;
|
||||
} u;
|
||||
uint8_t priority[ISIS_LEVELS]; /* l1/2 IS configured priority */
|
||||
int pad_hellos; /* add padding to Hello PDUs ? */
|
||||
enum isis_hello_padding pad_hellos; /* type of Hello PDUs padding */
|
||||
char ext_domain; /* externalDomain (boolean) */
|
||||
int lsp_regenerate_pending[ISIS_LEVELS];
|
||||
uint64_t lsp_error_counter;
|
||||
|
||||
@ -2239,15 +2239,22 @@ void cli_show_ip_isis_threeway_shake(struct vty *vty,
|
||||
/*
|
||||
* XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
|
||||
*/
|
||||
DEFPY_YANG(isis_hello_padding, isis_hello_padding_cmd, "[no] isis hello padding",
|
||||
NO_STR
|
||||
"IS-IS routing protocol\n"
|
||||
"Add padding to IS-IS hello packets\n"
|
||||
"Pad hello packets\n")
|
||||
DEFPY_YANG(isis_hello_padding, isis_hello_padding_cmd,
|
||||
"[no] isis hello padding [sometimes]$padding_type",
|
||||
NO_STR
|
||||
"IS-IS routing protocol\n"
|
||||
"Type of padding for IS-IS hello packets\n"
|
||||
"Pad hello packets\n"
|
||||
"Add padding to hello packets during adjacency formation only.\n")
|
||||
{
|
||||
nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding",
|
||||
NB_OP_MODIFY, no ? "false" : "true");
|
||||
|
||||
if (no) {
|
||||
nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding",
|
||||
NB_OP_MODIFY, "disabled");
|
||||
} else {
|
||||
nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding",
|
||||
NB_OP_MODIFY,
|
||||
padding_type ? padding_type : "always");
|
||||
}
|
||||
return nb_cli_apply_changes(vty, NULL);
|
||||
}
|
||||
|
||||
@ -2255,10 +2262,13 @@ void cli_show_ip_isis_hello_padding(struct vty *vty,
|
||||
const struct lyd_node *dnode,
|
||||
bool show_defaults)
|
||||
{
|
||||
if (!yang_dnode_get_bool(dnode, NULL))
|
||||
int hello_padding_type = yang_dnode_get_enum(dnode, NULL);
|
||||
if (hello_padding_type == ISIS_HELLO_PADDING_DISABLED)
|
||||
vty_out(vty, " no");
|
||||
|
||||
vty_out(vty, " isis hello padding\n");
|
||||
vty_out(vty, " isis hello padding");
|
||||
if (hello_padding_type == ISIS_HELLO_PADDING_SOMETIMES)
|
||||
vty_out(vty, " sometimes");
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -294,6 +294,19 @@ const char *syst2string(int type)
|
||||
return NULL; /* not reached */
|
||||
}
|
||||
|
||||
const char *isis_hello_padding2string(int hello_padding_type)
|
||||
{
|
||||
switch (hello_padding_type) {
|
||||
case ISIS_HELLO_PADDING_DISABLED:
|
||||
return "no";
|
||||
case ISIS_HELLO_PADDING_SOMETIMES:
|
||||
return "sometimes";
|
||||
case ISIS_HELLO_PADDING_ALWAYS:
|
||||
return "yes";
|
||||
}
|
||||
return NULL; /* not reached */
|
||||
}
|
||||
|
||||
/*
|
||||
* Print functions - we print to static vars
|
||||
*/
|
||||
|
||||
@ -16,6 +16,7 @@ const char *circuit_t2string(int);
|
||||
const char *circuit_state2string(int state);
|
||||
const char *circuit_type2string(int type);
|
||||
const char *syst2string(int);
|
||||
const char *isis_hello_padding2string(int hello_padding_type);
|
||||
struct in_addr newprefix2inaddr(uint8_t *prefix_start, uint8_t prefix_masklen);
|
||||
/*
|
||||
* Converting input to memory stored format
|
||||
|
||||
@ -2765,7 +2765,7 @@ int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args *args)
|
||||
return NB_OK;
|
||||
|
||||
circuit = nb_running_get_entry(args->dnode, NULL, true);
|
||||
circuit->pad_hellos = yang_dnode_get_bool(args->dnode, NULL);
|
||||
circuit->pad_hellos = yang_dnode_get_enum(args->dnode, NULL);
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
@ -1964,8 +1964,13 @@ int send_hello(struct isis_circuit *circuit, int level)
|
||||
isis_tlvs_add_global_ipv6_addresses(tlvs,
|
||||
circuit->ipv6_non_link);
|
||||
|
||||
bool should_pad_hello =
|
||||
circuit->pad_hellos == ISIS_HELLO_PADDING_ALWAYS ||
|
||||
(circuit->pad_hellos == ISIS_HELLO_PADDING_SOMETIMES &&
|
||||
circuit->upadjcount[0] + circuit->upadjcount[1] == 0);
|
||||
|
||||
if (isis_pack_tlvs(tlvs, circuit->snd_stream, len_pointer,
|
||||
circuit->pad_hellos, false)) {
|
||||
should_pad_hello, false)) {
|
||||
isis_free_tlvs(tlvs);
|
||||
return ISIS_WARNING; /* XXX: Maybe Log TLV structure? */
|
||||
}
|
||||
|
||||
@ -2161,7 +2161,9 @@ static uint8_t *isis_snmp_find_circ(struct variable *v, oid *name,
|
||||
/*
|
||||
* return false if lan hellos must be padded
|
||||
*/
|
||||
if (circuit->pad_hellos)
|
||||
if (circuit->pad_hellos == ISIS_HELLO_PADDING_ALWAYS ||
|
||||
(circuit->pad_hellos == ISIS_HELLO_PADDING_SOMETIMES &&
|
||||
circuit->upadjcount[0] + circuit->upadjcount[1] == 0))
|
||||
return SNMP_INTEGER(ISIS_SNMP_TRUTH_VALUE_FALSE);
|
||||
|
||||
return SNMP_INTEGER(ISIS_SNMP_TRUTH_VALUE_TRUE);
|
||||
|
||||
@ -116,6 +116,26 @@ module frr-isisd {
|
||||
associated with an interface.";
|
||||
}
|
||||
|
||||
typedef hello-padding-type {
|
||||
type enumeration {
|
||||
enum "always" {
|
||||
value 0;
|
||||
description
|
||||
"Add padding to all hello packets.";
|
||||
}
|
||||
enum "disabled" {
|
||||
value 1;
|
||||
description
|
||||
"Do not add any padding to hello packets.";
|
||||
}
|
||||
enum "sometimes" {
|
||||
value 2;
|
||||
description
|
||||
"Add padding to hello packets during adjacency formation only.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef network-type {
|
||||
type enumeration {
|
||||
enum "unknown" {
|
||||
@ -605,10 +625,10 @@ module frr-isisd {
|
||||
description
|
||||
"Parameters related to IS-IS hello PDUs.";
|
||||
leaf padding {
|
||||
type boolean;
|
||||
default "true";
|
||||
type hello-padding-type;
|
||||
default "always";
|
||||
description
|
||||
"Add padding to IS-IS hello PDUs.";
|
||||
"Type of padding for IS-IS hello packets.";
|
||||
}
|
||||
|
||||
container interval {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user