Commit 06a4c1c5 authored by alex.bluesman.smirnov@gmail.com's avatar alex.bluesman.smirnov@gmail.com Committed by David S. Miller

6lowpan: IPv6 link local address

According to the RFC4944 (Transmission of IPv6 Packets over
IEEE 802.15.4 Networks), chapter 7:

The IPv6 link-local address [RFC4291] for an IEEE 802.15.4 interface
is formed by appending the Interface Identifier, as defined above, to
the prefix FE80::/64.

  10 bits            54 bits                  64 bits
+----------+-----------------------+----------------------------+
|1111111010|         (zeros)       |    Interface Identifier    |
+----------+-----------------------+----------------------------+

This patch adds IPv6 address generation support for the 6lowpan
interfaces.
Signed-off-by: default avatarAlexander Smirnov <alex.bluesman.smirnov@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76e3cc12
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <net/sock.h> #include <net/sock.h>
#include <net/snmp.h> #include <net/snmp.h>
#include <net/af_ieee802154.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/protocol.h> #include <net/protocol.h>
#include <net/ndisc.h> #include <net/ndisc.h>
...@@ -1514,6 +1515,14 @@ static int addrconf_ifid_eui48(u8 *eui, struct net_device *dev) ...@@ -1514,6 +1515,14 @@ static int addrconf_ifid_eui48(u8 *eui, struct net_device *dev)
return 0; return 0;
} }
static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev)
{
if (dev->addr_len != IEEE802154_ADDR_LEN)
return -1;
memcpy(eui, dev->dev_addr, 8);
return 0;
}
static int addrconf_ifid_arcnet(u8 *eui, struct net_device *dev) static int addrconf_ifid_arcnet(u8 *eui, struct net_device *dev)
{ {
/* XXX: inherit EUI-64 from other interface -- yoshfuji */ /* XXX: inherit EUI-64 from other interface -- yoshfuji */
...@@ -1577,6 +1586,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev) ...@@ -1577,6 +1586,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
return addrconf_ifid_sit(eui, dev); return addrconf_ifid_sit(eui, dev);
case ARPHRD_IPGRE: case ARPHRD_IPGRE:
return addrconf_ifid_gre(eui, dev); return addrconf_ifid_gre(eui, dev);
case ARPHRD_IEEE802154:
return addrconf_ifid_eui64(eui, dev);
} }
return -1; return -1;
} }
...@@ -2438,7 +2449,8 @@ static void addrconf_dev_config(struct net_device *dev) ...@@ -2438,7 +2449,8 @@ static void addrconf_dev_config(struct net_device *dev)
(dev->type != ARPHRD_FDDI) && (dev->type != ARPHRD_FDDI) &&
(dev->type != ARPHRD_IEEE802_TR) && (dev->type != ARPHRD_IEEE802_TR) &&
(dev->type != ARPHRD_ARCNET) && (dev->type != ARPHRD_ARCNET) &&
(dev->type != ARPHRD_INFINIBAND)) { (dev->type != ARPHRD_INFINIBAND) &&
(dev->type != ARPHRD_IEEE802154)) {
/* Alas, we support only Ethernet autoconfiguration. */ /* Alas, we support only Ethernet autoconfiguration. */
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment