Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Aring and committed by
Marcel Holtmann
9e262f50 aaa7088e

+5 -2
+5 -2
net/6lowpan/ndisc.c
··· 97 97 } 98 98 99 99 write_lock_bh(&n->lock); 100 - if (lladdr_short) 100 + if (lladdr_short) { 101 101 ieee802154_be16_to_le16(&neigh->short_addr, lladdr_short); 102 - else 102 + if (!lowpan_802154_is_valid_src_short_addr(neigh->short_addr)) 103 + neigh->short_addr = cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC); 104 + } else { 103 105 neigh->short_addr = cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC); 106 + } 104 107 write_unlock_bh(&n->lock); 105 108 } 106 109