Merge pull request #7376 from mjstapp/fix_pim_align

pimd: Fix pim address-of-unaligned error and use of zlog_warn
This commit is contained in:
Quentin Young 2020-10-26 16:24:00 -04:00 committed by GitHub
commit d878460c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,10 +82,10 @@ static bool mtrace_fwd_info_weak(struct pim_instance *pim,
zlog_debug("mtrace pim_nexthop_lookup OK");
if (PIM_DEBUG_MTRACE)
zlog_warn("mtrace next_hop=%s",
inet_ntop(nexthop.mrib_nexthop_addr.family,
&nexthop.mrib_nexthop_addr.u.prefix,
nexthop_str, sizeof(nexthop_str)));
zlog_debug("mtrace next_hop=%s",
inet_ntop(nexthop.mrib_nexthop_addr.family,
&nexthop.mrib_nexthop_addr.u.prefix,
nexthop_str, sizeof(nexthop_str)));
if (nexthop.mrib_nexthop_addr.family == AF_INET)
nh_addr = nexthop.mrib_nexthop_addr.u.prefix4;
@ -270,8 +270,8 @@ static uint32_t query_arrival_time(void)
if (gettimeofday(&tv, NULL) < 0) {
if (PIM_DEBUG_MTRACE)
zlog_warn("Query arrival time lookup failed: errno=%d: %s",
errno, safe_strerror(errno));
zlog_debug("Query arrival time lookup failed: errno=%d: %s",
errno, safe_strerror(errno));
return 0;
}
/* not sure second offset correct, as I get different value */
@ -336,7 +336,7 @@ static int mtrace_send_packet(struct interface *ifp,
if (ret < 0) {
if (PIM_DEBUG_MTRACE)
zlog_warn("Failed to set socket multicast TTL");
zlog_debug("Failed to set socket multicast TTL");
ret = -1;
goto close_fd;
}
@ -354,14 +354,14 @@ static int mtrace_send_packet(struct interface *ifp,
sizeof(group_str));
if (sent < 0) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Send mtrace request failed for %s on%s: group=%s msg_size=%zd: errno=%d: %s",
dst_str, ifp->name, group_str,
mtrace_buf_len, errno,
safe_strerror(errno));
} else {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Send mtrace request failed for %s on %s: group=%s msg_size=%zd: sent=%zd",
dst_str, ifp->name, group_str,
mtrace_buf_len, sent);
@ -411,7 +411,7 @@ static int mtrace_un_forward_packet(struct pim_instance *pim, struct ip *ip_hdr,
if (!pim_nexthop_lookup(pim, &nexthop, ip_hdr->ip_dst, 0)) {
close(fd);
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Dropping mtrace packet, no route to destination");
return -1;
}
@ -440,7 +440,7 @@ static int mtrace_un_forward_packet(struct pim_instance *pim, struct ip *ip_hdr,
if (sent < 0) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Failed to forward mtrace packet: sendto errno=%d, %s",
errno, safe_strerror(errno));
return -1;
@ -514,6 +514,7 @@ static int mtrace_send_mc_response(struct pim_instance *pim,
struct listnode *chnextnode;
struct pim_ifchannel *ch = NULL;
int ret = -1;
char buf[PREFIX_STRLEN];
memset(&sg, 0, sizeof(struct prefix_sg));
sg.grp = mtracep->rsp_addr;
@ -523,9 +524,10 @@ static int mtrace_send_mc_response(struct pim_instance *pim,
if (c_oil == NULL) {
if (PIM_DEBUG_MTRACE) {
zlog_debug(
"Dropping mtrace multicast response packet len=%u to %pI4",
"Dropping mtrace multicast response packet len=%u to %s",
(unsigned int)mtrace_len,
&mtracep->rsp_addr);
inet_ntop(AF_INET, &mtracep->rsp_addr,
buf, sizeof(buf)));
}
return -1;
}
@ -570,10 +572,10 @@ static int mtrace_send_response(struct pim_instance *pim,
if (p_rpf == NULL) {
if (PIM_DEBUG_MTRACE)
zlog_warn("mtrace no RP for %s",
inet_ntop(AF_INET,
&(mtracep->rsp_addr),
grp_str, sizeof(grp_str)));
zlog_debug("mtrace no RP for %s",
inet_ntop(AF_INET,
&(mtracep->rsp_addr),
grp_str, sizeof(grp_str)));
return -1;
}
nexthop = p_rpf->source_nexthop;
@ -584,7 +586,7 @@ static int mtrace_send_response(struct pim_instance *pim,
/* TODO: should use unicast rib lookup */
if (!pim_nexthop_lookup(pim, &nexthop, mtracep->rsp_addr, 1)) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Dropped response qid=%ud, no route to response address",
mtracep->qry_id);
return -1;
@ -633,7 +635,7 @@ int igmp_mtrace_recv_qry_req(struct igmp_sock *igmp, struct ip *ip_hdr,
if (igmp_msg_len < (int)sizeof(struct igmp_mtrace)) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Recv mtrace packet from %s on %s: too short, len=%d, min=%zu",
from_str, ifp->name, igmp_msg_len,
sizeof(struct igmp_mtrace));
@ -650,7 +652,7 @@ int igmp_mtrace_recv_qry_req(struct igmp_sock *igmp, struct ip *ip_hdr,
if (recv_checksum != checksum) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Recv mtrace packet from %s on %s: checksum mismatch: received=%x computed=%x",
from_str, ifp->name, recv_checksum, checksum);
return -1;
@ -700,12 +702,12 @@ int igmp_mtrace_recv_qry_req(struct igmp_sock *igmp, struct ip *ip_hdr,
last_rsp_ind = r_len / sizeof(struct igmp_mtrace_rsp);
if (last_rsp_ind > MTRACE_MAX_HOPS) {
if (PIM_DEBUG_MTRACE)
zlog_warn("Mtrace request of excessive size");
zlog_debug("Mtrace request of excessive size");
return -1;
}
} else {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Recv mtrace packet from %s on %s: invalid length %d",
from_str, ifp->name, igmp_msg_len);
return -1;
@ -715,7 +717,7 @@ int igmp_mtrace_recv_qry_req(struct igmp_sock *igmp, struct ip *ip_hdr,
if (IPV4_CLASS_DE(ntohl(ip_hdr->ip_dst.s_addr))
&& !IPV4_MC_LINKLOCAL(ntohl(ip_hdr->ip_dst.s_addr))) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Recv mtrace packet from %s on %s: not link-local multicast %pI4",
from_str, ifp->name, &ip_hdr->ip_dst);
return -1;
@ -848,7 +850,7 @@ int igmp_mtrace_recv_response(struct igmp_sock *igmp, struct ip *ip_hdr,
if (igmp_msg_len < (int)sizeof(struct igmp_mtrace)) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Recv mtrace packet from %s on %s: too short, len=%d, min=%zu",
from_str, ifp->name, igmp_msg_len,
sizeof(struct igmp_mtrace));
@ -865,7 +867,7 @@ int igmp_mtrace_recv_response(struct igmp_sock *igmp, struct ip *ip_hdr,
if (recv_checksum != checksum) {
if (PIM_DEBUG_MTRACE)
zlog_warn(
zlog_debug(
"Recv mtrace response from %s on %s: checksum mismatch: received=%x computed=%x",
from_str, ifp->name, recv_checksum, checksum);
return -1;