Skip to content

Fix IID when using CONFIG_NET_L2_BLUETOOTH_ZEP1656 #3518

@zephyrbot

Description

@zephyrbot

Reported by guiwu guo:

In subsys/net/ip/l2/bluetooth.c ipsp_connected

{code:java}
static void ipsp_connected(struct bt_l2cap_chan *chan)
{
......

ll.addr = ctxt->dst.val;
ll.len = sizeof(ctxt->dst.val);

/* Add remote link-local address to the nbr cache to avoid sending ns:
 * https://tools.ietf.org/html/rfc7668#section-3.2.3
 * A Bluetooth LE 6LN MUST NOT register its link-local address.
 */
net_ipv6_addr_create_iid(&in6, &ll);
net_ipv6_nbr_add(ctxt->iface, &in6, &ll, false,
		 NET_IPV6_NBR_STATE_REACHABLE);
    ......

}
{code}
forget set the link type, so that it will set a wrong iid in the net_ipv6_addr_create_iid function

{code:java}
static inline void net_ipv6_addr_create_iid(struct in6_addr *addr,
struct net_linkaddr *lladdr)
{
...

#if defined(CONFIG_NET_L2_BLUETOOTH_ZEP1656)
/* Workaround against older Linux kernel BT IPSP code.
* This will be removed eventually.
*/
if (lladdr->type == NET_LINK_BLUETOOTH) {
addr->s6_addr[8] ^= 0x02;
}
#endif

	if (lladdr->type == NET_LINK_ETHERNET) {
		addr->s6_addr[8] ^= 0x02;
	}

    ...

}
{code}

(Imported from Jira ZEP-2077)

Metadata

Metadata

Assignees

Labels

area: NetworkingbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions