mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 21:23:06 +00:00
Merge pull request #12678 from opensourcerouting/fix/missing_no_form_for_path_attribute_discard
bgpd: Add missing `no` form for `neighbor path-attribute discard` cmd
This commit is contained in:
commit
b25695f630
@ -5097,18 +5097,29 @@ void bgp_dump_routes_attr(struct stream *s, struct bgp_path_info *bpi,
|
||||
}
|
||||
|
||||
void bgp_path_attribute_discard_vty(struct vty *vty, struct peer *peer,
|
||||
const char *discard_attrs)
|
||||
const char *discard_attrs, bool set)
|
||||
{
|
||||
int i, num_attributes;
|
||||
char **attributes;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
|
||||
|
||||
/* If `no` command specified without arbitrary attributes,
|
||||
* then flush all.
|
||||
*/
|
||||
if (!discard_attrs) {
|
||||
for (i = 0; i < BGP_ATTR_MAX; i++)
|
||||
peer->discard_attrs[i] = false;
|
||||
goto discard_soft_clear;
|
||||
}
|
||||
|
||||
if (discard_attrs) {
|
||||
frrstr_split(discard_attrs, " ", &attributes, &num_attributes);
|
||||
|
||||
for (i = 0; i < BGP_ATTR_MAX; i++)
|
||||
peer->discard_attrs[i] = false;
|
||||
if (set)
|
||||
for (i = 0; i < BGP_ATTR_MAX; i++)
|
||||
peer->discard_attrs[i] = false;
|
||||
|
||||
for (i = 0; i < num_attributes; i++) {
|
||||
uint8_t attr_num = strtoul(attributes[i], NULL, 10);
|
||||
@ -5142,10 +5153,10 @@ void bgp_path_attribute_discard_vty(struct vty *vty, struct peer *peer,
|
||||
continue;
|
||||
}
|
||||
|
||||
peer->discard_attrs[attr_num] = true;
|
||||
peer->discard_attrs[attr_num] = set;
|
||||
}
|
||||
XFREE(MTYPE_TMP, attributes);
|
||||
|
||||
discard_soft_clear:
|
||||
/* Configuring path attributes to be discarded will trigger
|
||||
* an inbound Route Refresh to ensure that the routing table
|
||||
* is up to date.
|
||||
|
@ -415,7 +415,7 @@ extern void attr_show_all(struct vty *vty);
|
||||
extern unsigned long int attr_count(void);
|
||||
extern unsigned long int attr_unknown_count(void);
|
||||
extern void bgp_path_attribute_discard_vty(struct vty *vty, struct peer *peer,
|
||||
const char *discard_attrs);
|
||||
const char *discard_attrs, bool set);
|
||||
|
||||
/* Cluster list prototypes. */
|
||||
extern bool cluster_loop_check(struct cluster_list *cluster,
|
||||
|
@ -8787,7 +8787,34 @@ DEFPY(neighbor_path_attribute_discard,
|
||||
if (idx)
|
||||
discard_attrs = argv_concat(argv, argc, idx);
|
||||
|
||||
bgp_path_attribute_discard_vty(vty, peer, discard_attrs);
|
||||
bgp_path_attribute_discard_vty(vty, peer, discard_attrs, true);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY(no_neighbor_path_attribute_discard,
|
||||
no_neighbor_path_attribute_discard_cmd,
|
||||
"no neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor path-attribute discard [(1-255)]",
|
||||
NO_STR
|
||||
NEIGHBOR_STR
|
||||
NEIGHBOR_ADDR_STR2
|
||||
"Manipulate path attributes from incoming UPDATE messages\n"
|
||||
"Drop specified attributes from incoming UPDATE messages\n"
|
||||
"Attribute number\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
int idx = 0;
|
||||
const char *discard_attrs = NULL;
|
||||
|
||||
peer = peer_and_group_lookup_vty(vty, neighbor);
|
||||
if (!peer)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
argv_find(argv, argc, "(1-255)", &idx);
|
||||
if (idx)
|
||||
discard_attrs = argv[idx]->arg;
|
||||
|
||||
bgp_path_attribute_discard_vty(vty, peer, discard_attrs, false);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -19541,6 +19568,7 @@ void bgp_vty_init(void)
|
||||
|
||||
/* "neighbor path-attribute discard" commands. */
|
||||
install_element(BGP_NODE, &neighbor_path_attribute_discard_cmd);
|
||||
install_element(BGP_NODE, &no_neighbor_path_attribute_discard_cmd);
|
||||
|
||||
/* "neighbor passive" commands. */
|
||||
install_element(BGP_NODE, &neighbor_passive_cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user