diff options
author | melifaro <melifaro@FreeBSD.org> | 2015-08-20 12:05:17 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2015-08-20 12:05:17 +0000 |
commit | 54b3b78856caa3ef7df00c807fd13701f84a49cc (patch) | |
tree | e95d0b96f23a00ddfd22b59844e6418afadff0ed /sys/net/if_llatbl.h | |
parent | 0bfc11710819b319c2d15748a276affb6f2e4343 (diff) | |
download | FreeBSD-src-54b3b78856caa3ef7df00c807fd13701f84a49cc.zip FreeBSD-src-54b3b78856caa3ef7df00c807fd13701f84a49cc.tar.gz |
* Split allocation and table linking for lle's.
Before that, the logic besides lle_create() was the following:
return existing if found, create if not. This behaviour was error-prone
since we had to deal with 'sudden' static<>dynamic lle changes.
This commit fixes bunch of different issues like:
- refcount leak when lle is converted to static.
Simple check case:
console 1:
while true;
do for i in `arp -an|awk '$4~/incomp/{print$2}'|tr -d '()'`;
do arp -s $i 00:22:44:66:88:00 ; arp -d $i;
done;
done
console 2:
ping -f any-dead-host-in-L2
console 3:
# watch for memory consumption:
vmstat -m | awk '$1~/lltable/{print$2}'
- possible problems in arptimer() / nd6_timer() when dropping/reacquiring
lock.
New logic explicitly handles use-or-create cases in every lla_create
user. Basically, most of the changes are purely mechanical. However,
we explicitly avoid using existing lle's for interface/static LLE records.
* While here, call lle_event handlers on all real table lle change.
* Create lltable_free_entry() calling existing per-lltable
lle_free_t callback for entry deletion
Diffstat (limited to 'sys/net/if_llatbl.h')
-rw-r--r-- | sys/net/if_llatbl.h | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 8502e80..0571bf0 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -133,7 +133,7 @@ struct llentry { typedef struct llentry *(llt_lookup_t)(struct lltable *, u_int flags, const struct sockaddr *l3addr); -typedef struct llentry *(llt_create_t)(struct lltable *, u_int flags, +typedef struct llentry *(llt_alloc_t)(struct lltable *, u_int flags, const struct sockaddr *l3addr); typedef int (llt_delete_t)(struct lltable *, u_int flags, const struct sockaddr *l3addr); @@ -161,7 +161,7 @@ struct lltable { struct ifnet *llt_ifp; llt_lookup_t *llt_lookup; - llt_create_t *llt_create; + llt_alloc_t *llt_alloc_entry; llt_delete_t *llt_delete; llt_prefix_free_t *llt_prefix_free; llt_dump_entry_t *llt_dump_entry; @@ -209,8 +209,9 @@ struct llentry *llentry_alloc(struct ifnet *, struct lltable *, /* helper functions */ size_t lltable_drop_entry_queue(struct llentry *); -struct llentry *lltable_create_lle(struct lltable *llt, u_int flags, - const void *paddr); +struct llentry *lltable_alloc_entry(struct lltable *llt, u_int flags, + const struct sockaddr *l4addr); +void lltable_free_entry(struct lltable *llt, struct llentry *lle); void lltable_link_entry(struct lltable *llt, struct llentry *lle); void lltable_unlink_entry(struct lltable *llt, struct llentry *lle); void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa); @@ -229,13 +230,6 @@ lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) return (llt->llt_lookup(llt, flags, l3addr)); } -static __inline struct llentry * -lla_create(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) -{ - - return (llt->llt_create(llt, flags, l3addr)); -} - static __inline int lla_delete(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { |