summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/addrconf.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 1aeb25dd42a7..2452e6449532 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -103,12 +103,24 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
u32 addr_flags, bool sllao, bool tokenized,
__u32 valid_lft, u32 prefered_lft);
+static inline void addrconf_addr_eui48_base(u8 *eui, const char *const addr)
+{
+ memcpy(eui, addr, 3);
+ eui[3] = 0xFF;
+ eui[4] = 0xFE;
+ memcpy(eui + 5, addr + 3, 3);
+}
+
+static inline void addrconf_addr_eui48(u8 *eui, const char *const addr)
+{
+ addrconf_addr_eui48_base(eui, addr);
+ eui[0] ^= 2;
+}
+
static inline int addrconf_ifid_eui48(u8 *eui, struct net_device *dev)
{
if (dev->addr_len != ETH_ALEN)
return -1;
- memcpy(eui, dev->dev_addr, 3);
- memcpy(eui + 5, dev->dev_addr + 3, 3);
/*
* The zSeries OSA network cards can be shared among various
@@ -123,14 +135,16 @@ static inline int addrconf_ifid_eui48(u8 *eui, struct net_device *dev)
* case. Hence the resulting interface identifier has local
* scope according to RFC2373.
*/
+
+ addrconf_addr_eui48_base(eui, dev->dev_addr);
+
if (dev->dev_id) {
eui[3] = (dev->dev_id >> 8) & 0xFF;
eui[4] = dev->dev_id & 0xFF;
} else {
- eui[3] = 0xFF;
- eui[4] = 0xFE;
eui[0] ^= 2;
}
+
return 0;
}