diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-08 01:16:01 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-08 01:16:01 +0200 |
commit | 15fbb0adbd228d40b9fafab937054f68ed2d4a16 (patch) | |
tree | 83ed99ff67f14c3b612250096e623825dcceda01 /ffd/neigh.h | |
parent | a934dcc3ce78b22a0ff4db5d353a3d8dcc2b5f1d (diff) | |
download | ffd-15fbb0adbd228d40b9fafab937054f68ed2d4a16.tar ffd-15fbb0adbd228d40b9fafab937054f68ed2d4a16.zip |
Handle disappearing interfaces
Diffstat (limited to 'ffd/neigh.h')
-rw-r--r-- | ffd/neigh.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ffd/neigh.h b/ffd/neigh.h index d82025c..aa0d1f9 100644 --- a/ffd/neigh.h +++ b/ffd/neigh.h @@ -40,8 +40,18 @@ static inline ffd_neigh_t* ffd_neigh_find(const ffd_iface_t *iface, const eth_ad return NULL; } +static inline void ffd_neigh_ref(ffd_neigh_t *neigh) { + neigh->ref++; +} + +static inline void ffd_neigh_unref(ffd_neigh_t *neigh) { + if (!(--neigh->ref) && !neigh->iface) + free(neigh); +} + ffd_neigh_t* ffd_neigh_get(ffd_iface_t *iface, const eth_addr_t *addr); -void ffd_neigh_free_list(ffd_neigh_t *neigh); +void ffd_neigh_unref(ffd_neigh_t *neigh); +void ffd_neigh_unref_list(ffd_neigh_t *neigh); uint16_t ffd_neigh_get_rxcost(const ffd_neigh_t *neigh); uint16_t ffd_neigh_get_txcost(const ffd_neigh_t *neigh); |