]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
6lowpan: ndisc: set invalid unicast short addr to unspec
authorAlexander Aring <aar@pengutronix.de>
Wed, 6 Jul 2016 21:32:28 +0000 (23:32 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 8 Jul 2016 11:23:12 +0000 (13:23 +0200)
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>
net/6lowpan/ndisc.c

index 79c5fa9665fc38b972f3f394c270809556ab1526..86450b7e2899377b3f5d6bc5aa41a54639c4dffc 100644 (file)
@@ -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);
 }