Skip to content

Commit

Permalink
zebra: Check for NULL in connected_add_ipv6
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
donaldsharp committed Apr 16, 2018
1 parent 60c0687 commit f52d0a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zebra/connected.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,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. */
Expand Down

0 comments on commit f52d0a1

Please sign in to comment.