summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.h
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2017-01-24 23:38:13 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2017-01-24 23:38:13 +0000
commite080f3b49a8f2c7098c1cc17d85a2976c8829c78 (patch)
treec5270a60d748162e763d9f00fda5c0e1e283a7a2 /usr.sbin/bgpd/rde.h
parent96a69d3b71c71985b01a8ca718b96cb2bad1d6f8 (diff)
Save some space in struct rib_entry so it is back to 64bytes (on 64bit archs).
Doing this by folding the lock flag into a pointer and providing an accessor function for the rib pointer. This is an acceptable middle path for this important structure. OK benno@ on an earlier version
Diffstat (limited to 'usr.sbin/bgpd/rde.h')
-rw-r--r--usr.sbin/bgpd/rde.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h
index 867f6b28370..d2228b6808a 100644
--- a/usr.sbin/bgpd/rde.h
+++ b/usr.sbin/bgpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.157 2017/01/23 22:53:52 claudio Exp $ */
+/* $OpenBSD: rde.h,v 1.158 2017/01/24 23:38:12 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/tree.h>
+#include <stdint.h>
#include "bgpd.h"
@@ -280,10 +281,9 @@ struct rib_context {
struct rib_entry {
RB_ENTRY(rib_entry) rib_e;
struct prefix_head prefix_h;
- struct prefix *active; /* for fast access */
+ struct prefix *active; /* for fast access */
struct pt_entry *prefix;
- struct rib *rib;
- u_int16_t flags;
+ struct rib *__rib; /* mangled pointer with flags */
};
struct rib {
@@ -438,6 +438,13 @@ void rib_dump_r(struct rib_context *);
void rib_dump_runner(void);
int rib_dump_pending(void);
+static inline struct rib *
+re_rib(struct rib_entry *re)
+{
+ return (struct rib *)((intptr_t)re->__rib & ~1);
+}
+
+void path_init(u_int32_t);
void path_init(u_int32_t);
void path_shutdown(void);
int path_update(struct rib *, struct rde_peer *,