diff options
author | glebius <glebius@FreeBSD.org> | 2012-08-02 13:20:44 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-08-02 13:20:44 +0000 |
commit | 34fe3f296a23dcd2b2315ab9b7cbe217a7e36c17 (patch) | |
tree | 51861ac00bbe53eb774230ad7cd58bb5b39aa9ff /sys/net/if_llatbl.c | |
parent | 55897c521e10c657445e8cc5242b180b8557ffb0 (diff) | |
download | FreeBSD-src-34fe3f296a23dcd2b2315ab9b7cbe217a7e36c17.zip FreeBSD-src-34fe3f296a23dcd2b2315ab9b7cbe217a7e36c17.tar.gz |
The llentry_update() is used only by flowtable and the latter
always passes NULL pointer to it. Thus, code can be simplified
and function renamed to llentry_alloc() to match rtalloc().
Diffstat (limited to 'sys/net/if_llatbl.c')
-rw-r--r-- | sys/net/if_llatbl.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index a9c4199..2fc75ef 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -129,42 +129,33 @@ llentry_free(struct llentry *lle) } /* - * Update an llentry for address dst (equivalent to rtalloc for new-arp) - * Caller must pass in a valid struct llentry * (or NULL) + * (al)locate an llentry for address dst (equivalent to rtalloc for new-arp). * - * if found the llentry * is returned referenced and unlocked + * If found the llentry * is returned referenced and unlocked. */ -int -llentry_update(struct llentry **llep, struct lltable *lt, - struct sockaddr_storage *dst, struct ifnet *ifp) +struct llentry * +llentry_alloc(struct ifnet *ifp, struct lltable *lt, + struct sockaddr_storage *dst) { struct llentry *la; IF_AFDATA_RLOCK(ifp); - la = lla_lookup(lt, LLE_EXCLUSIVE, - (struct sockaddr *)dst); + la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); IF_AFDATA_RUNLOCK(ifp); if ((la == NULL) && (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { IF_AFDATA_WLOCK(ifp); - la = lla_lookup(lt, - (LLE_CREATE | LLE_EXCLUSIVE), + la = lla_lookup(lt, (LLE_CREATE | LLE_EXCLUSIVE), (struct sockaddr *)dst); IF_AFDATA_WUNLOCK(ifp); } - if (la != NULL && (*llep != la)) { - if (*llep != NULL) - LLE_FREE(*llep); + + if (la != NULL) { LLE_ADDREF(la); LLE_WUNLOCK(la); - *llep = la; - } else if (la != NULL) - LLE_WUNLOCK(la); - - if (la == NULL) - return (ENOENT); + } - return (0); + return (la); } /* |