mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 17:36:36 +00:00
bgpd: Validate as-path in show bgp regexp
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
f799ea3f94
commit
c39008533c
@ -389,7 +389,7 @@ static int as_list_dup_check(struct as_list *aslist, struct as_filter *new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int config_bgp_aspath_validate(const char *regstr)
|
||||
int config_bgp_aspath_validate(const char *regstr)
|
||||
{
|
||||
char valid_chars[] = "1234567890_^|[,{}() ]$*+.?-\\";
|
||||
|
||||
|
@ -31,5 +31,6 @@ extern enum as_filter_type as_list_apply(struct as_list *, void *);
|
||||
extern struct as_list *as_list_lookup(const char *);
|
||||
extern void as_list_add_hook(void (*func)(char *));
|
||||
extern void as_list_delete_hook(void (*func)(const char *));
|
||||
extern int config_bgp_aspath_validate(const char *regstr);
|
||||
|
||||
#endif /* _QUAGGA_BGP_FILTER_H */
|
||||
|
@ -9985,6 +9985,12 @@ static int bgp_show_regexp(struct vty *vty, struct bgp *bgp, const char *regstr,
|
||||
regex_t *regex;
|
||||
int rc;
|
||||
|
||||
if (!config_bgp_aspath_validate(regstr)) {
|
||||
vty_out(vty, "Invalid character in as-path access-list %s\n",
|
||||
regstr);
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
|
||||
regex = bgp_regcomp(regstr);
|
||||
if (!regex) {
|
||||
vty_out(vty, "Can't compile regexp %s\n", regstr);
|
||||
|
Loading…
Reference in New Issue
Block a user