diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-07-11 19:05:42 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-07-11 19:05:42 +0000 |
commit | 10cff0a21c07feb3129bd15f00d3947ca4832977 (patch) | |
tree | 205537d071cbfebdbbff2acb69638088c4b79afa /usr.sbin/bgpd/rde.h | |
parent | 03059594d64f77ef3546db846da55bd7451921ca (diff) |
improve the path hash function (instead of just hashing the aspath put
most other attrs into the hash as well). At the same time use the full
64 bit of SipHash in various places.
Tested by and OK benno@ phessler@
Diffstat (limited to 'usr.sbin/bgpd/rde.h')
-rw-r--r-- | usr.sbin/bgpd/rde.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index 80dd6005336..54e6395f0a0 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.177 2018/07/11 16:34:36 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.178 2018/07/11 19:05:41 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and @@ -140,8 +140,8 @@ enum attrtypes { struct attr { LIST_ENTRY(attr) entry; u_char *data; + u_int64_t hash; int refcnt; - u_int32_t hash; u_int16_t len; u_int8_t flags; u_int8_t type; @@ -154,11 +154,6 @@ struct mpattr { u_int16_t unreach_len; }; -struct path_table { - struct aspath_head *path_hashtbl; - u_int32_t path_hashmask; -}; - #define F_ATTR_ORIGIN 0x00001 #define F_ATTR_ASPATH 0x00002 #define F_ATTR_NEXTHOP 0x00004 @@ -195,10 +190,11 @@ struct rde_aspath { struct rde_peer *peer; struct aspath *aspath; struct nexthop *nexthop; /* may be NULL */ + u_int64_t hash; + u_int32_t flags; /* internally used */ u_int32_t med; /* multi exit disc */ u_int32_t lpref; /* local pref */ u_int32_t weight; /* low prio lpref */ - u_int32_t flags; /* internally used */ u_int16_t rtlabelid; /* route label id */ u_int16_t pftableid; /* pf table id */ u_int8_t origin; @@ -358,6 +354,7 @@ int attr_optadd(struct rde_aspath *, u_int8_t, u_int8_t, struct attr *attr_optget(const struct rde_aspath *, u_int8_t); void attr_copy(struct rde_aspath *, const struct rde_aspath *); int attr_compare(struct rde_aspath *, struct rde_aspath *); +u_int64_t attr_hash(struct rde_aspath *); void attr_freeall(struct rde_aspath *); void attr_free(struct rde_aspath *, struct attr *); #define attr_optlen(x) \ |