diff options
| -rw-r--r-- | isisd/isis_circuit.c | 14 | ||||
| -rw-r--r-- | ospf6d/ospf6_message.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_network.c | 10 | ||||
| -rw-r--r-- | ospf6d/ospf6_network.h | 10 | ||||
| -rw-r--r-- | zebra/zebra_rib.c | 13 |
5 files changed, 31 insertions, 18 deletions
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 730d224cb8..e3c70264f8 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -598,8 +598,20 @@ int isis_circuit_up(struct isis_circuit *circuit) if (circuit->state == C_STATE_UP) return ISIS_OK; - if (circuit->is_passive) + if (circuit->is_passive) { + /* make sure the union fields are initialized, else we + * could end with garbage values from a previous circuit + * type, which would then cause a segfault when building + * LSPs or computing the SPF tree + */ + if (circuit->circ_type == CIRCUIT_T_BROADCAST) { + circuit->u.bc.adjdb[0] = list_new(); + circuit->u.bc.adjdb[1] = list_new(); + } else if (circuit->circ_type == CIRCUIT_T_P2P) { + circuit->u.p2p.neighbor = NULL; + } return ISIS_OK; + } if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) { flog_err( diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 07089d8774..853e2714cb 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1701,7 +1701,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, /* send message */ if (oi->area->ospf6->fd != -1) { - len = ospf6_sendmsg(src, dst, &oi->interface->ifindex, iovector, + len = ospf6_sendmsg(src, dst, oi->interface->ifindex, iovector, oi->area->ospf6->fd); if (len != ntohs(oh->length)) flog_err(EC_LIB_DEVELOPMENT, diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 6c83881bf4..94e80b0f28 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -171,7 +171,7 @@ static int iov_totallen(struct iovec *iov) } int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, - ifindex_t *ifindex, struct iovec *message, int ospf6_sock) + ifindex_t ifindex, struct iovec *message, int ospf6_sock) { int retval; struct msghdr smsghdr; @@ -184,7 +184,6 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, struct sockaddr_in6 dst_sin6; assert(dst); - assert(*ifindex); memset(&cmsgbuf, 0, sizeof(cmsgbuf)); scmsgp = (struct cmsghdr *)&cmsgbuf; @@ -192,7 +191,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, memset(&dst_sin6, 0, sizeof(struct sockaddr_in6)); /* source address */ - pktinfo->ipi6_ifindex = *ifindex; + pktinfo->ipi6_ifindex = ifindex; if (src) memcpy(&pktinfo->ipi6_addr, src, sizeof(struct in6_addr)); else @@ -204,7 +203,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, dst_sin6.sin6_len = sizeof(struct sockaddr_in6); #endif /*SIN6_LEN*/ memcpy(&dst_sin6.sin6_addr, dst, sizeof(struct in6_addr)); - dst_sin6.sin6_scope_id = *ifindex; + dst_sin6.sin6_scope_id = ifindex; /* send control msg */ scmsgp->cmsg_level = IPPROTO_IPV6; @@ -223,7 +222,8 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, retval = sendmsg(ospf6_sock, &smsghdr, 0); if (retval != iov_totallen(message)) - zlog_warn("sendmsg failed: ifindex: %d: %s (%d)", *ifindex, + zlog_warn("sendmsg failed: source: %pI6 Dest: %pI6 ifindex: %d: %s (%d)", + src, dst, ifindex, safe_strerror(errno), errno); return retval; diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index d11a611c49..0ec7975e14 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -28,9 +28,11 @@ extern int ospf6_serv_sock(struct ospf6 *ospf6); extern void ospf6_serv_close(int *ospf6_sock); extern int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option); -extern int ospf6_sendmsg(struct in6_addr *, struct in6_addr *, ifindex_t *, - struct iovec *, int ospf6_sock); -extern int ospf6_recvmsg(struct in6_addr *, struct in6_addr *, ifindex_t *, - struct iovec *, int ospf6_sock); +extern int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, + ifindex_t ifindex, struct iovec *message, + int ospf6_sock); +extern int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst, + ifindex_t *ifindex, struct iovec *message, + int ospf6_sock); #endif /* OSPF6_NETWORK_H */ diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index ff19e3f593..e76ecc85a6 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -3083,16 +3083,15 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, /* Lookup route node. */ rn = srcdest_rnode_lookup(table, p, src_p); if (!rn) { - char src_buf[PREFIX_STRLEN]; - - if (src_p && src_p->prefixlen) - prefix2str(src_p, src_buf, sizeof(src_buf)); - else - src_buf[0] = '\0'; - if (IS_ZEBRA_DEBUG_RIB) { + char src_buf[PREFIX_STRLEN]; struct vrf *vrf = vrf_lookup_by_id(vrf_id); + if (src_p && src_p->prefixlen) + prefix2str(src_p, src_buf, sizeof(src_buf)); + else + src_buf[0] = '\0'; + zlog_debug("%s[%d]:%pFX%s%s doesn't exist in rib", vrf->name, table_id, p, (src_buf[0] != '\0') ? " from " : "", |
