diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-07-27 12:15:32 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-27 12:15:32 +0300 |
| commit | bb38b3681c4e97338e86a591d51ca0957ef66081 (patch) | |
| tree | 00938ed7e8075b1409a855b76c86fcdcd94d98af | |
| parent | 53d7080980bb4e3bf6ef053673ebc560c5412103 (diff) | |
| parent | 35a45e80703a5a96b09257c9bb44ec79df6c6337 (diff) | |
Merge pull request #9162 from ton31337/fix/use_strcmp_for_match_alias
bgpd: Use strcmp comparing BGP alias with an actual entered alias
| -rw-r--r-- | bgpd/bgp_route.c | 6 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d5bb53ad8d..66ff16d53a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10862,8 +10862,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, const char *com2alias = bgp_community2alias( communities[i]); - if (strncmp(alias, com2alias, - strlen(com2alias)) + if (strcmp(alias, com2alias) == 0) { found = true; break; @@ -10878,8 +10877,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, const char *com2alias = bgp_community2alias( communities[i]); - if (strncmp(alias, com2alias, - strlen(com2alias)) + if (strcmp(alias, com2alias) == 0) { found = true; break; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 5b1044754e..61f57d0475 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1195,7 +1195,7 @@ route_match_alias(void *rule, const struct prefix *prefix, void *object) for (int i = 0; i < num; i++) { const char *com2alias = bgp_community2alias(communities[i]); - if (strncmp(alias, com2alias, strlen(com2alias)) == 0) + if (strcmp(alias, com2alias) == 0) return RMAP_MATCH; } } @@ -1206,7 +1206,7 @@ route_match_alias(void *rule, const struct prefix *prefix, void *object) for (int i = 0; i < num; i++) { const char *com2alias = bgp_community2alias(communities[i]); - if (strncmp(alias, com2alias, strlen(com2alias)) == 0) + if (strcmp(alias, com2alias) == 0) return RMAP_MATCH; } } |
