]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: Fix for "show ipv6 ospf6 database intra-prefix"
authorYash Ranjan <ranjany@vmware.com>
Fri, 11 Dec 2020 05:16:37 +0000 (21:16 -0800)
committerYash Ranjan <ranjany@vmware.com>
Fri, 11 Dec 2020 06:21:37 +0000 (22:21 -0800)
Some prefixes were not shown in the intra-prefix database
show command, due to issues with pointer calculation.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
ospf6d/ospf6_intra.c

index a34f8d369355da240b72957222e655c0de27708e..6de223faf465f9900a611f085b64a23ef16c5a8c 100644 (file)
@@ -796,7 +796,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 +812,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));