]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Check for NULL in connected_add_ipv6
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 16 Apr 2018 15:17:52 +0000 (11:17 -0400)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 29 Jun 2018 19:17:17 +0000 (16:17 -0300)
When I implemented the same functionality in add_ipv6 that
add_ipv4 has I just assumed that broad would not be NULL with
the ZEBRA_IFA_PEER flag set.

Modify the code to act similiar to the flow of control
in add_ipv4.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/connected.c

index 446883bb0ff512832b99a57e4df5909b7f994a9d..cc6b7906430d361f1f49d1fe5dc06f685fb846a3 100644 (file)
@@ -510,12 +510,18 @@ void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr,
        p->prefixlen = prefixlen;
        ifc->address = (struct prefix *)p;
 
-       if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
+       if (broad) {
                p = prefix_ipv6_new();
                p->family = AF_INET6;
                IPV6_ADDR_COPY(&p->prefix, broad);
                p->prefixlen = prefixlen;
                ifc->destination = (struct prefix *)p;
+       } else {
+               if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
+                       zlog_warn("warning: %s called for interface %s with peer flag set, but no peer address supplied",
+                                 __func__, ifp->name);
+                       UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
+               }
        }
 
        /* Label of this address. */