From bf139664aa2ae9956b520ba4813bb6e03bf1a3e8 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 10 Sep 2013 12:09:36 +0200 Subject: Initial BFD commit, work in progress. --- lib/lists.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/lists.c') diff --git a/lib/lists.c b/lib/lists.c index 6d97ff50..58ffd230 100644 --- a/lib/lists.c +++ b/lib/lists.c @@ -100,6 +100,27 @@ rem_node(node *n) x->prev = z; } +/** + * replace_node - replace a node in a list with another one + * @old: node to be removed + * @new: node to be inserted + * + * Replaces node @old in the list it's linked in with node @new. Node + * @old may be a copy of the original node, which is not accessed + * through the list. The function could be called with @old == @new, + * which just fixes neighbors' pointers in the case that the node + * was reallocated. + */ +LIST_INLINE void +replace_node(node *old, node *new) +{ + old->next->prev = new; + old->prev->next = new; + + new->prev = old->prev; + new->next = old->next; +} + /** * init_list - create an empty list * @l: list -- cgit v1.2.3 From 6a8d3f1c1ffbd964e4d11b452c73e1ea70310af3 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 16 Sep 2013 23:57:40 +0200 Subject: BFD work in progress. Now it compiles and mostly works. --- conf/confbase.Y | 11 +- configure.in | 6 +- lib/hash.h | 112 +++++++---- lib/heap.h | 14 +- lib/lists.c | 19 ++ lib/lists.h | 1 + lib/resource.c | 5 +- lib/resource.h | 6 +- nest/proto.c | 3 + nest/protocol.h | 8 +- proto/bfd/Makefile | 2 +- proto/bfd/bfd.c | 535 +++++++++++++++++++++++++++++++++----------------- proto/bfd/bfd.h | 67 ++++++- proto/bfd/config.Y | 9 +- proto/bfd/io.c | 253 ++++++++++++++++++------ proto/bfd/io.h | 70 +++++-- proto/bfd/packets.c | 117 +++++++---- proto/ospf/topology.c | 3 +- proto/rip/rip.c | 1 + sysdep/config.h | 1 + sysdep/unix/io.c | 6 +- 21 files changed, 896 insertions(+), 353 deletions(-) (limited to 'lib/lists.c') diff --git a/conf/confbase.Y b/conf/confbase.Y index c6678e77..b793acb0 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -73,6 +73,7 @@ CF_DECLS %type ipa_scope %type expr bool pxlen +%type expr_us %type