summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-07-06 23:32:28 +0200
committerMarcel Holtmann <marcel@holtmann.org>2016-07-08 13:23:12 +0200
commit9e262f5037b95a9ccc508debec2715e70559cc81 (patch)
treee7625467a4a6f7fe4da5e77dffd1054de1adc642 /net
parentaaa7088eb29a0ffe6cf8d8a443695df41e5a62f3 (diff)
downloadlinux-9e262f5037b95a9ccc508debec2715e70559cc81.tar.gz
linux-9e262f5037b95a9ccc508debec2715e70559cc81.tar.bz2
linux-9e262f5037b95a9ccc508debec2715e70559cc81.zip
6lowpan: ndisc: set invalid unicast short addr to unspec
When receiving neighbour information with short address option field we should check the complete range of invalid short addresses and set it to one invalid address setting which is the unspecified address. This address is also used when by creating at first a new neighbour entry to indicate no short address is set. Signed-off-by: Alexander Aring <aar@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/6lowpan/ndisc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/6lowpan/ndisc.c b/net/6lowpan/ndisc.c
index 79c5fa9665fc..86450b7e2899 100644
--- a/net/6lowpan/ndisc.c
+++ b/net/6lowpan/ndisc.c
@@ -97,10 +97,13 @@ static void lowpan_ndisc_802154_update(struct neighbour *n, u32 flags,
}
write_lock_bh(&n->lock);
- if (lladdr_short)
+ if (lladdr_short) {
ieee802154_be16_to_le16(&neigh->short_addr, lladdr_short);
- else
+ if (!lowpan_802154_is_valid_src_short_addr(neigh->short_addr))
+ neigh->short_addr = cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC);
+ } else {
neigh->short_addr = cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC);
+ }
write_unlock_bh(&n->lock);
}