diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-12-11 20:58:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-11 20:58:52 -0500 |
| commit | 06ee6e6deef43fd30ad6ccb2ca420e7f0712ee22 (patch) | |
| tree | 22f7785512546b526d22d00982bf3e26c842ae54 /ospf6d/ospf6_intra.c | |
| parent | f23e82838bcc53b19b21c280e50c94ab1f8afdfa (diff) | |
| parent | 08d8fa45877c7e6bdd10933fca9f25ea94927ddc (diff) | |
Merge pull request #7713 from ranjanyash54/2371
ospf6d: Fix the prefix walking for show database command for intra-prefix and link
Diffstat (limited to 'ospf6d/ospf6_intra.c')
| -rw-r--r-- | ospf6d/ospf6_intra.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index be5069c88d..17538c466a 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -609,9 +609,8 @@ static char *ospf6_link_lsa_get_prefix_str(struct ospf6_lsa *lsa, char *buf, return NULL; } - if (cnt < pos) { - current = - start + pos * OSPF6_PREFIX_SIZE(prefix); + if (cnt < (pos - 1)) { + current += OSPF6_PREFIX_SIZE(prefix); cnt++; } else { memset(&in6, 0, sizeof(in6)); @@ -796,7 +795,7 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, + sizeof(struct ospf6_lsa_header)); prefixnum = ntohs(intra_prefix_lsa->prefix_num); - if (pos > prefixnum) + if ((pos + 1) > prefixnum) return NULL; start = (char *)intra_prefix_lsa @@ -812,8 +811,7 @@ static char *ospf6_intra_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa, } if (cnt < pos) { - current = - start + pos * OSPF6_PREFIX_SIZE(prefix); + current += OSPF6_PREFIX_SIZE(prefix); cnt++; } else { memset(&in6, 0, sizeof(in6)); |
