summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_rib.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2020-01-09 15:50:35 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2020-01-09 15:50:35 +0000
commit488a132d9dce138ccd3c745c2849219f76d7d6a1 (patch)
treea8777c7721e1a1d07cee6f61911d6496ae045524 /usr.sbin/bgpd/rde_rib.c
parent9b36b4d43cd7adc0de1c044300bb2a4777388478 (diff)
Instead of calling SipHash24_Update() in path_hash for each element of
struct rde_aspath define aspath_hashstart and aspath_hashend and update all values in one call. Inspired by struct process and its ps_startcopy. OK deraadt@
Diffstat (limited to 'usr.sbin/bgpd/rde_rib.c')
-rw-r--r--usr.sbin/bgpd/rde_rib.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index 116e55cb531..2df44649e2f 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.212 2020/01/09 11:55:25 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.213 2020/01/09 15:50:34 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -701,12 +701,8 @@ path_hash(struct rde_aspath *asp)
u_int64_t hash;
SipHash24_Init(&ctx, &pathtablekey);
- SipHash24_Update(&ctx, &asp->origin, sizeof(asp->origin));
- SipHash24_Update(&ctx, &asp->med, sizeof(asp->med));
- SipHash24_Update(&ctx, &asp->lpref, sizeof(asp->lpref));
- SipHash24_Update(&ctx, &asp->weight, sizeof(asp->weight));
- SipHash24_Update(&ctx, &asp->rtlabelid, sizeof(asp->rtlabelid));
- SipHash24_Update(&ctx, &asp->pftableid, sizeof(asp->pftableid));
+ SipHash24_Update(&ctx, &asp->aspath_hashstart,
+ (char *)&asp->aspath_hashend - (char *)&asp->aspath_hashstart);
if (asp->aspath)
SipHash24_Update(&ctx, asp->aspath->data, asp->aspath->len);