2000-03-01 14:51:47 +00:00
|
|
|
/*
|
|
|
|
* BIRD -- Neighbor Cache
|
|
|
|
*
|
|
|
|
* (c) 1998--2000 Martin Mares <mj@ucw.cz>
|
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* DOC: Neighbor cache
|
|
|
|
*
|
|
|
|
* Most routing protocols need to associate their internal state data with
|
|
|
|
* neighboring routers, check whether an address given as the next hop
|
|
|
|
* attribute of a route is really an address of a directly connected host
|
|
|
|
* and which interface is it connected through. Also, they often need to
|
|
|
|
* be notified when a neighbor ceases to exist or when their long awaited
|
|
|
|
* neighbor becomes connected. The neighbor cache is there to solve all
|
|
|
|
* these problems.
|
|
|
|
*
|
|
|
|
* The neighbor cache maintains a collection of neighbor entries. Each
|
|
|
|
* entry represents one IP address corresponding to either our directly
|
|
|
|
* connected neighbor or our own end of the link (when the scope of the
|
2000-06-07 13:25:53 +00:00
|
|
|
* address is set to %SCOPE_HOST) together with per-neighbor data belonging to a
|
2000-06-01 16:16:49 +00:00
|
|
|
* single protocol.
|
|
|
|
*
|
|
|
|
* Active entries represent known neighbors and are stored in a hash
|
2000-06-07 13:25:53 +00:00
|
|
|
* table (to allow fast retrieval based on the IP address of the node) and
|
2000-06-01 16:16:49 +00:00
|
|
|
* two linked lists: one global and one per-interface (allowing quick
|
|
|
|
* processing of interface change events). Inactive entries exist only
|
|
|
|
* when the protocol has explicitly requested it via the %NEF_STICKY
|
|
|
|
* flag because it wishes to be notified when the node will again become
|
|
|
|
* a neighbor. Such entries are enqueued in a special list which is walked
|
2000-06-07 13:25:53 +00:00
|
|
|
* whenever an interface changes its state to up.
|
2000-06-01 16:16:49 +00:00
|
|
|
*
|
|
|
|
* When a neighbor event occurs (a neighbor gets disconnected or a sticky
|
|
|
|
* inactive neighbor becomes connected), the protocol hook neigh_notify()
|
|
|
|
* is called to advertise the change.
|
|
|
|
*/
|
|
|
|
|
2000-03-12 21:01:38 +00:00
|
|
|
#undef LOCAL_DEBUG
|
2000-03-01 14:51:47 +00:00
|
|
|
|
|
|
|
#include "nest/bird.h"
|
|
|
|
#include "nest/iface.h"
|
|
|
|
#include "nest/protocol.h"
|
|
|
|
#include "lib/resource.h"
|
|
|
|
|
|
|
|
#define NEIGH_HASH_SIZE 256
|
|
|
|
|
|
|
|
static slab *neigh_slab;
|
|
|
|
static list sticky_neigh_list, neigh_hash_table[NEIGH_HASH_SIZE];
|
|
|
|
|
2015-05-19 06:53:34 +00:00
|
|
|
static inline uint
|
2000-03-01 14:51:47 +00:00
|
|
|
neigh_hash(struct proto *p, ip_addr *a)
|
|
|
|
{
|
|
|
|
return (p->hash_key ^ ipa_hash(*a)) & (NEIGH_HASH_SIZE-1);
|
|
|
|
}
|
|
|
|
|
2000-03-27 12:16:37 +00:00
|
|
|
static int
|
2013-12-02 10:54:32 +00:00
|
|
|
if_connected(ip_addr *a, struct iface *i, struct ifa **ap)
|
2000-03-01 14:51:47 +00:00
|
|
|
{
|
|
|
|
struct ifa *b;
|
|
|
|
|
|
|
|
if (!(i->flags & IF_UP))
|
2013-12-02 10:54:32 +00:00
|
|
|
{
|
|
|
|
*ap = NULL;
|
2000-06-01 12:58:04 +00:00
|
|
|
return -1;
|
2013-12-02 10:54:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-01 14:51:47 +00:00
|
|
|
WALK_LIST(b, i->addrs)
|
|
|
|
{
|
2013-12-02 10:54:32 +00:00
|
|
|
*ap = b;
|
|
|
|
|
2000-03-01 14:51:47 +00:00
|
|
|
if (ipa_equal(*a, b->ip))
|
2000-06-01 12:58:04 +00:00
|
|
|
return SCOPE_HOST;
|
2011-03-28 20:46:18 +00:00
|
|
|
if (b->flags & IA_PEER)
|
2000-03-01 14:51:47 +00:00
|
|
|
{
|
|
|
|
if (ipa_equal(*a, b->opposite))
|
2000-06-01 12:58:04 +00:00
|
|
|
return b->scope;
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ipa_in_net(*a, b->prefix, b->pxlen))
|
|
|
|
{
|
2010-04-27 22:39:57 +00:00
|
|
|
#ifndef IPV6
|
|
|
|
if ((b->pxlen < (BITS_PER_IP_ADDRESS - 1)) &&
|
|
|
|
(ipa_equal(*a, b->prefix) || /* Network address */
|
|
|
|
ipa_equal(*a, b->brd))) /* Broadcast */
|
2013-12-02 10:54:32 +00:00
|
|
|
{
|
|
|
|
*ap = NULL;
|
2000-03-01 14:51:47 +00:00
|
|
|
return -1;
|
2013-12-02 10:54:32 +00:00
|
|
|
}
|
2010-04-27 22:39:57 +00:00
|
|
|
#endif
|
|
|
|
|
2000-06-01 12:58:04 +00:00
|
|
|
return b->scope;
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-12-02 10:54:32 +00:00
|
|
|
|
|
|
|
*ap = NULL;
|
2000-06-01 12:58:04 +00:00
|
|
|
return -1;
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_find - find or create a neighbor entry.
|
|
|
|
* @p: protocol which asks for the entry.
|
|
|
|
* @a: pointer to IP address of the node to be searched for.
|
|
|
|
* @flags: 0 or %NEF_STICKY if you want to create a sticky entry.
|
|
|
|
*
|
|
|
|
* Search the neighbor cache for a node with given IP address. If
|
|
|
|
* it's found, a pointer to the neighbor entry is returned. If no
|
|
|
|
* such entry exists and the node is directly connected on
|
|
|
|
* one of our active interfaces, a new entry is created and returned
|
|
|
|
* to the caller with protocol-dependent fields initialized to zero.
|
|
|
|
* If the node is not connected directly or *@a is not a valid unicast
|
|
|
|
* IP address, neigh_find() returns %NULL.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
neighbor *
|
|
|
|
neigh_find(struct proto *p, ip_addr *a, unsigned flags)
|
2009-08-27 16:25:46 +00:00
|
|
|
{
|
|
|
|
return neigh_find2(p, a, NULL, flags);
|
|
|
|
}
|
2009-09-08 11:45:02 +00:00
|
|
|
|
2009-08-27 16:25:46 +00:00
|
|
|
|
|
|
|
neighbor *
|
2009-09-08 11:45:02 +00:00
|
|
|
neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
|
2000-03-01 14:51:47 +00:00
|
|
|
{
|
|
|
|
neighbor *n;
|
2012-08-16 11:09:26 +00:00
|
|
|
int class, scope = -1;
|
2015-05-19 06:53:34 +00:00
|
|
|
uint h = neigh_hash(p, a);
|
2009-09-08 11:45:02 +00:00
|
|
|
struct iface *i;
|
2013-12-02 10:54:32 +00:00
|
|
|
struct ifa *addr;
|
2000-03-01 14:51:47 +00:00
|
|
|
|
|
|
|
WALK_LIST(n, neigh_hash_table[h]) /* Search the cache */
|
2010-02-26 09:55:58 +00:00
|
|
|
if (n->proto == p && ipa_equal(*a, n->addr) && (!ifa || (ifa == n->iface)))
|
2000-03-01 14:51:47 +00:00
|
|
|
return n;
|
|
|
|
|
|
|
|
class = ipa_classify(*a);
|
|
|
|
if (class < 0) /* Invalid address */
|
|
|
|
return NULL;
|
2009-09-08 11:45:02 +00:00
|
|
|
if (((class & IADDR_SCOPE_MASK) == SCOPE_HOST) ||
|
|
|
|
(((class & IADDR_SCOPE_MASK) == SCOPE_LINK) && (ifa == NULL)) ||
|
2000-03-01 14:51:47 +00:00
|
|
|
!(class & IADDR_HOST))
|
|
|
|
return NULL; /* Bad scope or a somecast */
|
|
|
|
|
2009-09-08 11:45:02 +00:00
|
|
|
if (ifa)
|
2010-02-26 09:55:58 +00:00
|
|
|
{
|
2013-12-02 10:54:32 +00:00
|
|
|
scope = if_connected(a, ifa, &addr);
|
2012-01-01 11:02:20 +00:00
|
|
|
flags |= NEF_BIND;
|
2010-02-26 09:55:58 +00:00
|
|
|
|
|
|
|
if ((scope < 0) && (flags & NEF_ONLINK))
|
|
|
|
scope = class & IADDR_SCOPE_MASK;
|
|
|
|
}
|
2009-09-08 11:45:02 +00:00
|
|
|
else
|
|
|
|
WALK_LIST(i, iface_list)
|
2013-12-02 10:54:32 +00:00
|
|
|
if ((scope = if_connected(a, i, &addr)) >= 0)
|
2009-09-08 11:45:02 +00:00
|
|
|
{
|
|
|
|
ifa = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-26 09:55:58 +00:00
|
|
|
/* scope < 0 means i don't know neighbor */
|
|
|
|
/* scope >= 0 implies ifa != NULL */
|
|
|
|
|
|
|
|
if ((scope < 0) && !(flags & NEF_STICKY))
|
2000-03-01 14:51:47 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
n = sl_alloc(neigh_slab);
|
|
|
|
n->addr = *a;
|
2010-02-26 09:55:58 +00:00
|
|
|
if (scope >= 0)
|
2000-03-01 14:51:47 +00:00
|
|
|
{
|
|
|
|
add_tail(&neigh_hash_table[h], &n->n);
|
2009-09-08 11:45:02 +00:00
|
|
|
add_tail(&ifa->neighbors, &n->if_n);
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
else
|
2000-06-01 13:13:49 +00:00
|
|
|
{
|
|
|
|
add_tail(&sticky_neigh_list, &n->n);
|
2011-01-08 18:34:12 +00:00
|
|
|
scope = -1;
|
2000-06-01 13:13:49 +00:00
|
|
|
}
|
2010-02-26 09:55:58 +00:00
|
|
|
n->iface = ifa;
|
2013-12-02 10:54:32 +00:00
|
|
|
n->ifa = addr;
|
2000-03-01 14:51:47 +00:00
|
|
|
n->proto = p;
|
|
|
|
n->data = NULL;
|
|
|
|
n->aux = 0;
|
|
|
|
n->flags = flags;
|
2000-06-01 12:58:04 +00:00
|
|
|
n->scope = scope;
|
2000-03-01 14:51:47 +00:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_dump - dump specified neighbor entry.
|
|
|
|
* @n: the entry to dump
|
|
|
|
*
|
|
|
|
* This functions dumps the contents of a given neighbor entry
|
|
|
|
* to debug output.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
void
|
|
|
|
neigh_dump(neighbor *n)
|
|
|
|
{
|
|
|
|
debug("%p %I ", n, n->addr);
|
|
|
|
if (n->iface)
|
|
|
|
debug("%s ", n->iface->name);
|
|
|
|
else
|
|
|
|
debug("[] ");
|
2000-06-01 12:58:04 +00:00
|
|
|
debug("%s %p %08x scope %s", n->proto->name, n->data, n->aux, ip_scope_text(n->scope));
|
2000-03-01 14:51:47 +00:00
|
|
|
if (n->flags & NEF_STICKY)
|
|
|
|
debug(" STICKY");
|
|
|
|
debug("\n");
|
|
|
|
}
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_dump_all - dump all neighbor entries.
|
|
|
|
*
|
|
|
|
* This function dumps the contents of the neighbor cache to
|
|
|
|
* debug output.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
void
|
|
|
|
neigh_dump_all(void)
|
|
|
|
{
|
|
|
|
neighbor *n;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
debug("Known neighbors:\n");
|
|
|
|
WALK_LIST(n, sticky_neigh_list)
|
|
|
|
neigh_dump(n);
|
|
|
|
for(i=0; i<NEIGH_HASH_SIZE; i++)
|
2000-05-08 10:13:59 +00:00
|
|
|
WALK_LIST(n, neigh_hash_table[i])
|
|
|
|
neigh_dump(n);
|
2000-03-01 14:51:47 +00:00
|
|
|
debug("\n");
|
|
|
|
}
|
|
|
|
|
2011-12-11 23:24:15 +00:00
|
|
|
static void
|
2013-12-02 10:54:32 +00:00
|
|
|
neigh_up(neighbor *n, struct iface *i, int scope, struct ifa *a)
|
2011-12-11 23:24:15 +00:00
|
|
|
{
|
|
|
|
n->iface = i;
|
2013-12-02 10:54:32 +00:00
|
|
|
n->ifa = a;
|
2011-12-11 23:24:15 +00:00
|
|
|
n->scope = scope;
|
|
|
|
add_tail(&i->neighbors, &n->if_n);
|
|
|
|
rem_node(&n->n);
|
|
|
|
add_tail(&neigh_hash_table[neigh_hash(n->proto, &n->addr)], &n->n);
|
|
|
|
DBG("Waking up sticky neighbor %I\n", n->addr);
|
|
|
|
if (n->proto->neigh_notify && n->proto->core_state != FS_FLUSHING)
|
|
|
|
n->proto->neigh_notify(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
neigh_down(neighbor *n)
|
|
|
|
{
|
2013-09-26 15:33:00 +00:00
|
|
|
DBG("Flushing neighbor %I on %s\n", n->addr, n->iface->name);
|
2011-12-11 23:24:15 +00:00
|
|
|
rem_node(&n->if_n);
|
2012-01-01 11:02:20 +00:00
|
|
|
if (! (n->flags & NEF_BIND))
|
|
|
|
n->iface = NULL;
|
2013-12-02 10:54:32 +00:00
|
|
|
n->ifa = NULL;
|
2012-01-01 11:02:20 +00:00
|
|
|
n->scope = -1;
|
2011-12-11 23:24:15 +00:00
|
|
|
if (n->proto->neigh_notify && n->proto->core_state != FS_FLUSHING)
|
|
|
|
n->proto->neigh_notify(n);
|
|
|
|
rem_node(&n->n);
|
|
|
|
if (n->flags & NEF_STICKY)
|
2012-08-16 11:09:26 +00:00
|
|
|
{
|
|
|
|
add_tail(&sticky_neigh_list, &n->n);
|
|
|
|
|
|
|
|
/* Respawn neighbor if there is another matching prefix */
|
|
|
|
struct iface *i;
|
2013-12-02 10:54:32 +00:00
|
|
|
struct ifa *a;
|
2012-08-16 11:09:26 +00:00
|
|
|
int scope;
|
|
|
|
|
|
|
|
if (!n->iface)
|
|
|
|
WALK_LIST(i, iface_list)
|
2013-12-02 10:54:32 +00:00
|
|
|
if ((scope = if_connected(&n->addr, i, &a)) >= 0)
|
2012-08-16 11:09:26 +00:00
|
|
|
{
|
2013-12-02 10:54:32 +00:00
|
|
|
neigh_up(n, i, scope, a);
|
2012-08-16 11:09:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2011-12-11 23:24:15 +00:00
|
|
|
else
|
|
|
|
sl_free(neigh_slab, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_if_up: notify neighbor cache about interface up event
|
|
|
|
* @i: interface in question
|
|
|
|
*
|
|
|
|
* Tell the neighbor cache that a new interface became up.
|
|
|
|
*
|
|
|
|
* The neighbor cache wakes up all inactive sticky neighbors with
|
|
|
|
* addresses belonging to prefixes of the interface @i.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
void
|
|
|
|
neigh_if_up(struct iface *i)
|
|
|
|
{
|
2013-12-02 10:54:32 +00:00
|
|
|
struct ifa *a;
|
2000-03-01 14:51:47 +00:00
|
|
|
neighbor *n, *next;
|
2000-06-01 12:58:04 +00:00
|
|
|
int scope;
|
2000-03-01 14:51:47 +00:00
|
|
|
|
|
|
|
WALK_LIST_DELSAFE(n, next, sticky_neigh_list)
|
2012-01-01 11:02:20 +00:00
|
|
|
if ((!n->iface || n->iface == i) &&
|
2013-12-02 10:54:32 +00:00
|
|
|
((scope = if_connected(&n->addr, i, &a)) >= 0))
|
|
|
|
neigh_up(n, i, scope, a);
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_if_down - notify neighbor cache about interface down event
|
|
|
|
* @i: the interface in question
|
|
|
|
*
|
|
|
|
* Notify the neighbor cache that an interface has ceased to exist.
|
|
|
|
*
|
|
|
|
* It causes all entries belonging to neighbors connected to this interface
|
|
|
|
* to be flushed.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
void
|
|
|
|
neigh_if_down(struct iface *i)
|
|
|
|
{
|
|
|
|
node *x, *y;
|
|
|
|
|
|
|
|
WALK_LIST_DELSAFE(x, y, i->neighbors)
|
2011-12-11 23:24:15 +00:00
|
|
|
neigh_down(SKIP_BACK(neighbor, if_n, x));
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
|
2010-11-11 11:24:27 +00:00
|
|
|
/**
|
|
|
|
* neigh_if_link - notify neighbor cache about interface link change
|
|
|
|
* @i: the interface in question
|
|
|
|
*
|
|
|
|
* Notify the neighbor cache that an interface changed link state.
|
|
|
|
* All owners of neighbor entries connected to this interface are
|
|
|
|
* notified.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
neigh_if_link(struct iface *i)
|
|
|
|
{
|
|
|
|
node *x, *y;
|
|
|
|
|
|
|
|
WALK_LIST_DELSAFE(x, y, i->neighbors)
|
|
|
|
{
|
|
|
|
neighbor *n = SKIP_BACK(neighbor, if_n, x);
|
|
|
|
if (n->proto->neigh_notify && n->proto->core_state != FS_FLUSHING)
|
|
|
|
n->proto->neigh_notify(n);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-11 23:24:15 +00:00
|
|
|
/**
|
|
|
|
* neigh_ifa_update: notify neighbor cache about interface address add or remove event
|
2016-05-12 13:49:44 +00:00
|
|
|
* @a: interface address in question
|
2011-12-11 23:24:15 +00:00
|
|
|
*
|
|
|
|
* Tell the neighbor cache that an address was added or removed.
|
|
|
|
*
|
|
|
|
* The neighbor cache wakes up all inactive sticky neighbors with
|
|
|
|
* addresses belonging to prefixes of the interface belonging to @ifa
|
|
|
|
* and causes all unreachable neighbors to be flushed.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
neigh_ifa_update(struct ifa *a)
|
|
|
|
{
|
|
|
|
struct iface *i = a->iface;
|
|
|
|
node *x, *y;
|
|
|
|
|
|
|
|
/* Remove all neighbors whose scope has changed */
|
|
|
|
WALK_LIST_DELSAFE(x, y, i->neighbors)
|
|
|
|
{
|
2013-12-02 10:54:32 +00:00
|
|
|
struct ifa *aa;
|
2011-12-11 23:24:15 +00:00
|
|
|
neighbor *n = SKIP_BACK(neighbor, if_n, x);
|
2013-12-02 10:54:32 +00:00
|
|
|
if (if_connected(&n->addr, i, &aa) != n->scope)
|
2011-12-11 23:24:15 +00:00
|
|
|
neigh_down(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wake up all sticky neighbors that are reachable now */
|
|
|
|
neigh_if_up(i);
|
|
|
|
}
|
|
|
|
|
2000-05-08 10:13:59 +00:00
|
|
|
static inline void
|
|
|
|
neigh_prune_one(neighbor *n)
|
|
|
|
{
|
2008-12-08 11:24:55 +00:00
|
|
|
if (n->proto->proto_state != PS_DOWN)
|
2000-05-08 10:13:59 +00:00
|
|
|
return;
|
|
|
|
rem_node(&n->n);
|
2012-01-01 11:02:20 +00:00
|
|
|
if (n->scope >= 0)
|
2000-05-08 10:13:59 +00:00
|
|
|
rem_node(&n->if_n);
|
|
|
|
sl_free(neigh_slab, n);
|
|
|
|
}
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_prune - prune neighbor cache
|
|
|
|
*
|
|
|
|
* neigh_prune() examines all neighbor entries cached and removes those
|
|
|
|
* corresponding to inactive protocols. It's called whenever a protocol
|
|
|
|
* is shut down to get rid of all its heritage.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
void
|
|
|
|
neigh_prune(void)
|
|
|
|
{
|
|
|
|
neighbor *n;
|
|
|
|
node *m;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
DBG("Pruning neighbors\n");
|
|
|
|
for(i=0; i<NEIGH_HASH_SIZE; i++)
|
|
|
|
WALK_LIST_DELSAFE(n, m, neigh_hash_table[i])
|
2000-05-08 10:13:59 +00:00
|
|
|
neigh_prune_one(n);
|
|
|
|
WALK_LIST_DELSAFE(n, m, sticky_neigh_list)
|
|
|
|
neigh_prune_one(n);
|
2000-03-01 14:51:47 +00:00
|
|
|
}
|
|
|
|
|
2000-06-01 16:16:49 +00:00
|
|
|
/**
|
|
|
|
* neigh_init - initialize the neighbor cache.
|
|
|
|
* @if_pool: resource pool to be used for neighbor entries.
|
|
|
|
*
|
|
|
|
* This function is called during BIRD startup to initialize
|
|
|
|
* the neighbor cache module.
|
|
|
|
*/
|
2000-03-01 14:51:47 +00:00
|
|
|
void
|
|
|
|
neigh_init(pool *if_pool)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
neigh_slab = sl_new(if_pool, sizeof(neighbor));
|
|
|
|
init_list(&sticky_neigh_list);
|
|
|
|
for(i=0; i<NEIGH_HASH_SIZE; i++)
|
|
|
|
init_list(&neigh_hash_table[i]);
|
|
|
|
}
|