summaryrefslogtreecommitdiff
path: root/sys/net/toeplitz.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2021-02-21 02:37:39 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2021-02-21 02:37:39 +0000
commit2fc295dcf7aa1e37ae43c658bd318960d3a7ace8 (patch)
treed59dbdfa519ca5c8d4de21e8a72da91ef1761904 /sys/net/toeplitz.c
parentfffc40b687d31413f7bffc195b235b72d4892db8 (diff)
add stoeplitz_eaddr, for getting a hash value from an ethernet address.
Diffstat (limited to 'sys/net/toeplitz.c')
-rw-r--r--sys/net/toeplitz.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/net/toeplitz.c b/sys/net/toeplitz.c
index ab4b19f8d2d..665d334f5d8 100644
--- a/sys/net/toeplitz.c
+++ b/sys/net/toeplitz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: toeplitz.c,v 1.9 2020/09/01 19:18:26 tb Exp $ */
+/* $OpenBSD: toeplitz.c,v 1.10 2021/02/21 02:37:38 dlg Exp $ */
/*
* Copyright (c) 2009 The DragonFly Project. All rights reserved.
@@ -187,6 +187,15 @@ stoeplitz_hash_ip6port(const struct stoeplitz_cache *scache,
}
#endif /* INET6 */
+uint16_t
+stoeplitz_hash_eaddr(const struct stoeplitz_cache *scache,
+ const uint8_t ea[static 6])
+{
+ const uint16_t *ea16 = (const uint16_t *)ea;
+
+ return (stoeplitz_hash_n16(scache, ea16[0] ^ ea16[1] ^ ea16[2]));
+}
+
void
stoeplitz_to_key(void *key, size_t klen)
{