diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2014-09-08 05:11:44 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-09-09 09:51:47 -0400 |
commit | b2799cec22812f5f1aaaa57133df51876f685d84 (patch) | |
tree | bc356fec0af7f0e52297c15d5ba1fb9342bcd00b /net/bluetooth/6lowpan.c | |
parent | 2ae50d8d3aaf7154f72b44331b71f15799cdc1bb (diff) |
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: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.17.x
Diffstat (limited to 'net/bluetooth/6lowpan.c')
-rw-r--r-- | net/bluetooth/6lowpan.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 5532e6e804f0..b229aed3bf9a 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c | |||
@@ -671,6 +671,14 @@ static struct l2cap_chan *chan_open(struct l2cap_chan *pchan) | |||
671 | return chan; | 671 | return chan; |
672 | } | 672 | } |
673 | 673 | ||
674 | static void set_ip_addr_bits(u8 addr_type, u8 *addr) | ||
675 | { | ||
676 | if (addr_type == BDADDR_LE_PUBLIC) | ||
677 | *addr |= 0x02; | ||
678 | else | ||
679 | *addr &= ~0x02; | ||
680 | } | ||
681 | |||
674 | static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, | 682 | static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, |
675 | struct lowpan_dev *dev) | 683 | struct lowpan_dev *dev) |
676 | { | 684 | { |
@@ -693,6 +701,11 @@ static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan, | |||
693 | memcpy(&peer->eui64_addr, (u8 *)&peer->peer_addr.s6_addr + 8, | 701 | memcpy(&peer->eui64_addr, (u8 *)&peer->peer_addr.s6_addr + 8, |
694 | EUI64_ADDR_LEN); | 702 | EUI64_ADDR_LEN); |
695 | 703 | ||
704 | /* IPv6 address needs to have the U/L bit set properly so toggle | ||
705 | * it back here. | ||
706 | */ | ||
707 | set_ip_addr_bits(chan->dst_type, (u8 *)&peer->peer_addr.s6_addr + 8); | ||
708 | |||
696 | write_lock_irqsave(&devices_lock, flags); | 709 | write_lock_irqsave(&devices_lock, flags); |
697 | INIT_LIST_HEAD(&peer->list); | 710 | INIT_LIST_HEAD(&peer->list); |
698 | peer_add(dev, peer); | 711 | peer_add(dev, peer); |