net: bt: Fix not checking for valid ll addresses
ll addresses need to be set properly before sending as the stack is not checking if they are NULL. Change-Id: Ia4e96240f18b53b0e32e21649a8b571c94260731 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
02b104dae8
commit
2e9fd888bf
@ -32,6 +32,8 @@
|
||||
#include <bluetooth/uuid.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
|
||||
#include "ipv6.h"
|
||||
|
||||
#define L2CAP_IPSP_PSM 0x0023
|
||||
#define L2CAP_IPSP_MTU 1280
|
||||
|
||||
@ -85,6 +87,27 @@ static enum net_verdict net_bt_send(struct net_if *iface, struct net_buf *buf)
|
||||
return NET_DROP;
|
||||
}
|
||||
|
||||
/* TODO: Move ll address check to the stack */
|
||||
|
||||
/* If the ll address is not set at all, then we must set
|
||||
* it here.
|
||||
*/
|
||||
if (!net_nbuf_ll_src(buf)->addr) {
|
||||
net_nbuf_ll_src(buf)->addr = net_nbuf_ll_if(buf)->addr;
|
||||
net_nbuf_ll_src(buf)->len = net_nbuf_ll_if(buf)->len;
|
||||
}
|
||||
|
||||
/* If the ll dst address is not set check if it is present in the nbr
|
||||
* cache.
|
||||
*/
|
||||
if (!net_nbuf_ll_dst(buf)->addr &&
|
||||
!net_is_ipv6_addr_mcast(&NET_IPV6_BUF(buf)->dst)) {
|
||||
buf = net_ipv6_prepare_for_send(buf);
|
||||
if (!buf) {
|
||||
return NET_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!net_6lo_compress(buf, true, NULL)) {
|
||||
NET_DBG("Packet compression failed");
|
||||
return NET_DROP;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user