diff options
author | alex.bluesman.smirnov@gmail.com <alex.bluesman.smirnov@gmail.com> | 2012-05-09 23:25:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-10 23:38:22 -0400 |
commit | 06a4c1c55dbe5d9f7a708e8f1a52fd2ac8e5874f (patch) | |
tree | e118ac25a92ffae751709da562b59ea02e242184 /net/ipv6 | |
parent | 76e3cc126bb223013a6b9a0e2a51238d1ef2e409 (diff) |
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: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e3b3421f8da..8b7f100a4b4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <net/sock.h> | 66 | #include <net/sock.h> |
67 | #include <net/snmp.h> | 67 | #include <net/snmp.h> |
68 | 68 | ||
69 | #include <net/af_ieee802154.h> | ||
69 | #include <net/ipv6.h> | 70 | #include <net/ipv6.h> |
70 | #include <net/protocol.h> | 71 | #include <net/protocol.h> |
71 | #include <net/ndisc.h> | 72 | #include <net/ndisc.h> |
@@ -1514,6 +1515,14 @@ static int addrconf_ifid_eui48(u8 *eui, struct net_device *dev) | |||
1514 | return 0; | 1515 | return 0; |
1515 | } | 1516 | } |
1516 | 1517 | ||
1518 | static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev) | ||
1519 | { | ||
1520 | if (dev->addr_len != IEEE802154_ADDR_LEN) | ||
1521 | return -1; | ||
1522 | memcpy(eui, dev->dev_addr, 8); | ||
1523 | return 0; | ||
1524 | } | ||
1525 | |||
1517 | static int addrconf_ifid_arcnet(u8 *eui, struct net_device *dev) | 1526 | static int addrconf_ifid_arcnet(u8 *eui, struct net_device *dev) |
1518 | { | 1527 | { |
1519 | /* XXX: inherit EUI-64 from other interface -- yoshfuji */ | 1528 | /* XXX: inherit EUI-64 from other interface -- yoshfuji */ |
@@ -1577,6 +1586,8 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev) | |||
1577 | return addrconf_ifid_sit(eui, dev); | 1586 | return addrconf_ifid_sit(eui, dev); |
1578 | case ARPHRD_IPGRE: | 1587 | case ARPHRD_IPGRE: |
1579 | return addrconf_ifid_gre(eui, dev); | 1588 | return addrconf_ifid_gre(eui, dev); |
1589 | case ARPHRD_IEEE802154: | ||
1590 | return addrconf_ifid_eui64(eui, dev); | ||
1580 | } | 1591 | } |
1581 | return -1; | 1592 | return -1; |
1582 | } | 1593 | } |
@@ -2438,7 +2449,8 @@ static void addrconf_dev_config(struct net_device *dev) | |||
2438 | (dev->type != ARPHRD_FDDI) && | 2449 | (dev->type != ARPHRD_FDDI) && |
2439 | (dev->type != ARPHRD_IEEE802_TR) && | 2450 | (dev->type != ARPHRD_IEEE802_TR) && |
2440 | (dev->type != ARPHRD_ARCNET) && | 2451 | (dev->type != ARPHRD_ARCNET) && |
2441 | (dev->type != ARPHRD_INFINIBAND)) { | 2452 | (dev->type != ARPHRD_INFINIBAND) && |
2453 | (dev->type != ARPHRD_IEEE802154)) { | ||
2442 | /* Alas, we support only Ethernet autoconfiguration. */ | 2454 | /* Alas, we support only Ethernet autoconfiguration. */ |
2443 | return; | 2455 | return; |
2444 | } | 2456 | } |