diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-27 16:51:53 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-27 16:57:07 +0200 |
commit | 586c1800c447ff099d34889b23647c4733876d9b (patch) | |
tree | d2f3feec9aaabeffe2457d994f4c453e1d9e7782 /nest/iface.h | |
parent | 45f28d85818f79790968725a945063228989bae7 (diff) |
Nest: Neighbor cache cleanups
Simplify neighbor cache code, fix several minor bugs, and improve
handling of ONLINK flag.
Diffstat (limited to 'nest/iface.h')
-rw-r--r-- | nest/iface.h | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/nest/iface.h b/nest/iface.h index ab3f8f35..bc241501 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -124,29 +124,21 @@ typedef struct neighbor { ip_addr addr; /* Address of the neighbor */ struct ifa *ifa; /* Ifa on related iface */ struct iface *iface; /* Interface it's connected to */ + struct iface *ifreq; /* Requested iface, NULL for any */ struct proto *proto; /* Protocol this belongs to */ void *data; /* Protocol-specific data */ - unsigned aux; /* Protocol-specific data */ - unsigned flags; - int scope; /* Address scope, -1 for unreachable sticky neighbors, + uint aux; /* Protocol-specific data */ + u16 flags; /* NEF_* flags */ + s16 scope; /* Address scope, -1 for unreachable neighbors, SCOPE_HOST when it's our own address */ } neighbor; #define NEF_STICKY 1 #define NEF_ONLINK 2 -#define NEF_BIND 4 /* Used internally for neighbors bound to an iface */ -#define NEF_IFACE 8 /* Neighbors bound to iface */ - +#define NEF_IFACE 4 /* Entry for whole iface */ -neighbor *neigh_find(struct proto *, ip_addr *, unsigned flags); -neighbor *neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags); -neighbor *neigh_find_iface(struct proto *p, struct iface *ifa); -static inline int neigh_connected_to(struct proto *p, ip_addr *a, struct iface *i) -{ - neighbor *n = neigh_find(p, a, 0); - return n && n->iface == i; -} +neighbor *neigh_find(struct proto *p, ip_addr a, struct iface *ifa, uint flags); void neigh_dump(neighbor *); void neigh_dump_all(void); |