Skip to content

Commit

Permalink
removed ccnl_addr2ascii calls containing NULL
Browse files Browse the repository at this point in the history
This commit remove calls to ccnl_addr2ascii which are passed to the
DEBUGMSG macro and could have "NULL" as a parameter, e.g.

     DEBUGMSG_CFWD(INFO, "  incoming interest=<%s>%s nonce=%"PRIi32" from=%s\n",
                   ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
                   ccnl_suite2str((*pkt)->suite), nonce,
                   ccnl_addr2ascii(from ? &from->peer : NULL));
  • Loading branch information
mfrey committed May 8, 2018
1 parent 03040ad commit 81811bc
Showing 1 changed file with 45 additions and 21 deletions.
66 changes: 45 additions & 21 deletions src/ccnl-fwd/src/ccnl-fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,36 @@ ccnl_fwd_handleContent(struct ccnl_relay_s *relay, struct ccnl_face_s *from,
}
}

DEBUGMSG_CFWD(INFO, " incoming data=<%s>%s (nfnflags=%d) nonce=%i from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
ccnl_suite2str((*pkt)->suite),
(*pkt)->pfx->nfnflags, nonce,
ccnl_addr2ascii(from ? &from->peer : NULL));
if (from) {
char *from_as_str = ccnl_addr2ascii(&(from->peer));

if (from_as_str) {
DEBUGMSG_CFWD(INFO, " incoming data=<%s>%s (nfnflags=%d) nonce=%i from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE), ccnl_suite2str((*pkt)->suite),
(*pkt)->pfx->nfnflags, nonce, from_as_str ? from_as_str : "");
}
} else {
DEBUGMSG_CFWD(INFO, " incoming data=<%s>%s (nfnflags=%d) nonce=%i from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE), ccnl_suite2str((*pkt)->suite),
(*pkt)->pfx->nfnflags, nonce, "");

}

DEBUGMSG_CFWD(INFO, " data %.*s\n", (*pkt)->contlen, (*pkt)->content);
#else
DEBUGMSG_CFWD(INFO, " incoming data=<%s>%s from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
ccnl_suite2str((*pkt)->suite),
ccnl_addr2ascii(from ? &from->peer : NULL));
if (from) {
char *from_as_str = ccnl_addr2ascii(&(from->peer));

if (from_as_str) {
DEBUGMSG_CFWD(INFO, " incoming data=<%s>%s from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE), ccnl_suite2str((*pkt)->suite),
from_as_str ? from_as_str : "");
}
} else {
DEBUGMSG_CFWD(INFO, " incoming data=<%s>%s from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE), ccnl_suite2str((*pkt)->suite), "");

}
#endif

#if defined(USE_SUITE_CCNB) && defined(USE_SIGNATURES)
Expand Down Expand Up @@ -183,9 +202,12 @@ ccnl_fwd_handleFragment(struct ccnl_relay_s *relay, struct ccnl_face_s *from,
unsigned char *data = (*pkt)->content;
int datalen = (*pkt)->contlen;

DEBUGMSG_CFWD(INFO, " incoming fragment (%zd bytes) from=%s\n",
(*pkt)->buf->datalen,
ccnl_addr2ascii(from ? &from->peer : NULL));
if (from) {
char *from_as_str = ccnl_addr2ascii(&(from->peer));

DEBUGMSG_CFWD(INFO, " incoming fragment (%zd bytes) from=%s\n",
(*pkt)->buf->datalen, from_as_str ? from_as_str : "");
}

ccnl_frag_RX_BeginEnd2015(callback, relay, from,
relay->ifs[from->ifndx].mtu,
Expand Down Expand Up @@ -231,18 +253,20 @@ ccnl_fwd_handleInterest(struct ccnl_relay_s *relay, struct ccnl_face_s *from,
}
}


if (from) {
char *from_as_str = ccnl_addr2ascii(&(from->peer));
#ifndef CCNL_LINUXKERNEL
DEBUGMSG_CFWD(INFO, " incoming interest=<%s>%s nonce=%"PRIi32" from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
ccnl_suite2str((*pkt)->suite), nonce,
ccnl_addr2ascii(from ? &from->peer : NULL));
DEBUGMSG_CFWD(INFO, " incoming interest=<%s>%s nonce=%"PRIi32" from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
ccnl_suite2str((*pkt)->suite), nonce,
from_as_str ? from_as_str : "");
#else
DEBUGMSG_CFWD(INFO, " incoming interest=<%s>%s nonce=%d from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
ccnl_suite2str((*pkt)->suite), nonce,
ccnl_addr2ascii(from ? &from->peer : NULL));
DEBUGMSG_CFWD(INFO, " incoming interest=<%s>%s nonce=%d from=%s\n",
ccnl_prefix_to_str((*pkt)->pfx,s,CCNL_MAX_PREFIX_SIZE),
ccnl_suite2str((*pkt)->suite), nonce,
from_as_str ? from_as_str : "");
#endif
}

#ifdef USE_DUP_CHECK

Expand Down

0 comments on commit 81811bc

Please sign in to comment.