Skip to content

Commit

Permalink
Added debug tarce for dropped unsecured and MPL packets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiuskanen committed Nov 10, 2020
1 parent 51cd564 commit a080f18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/Common_Protocols/icmpv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ buffer_t *icmpv6_up(buffer_t *buf)
|| (buf->options.type == ICMPV6_TYPE_INFO_RPL_CONTROL
&& (buf->options.code != ICMPV6_CODE_RPL_DIO
&& buf->options.code != ICMPV6_CODE_RPL_DIS))) {
tr_warn("Drop: ICMP EP unsecured packet");
goto drop;
}
}
Expand Down
3 changes: 3 additions & 0 deletions source/Common_Protocols/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ static buffer_t *ipv6_consider_forwarding_multicast_packet(buffer_t *buf, protoc
{
/* Security checks needed here before forwarding */
if (buf->options.ll_security_bypass_rx) {
tr_warn("Drop: unsecured at forwarding layer");
goto no_forward;
}

Expand Down Expand Up @@ -1272,6 +1273,7 @@ buffer_t *ipv6_forwarding_up(buffer_t *buf)
*/
if (buf->options.ll_security_bypass_rx) {
if (addr_ipv6_scope(buf->dst_sa.address, cur) != IPV6_SCOPE_LINK_LOCAL) {
tr_warn("Drop: unsecured not link local scope packet");
goto drop;
}
}
Expand Down Expand Up @@ -1416,6 +1418,7 @@ buffer_t *ipv6_forwarding_up(buffer_t *buf)
#endif
default: {
if (buf->options.ll_security_bypass_rx) {
tr_warn("Drop: unsecured by BAD Next header %u", *nh_ptr);
goto bad_nh;
}
buffer_socket_set(buf, socket_lookup_ipv6(*nh_ptr, &buf->dst_sa, &buf->src_sa, true));
Expand Down
6 changes: 6 additions & 0 deletions source/MPL/mpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ static mpl_buffered_message_t *mpl_buffer_create(buffer_t *buf, mpl_domain_t *do
uint16_t ip_len = buffer_data_length(buf);

while (mpl_total_buffered + ip_len > MAX_BUFFERED_MESSAGES_SIZE) {
tr_debug("MPL MAX buffered message size limit...free space");
mpl_free_space();
}

Expand All @@ -427,6 +428,7 @@ static mpl_buffered_message_t *mpl_buffer_create(buffer_t *buf, mpl_domain_t *do

mpl_buffered_message_t *message = ns_dyn_mem_alloc(sizeof(mpl_buffered_message_t) + ip_len);
if (!message) {
tr_debug("No heap for new MPL message");
return NULL;
}
memcpy(message->message, buffer_data_pointer(buf), ip_len);
Expand Down Expand Up @@ -475,6 +477,7 @@ static void mpl_buffer_transmit(mpl_domain_t *domain, mpl_buffered_message_t *me
uint16_t ip_len = mpl_buffer_size(message);
buffer_t *buf = buffer_get(ip_len);
if (!buf) {
tr_debug("No heap for MPL transmit");
return;
}

Expand Down Expand Up @@ -939,6 +942,9 @@ bool mpl_forwarder_process_message(buffer_t *buf, mpl_domain_t *domain, bool see
}

message = mpl_buffer_create(buf, domain, seed, sequence, hop_limit);
if (!message) {
tr_debug("MPL Buffer Craete fail");
}

return true;
}
Expand Down

0 comments on commit a080f18

Please sign in to comment.