From 7126cadf80fce1af2bb4aa33f8bcb7c6b5ff1a47 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Tue, 7 Mar 2017 18:42:41 +0100 Subject: Static: Minor overhaul The patch fixes several bugs introduced in previous changes, simplifies the protocol by handing routes uniformly, introduces asynchronous route processing to avoid issues with separate notifications for each next-hop in ECMP routes, and makes reconfiguration faster by avoiding quadratic complexity. --- lib/buffer.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/buffer.h') diff --git a/lib/buffer.h b/lib/buffer.h index a8b11951..6fc18852 100644 --- a/lib/buffer.h +++ b/lib/buffer.h @@ -14,7 +14,7 @@ #include "sysdep/config.h" #define BUFFER(type) struct { type *data; uint used, size; } - +#define BUFFER_TYPE(v) typeof(* (v).data) #define BUFFER_SIZE(v) ((v).size * sizeof(* (v).data)) #define BUFFER_INIT(v,pool,isize) \ @@ -46,6 +46,9 @@ #define BUFFER_FLUSH(v) ({ (v).used = 0; }) +#define BUFFER_WALK(v,n) \ + for (BUFFER_TYPE(v) *_n = (v).data, n; _n < ((v).data + (v).used) && (n = *_n, 1); _n++) + #define BUFFER_SHALLOW_COPY(dst, src) \ ({ \ (dst).used = (src).used; \ -- cgit v1.2.3