aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2016-01-26 14:36:16 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2016-01-26 14:36:16 +0000
commite6ef991e5eda83debca8363ac5dca58df4d795c4 (patch)
tree16c1da9f26131a743676325354eb9c8496293d19 /sys/compat
parent8f9bf0d66165c109f766136e0bce4b9113fb7a2d (diff)
Notes
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/etherdevice.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
index c7a6ebead341..70e5f64581b1 100644
--- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
@@ -29,6 +29,9 @@
#include <linux/types.h>
+#include <sys/random.h>
+#include <sys/libkern.h>
+
#define ETH_MODULE_SFF_8079 1
#define ETH_MODULE_SFF_8079_LEN 256
#define ETH_MODULE_SFF_8472 2
@@ -78,4 +81,25 @@ ether_addr_copy(u8 * dst, const u8 * src)
memcpy(dst, src, 6);
}
+static inline bool
+ether_addr_equal(const u8 *pa, const u8 *pb)
+{
+ return (memcmp(pa, pb, 6) == 0);
+}
+
+static inline bool
+ether_addr_equal_64bits(const u8 *pa, const u8 *pb)
+{
+ return (memcmp(pa, pb, 6) == 0);
+}
+
+static inline void
+random_ether_addr(u8 * dst)
+{
+ read_random(dst, 6);
+
+ dst[0] &= 0xfe;
+ dst[0] |= 0x02;
+}
+
#endif /* _LINUX_ETHERDEVICE */