提交 b2799cec 编写于 作者: J Jukka Rissanen 提交者: Marcel Holtmann

Bluetooth: 6lowpan: Set the peer IPv6 address correctly

The peer IPv6 address contained wrong U/L bit in the EUI-64 part.
Signed-off-by: NJukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.17.x
上级 2ae50d8d
...@@ -671,6 +671,14 @@ static struct l2cap_chan *chan_open(struct l2cap_chan *pchan) ...@@ -671,6 +671,14 @@ static struct l2cap_chan *chan_open(struct l2cap_chan *pchan)
return chan; return chan;
} }
static void set_ip_addr_bits(u8 addr_type, u8 *addr)
{
if (addr_type == BDADDR_LE_PUBLIC)
*addr |= 0x02;
else
*addr &= ~0x02;
}
static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan,
struct lowpan_dev *dev) struct lowpan_dev *dev)
{ {
...@@ -693,6 +701,11 @@ static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, ...@@ -693,6 +701,11 @@ static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan,
memcpy(&peer->eui64_addr, (u8 *)&peer->peer_addr.s6_addr + 8, memcpy(&peer->eui64_addr, (u8 *)&peer->peer_addr.s6_addr + 8,
EUI64_ADDR_LEN); EUI64_ADDR_LEN);
/* IPv6 address needs to have the U/L bit set properly so toggle
* it back here.
*/
set_ip_addr_bits(chan->dst_type, (u8 *)&peer->peer_addr.s6_addr + 8);
write_lock_irqsave(&devices_lock, flags); write_lock_irqsave(&devices_lock, flags);
INIT_LIST_HEAD(&peer->list); INIT_LIST_HEAD(&peer->list);
peer_add(dev, peer); peer_add(dev, peer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册