|
43 | 43 | #ifdef HAVE_RPL |
44 | 44 | #include "RPL/rpl_data.h" |
45 | 45 | #endif |
46 | | -#include "6LoWPAN/ws/ws_common.h" |
47 | 46 | #include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h" |
48 | 47 | #include "6LoWPAN/Thread/thread_common.h" |
49 | 48 | #include "6LoWPAN/ws/ws_common.h" |
@@ -613,40 +612,35 @@ buffer_t * lowpan_adaptation_data_process_tx_preprocess(protocol_interface_info_ |
613 | 612 | { |
614 | 613 | mac_neighbor_table_entry_t *neigh_entry_ptr = NULL; |
615 | 614 |
|
| 615 | + |
616 | 616 | //Validate is link known and set indirect, datareq and security key id mode |
617 | 617 | if (buf->dst_sa.addr_type == ADDR_NONE) { |
618 | 618 | goto tx_error_handler; |
619 | 619 | } |
620 | 620 |
|
621 | | - /* If MLE is enabled, we will talk if we have an MLE association */ |
622 | | - if (buf->dst_sa.addr_type == ADDR_802_15_4_LONG ) { |
623 | | - neigh_entry_ptr = mac_neighbor_table_address_discover(mac_neighbor_info(cur), buf->dst_sa.address + 2, buf->dst_sa.addr_type); |
| 621 | + if (addr_check_broadcast(buf->dst_sa.address, buf->dst_sa.addr_type) == eOK ) { |
| 622 | + buf->dst_sa.addr_type = ADDR_802_15_4_SHORT; |
| 623 | + buf->dst_sa.address[2] = 0xff; |
| 624 | + buf->dst_sa.address[3] = 0xff; |
| 625 | + buf->link_specific.ieee802_15_4.indirectTxProcess = false; |
| 626 | + buf->link_specific.ieee802_15_4.requestAck = false; |
| 627 | + } else { |
624 | 628 |
|
625 | | - } else if(buf->dst_sa.addr_type == ADDR_802_15_4_SHORT && (common_read_16_bit(buf->dst_sa.address + 2)) != 0xffff) { |
626 | 629 | neigh_entry_ptr = mac_neighbor_table_address_discover(mac_neighbor_info(cur), buf->dst_sa.address + 2, buf->dst_sa.addr_type); |
627 | | - } |
628 | 630 |
|
629 | | - //Validate neighbour |
630 | | - if (!buf->options.ll_security_bypass_tx && neigh_entry_ptr) { |
| 631 | + //Validate neighbour |
| 632 | + if (!buf->options.ll_security_bypass_tx && neigh_entry_ptr) { |
631 | 633 |
|
632 | | - if (neigh_entry_ptr->connected_device || neigh_entry_ptr->trusted_device) { |
| 634 | + if (neigh_entry_ptr->connected_device || neigh_entry_ptr->trusted_device) { |
633 | 635 |
|
634 | | - } else { |
635 | | - //tr_warn("Drop TX to unassociated %s", trace_sockaddr(&buf->dst_sa, true)); |
| 636 | + } else { |
| 637 | + //tr_warn("Drop TX to unassociated %s", trace_sockaddr(&buf->dst_sa, true)); |
| 638 | + goto tx_error_handler; |
| 639 | + } |
| 640 | + } else if (ws_info(cur) && !neigh_entry_ptr) { |
| 641 | + //Do not accept to send unknow device |
636 | 642 | goto tx_error_handler; |
637 | 643 | } |
638 | | - } |
639 | | - |
640 | | - //Check indirect |
641 | | - |
642 | | - |
643 | | - if (addr_check_broadcast(buf->dst_sa.address, buf->dst_sa.addr_type) == eOK) { |
644 | | - buf->dst_sa.addr_type = ADDR_802_15_4_SHORT; |
645 | | - buf->dst_sa.address[2] = 0xff; |
646 | | - buf->dst_sa.address[3] = 0xff; |
647 | | - buf->link_specific.ieee802_15_4.indirectTxProcess = false; |
648 | | - buf->link_specific.ieee802_15_4.requestAck = false; |
649 | | - } else { |
650 | 644 | buf->link_specific.ieee802_15_4.requestAck = true; |
651 | 645 | buf->link_specific.ieee802_15_4.indirectTxProcess = lowpan_adaptation_indirect_data_request(neigh_entry_ptr); |
652 | 646 | } |
|
0 commit comments