diff options
| author | Russ White <russ@riw.us> | 2023-01-24 10:45:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-24 10:45:03 -0500 |
| commit | b25695f630cfaa9b71a72f1da8577d6d835b6b51 (patch) | |
| tree | 243f4993046192a378b689e871031aed829d5e63 /bgpd/bgp_attr.c | |
| parent | 1ea7c32507b1e456fbab82f08ed015bb64147277 (diff) | |
| parent | b986d7f41aae60535b45e66458f6e84a606cc5d1 (diff) | |
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
Diffstat (limited to 'bgpd/bgp_attr.c')
| -rw-r--r-- | bgpd/bgp_attr.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index e60c1bb8dc..392b558805 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -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 (discard_attrs) { - frrstr_split(discard_attrs, " ", &attributes, &num_attributes); + /* 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); + + 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. |
