-/* $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.
}
#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)
{
-/* $OpenBSD: toeplitz.h,v 1.3 2020/06/19 08:48:15 dlg Exp $ */
+/* $OpenBSD: toeplitz.h,v 1.4 2021/02/21 02:37:38 dlg Exp $ */
/*
* Copyright (c) 2019 David Gwynne <dlg@openbsd.org>
uint16_t, uint16_t);
#endif
+uint16_t stoeplitz_hash_eaddr(const struct stoeplitz_cache *,
+ const uint8_t [static 6]);
+
/* hash a uint16_t in network byte order */
static __unused inline uint16_t
stoeplitz_hash_n16(const struct stoeplitz_cache *scache, uint16_t n16)
#define stoeplitz_ip6port(_sa6, _da6, _sp, _dp) \
stoeplitz_hash_ip6port(stoeplitz_cache, (_sa6), (_da6), (_sp), (_dp))
#endif
+#define stoeplitz_eaddr(_ea) \
+ stoeplitz_hash_eaddr(stoeplitz_cache, (_ea))
#endif /* _SYS_NET_TOEPLITZ_H_ */