if_llatbl.c (1829d5da5355930d5cfa8ec8add8ff47dc0bebab) if_llatbl.c (c8da95ace9a07ead9855ccd56da3c3f61bb0913b)
1/*
2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
3 * Copyright (c) 2004-2008 Qing Li. All rights reserved.
4 * Copyright (c) 2008 Kip Macy. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 89 unchanged lines hidden (view full) ---

98 LIST_REMOVE(lle, lle_next);
99
100 if (lle->la_hold != NULL)
101 m_freem(lle->la_hold);
102
103 LLE_FREE_LOCKED(lle);
104}
105
1/*
2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
3 * Copyright (c) 2004-2008 Qing Li. All rights reserved.
4 * Copyright (c) 2008 Kip Macy. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 89 unchanged lines hidden (view full) ---

98 LIST_REMOVE(lle, lle_next);
99
100 if (lle->la_hold != NULL)
101 m_freem(lle->la_hold);
102
103 LLE_FREE_LOCKED(lle);
104}
105
106int
107llentry_update(struct llentry **llep, struct lltable *lt,
108 struct sockaddr *dst, struct ifnet *ifp)
109{
110 struct llentry *la;
111
112 IF_AFDATA_RLOCK(ifp);
113 la = lla_lookup(lt, LLE_EXCLUSIVE,
114 (struct sockaddr *)dst);
115 IF_AFDATA_RUNLOCK(ifp);
116 if ((la == NULL) &&
117 (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) {
118 IF_AFDATA_WLOCK(ifp);
119 la = lla_lookup(lt,
120 (LLE_CREATE | LLE_EXCLUSIVE),
121 (struct sockaddr *)dst);
122 IF_AFDATA_WUNLOCK(ifp);
123 }
124 if (la != NULL && (*llep != la)) {
125 if (*llep != NULL)
126 LLE_FREE(*llep);
127 LLE_ADDREF(la);
128 LLE_WUNLOCK(la);
129 *llep = la;
130 } else if (la != NULL)
131 LLE_WUNLOCK(la);
132
133 if (la == NULL)
134 return (ENOENT);
135
136 return (0);
137}
138
106/*
107 * Free all entries from given table and free itself.
108 * Since lltables collects from all of the intefaces,
109 * the caller of this function must acquire IFNET_WLOCK().
110 */
111void
112lltable_free(struct lltable *llt)
113{

--- 199 unchanged lines hidden ---
139/*
140 * Free all entries from given table and free itself.
141 * Since lltables collects from all of the intefaces,
142 * the caller of this function must acquire IFNET_WLOCK().
143 */
144void
145lltable_free(struct lltable *llt)
146{

--- 199 unchanged lines hidden ---