diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2019-04-18 10:17:57 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2019-04-23 11:25:35 +0300 |
| commit | c39008533c9c03f2c7e55e40811337079d7b67aa (patch) | |
| tree | 82ed258db9b6acec6518a919bf32b615a2933d51 | |
| parent | f799ea3f940dc8107e677f4349fcd542cf01305b (diff) | |
bgpd: Validate as-path in `show bgp regexp`
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
| -rw-r--r-- | bgpd/bgp_filter.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_filter.h | 1 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index a788ea68f3..b262f6b56d 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -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_^|[,{}() ]$*+.?-\\"; diff --git a/bgpd/bgp_filter.h b/bgpd/bgp_filter.h index e54372f8e0..3c49e357ff 100644 --- a/bgpd/bgp_filter.h +++ b/bgpd/bgp_filter.h @@ -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 */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 7036ededac..31df5165ae 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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); |
