Deleted Added
full compact
if_llatbl.c (187946) if_llatbl.c (191154)
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:

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

20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27#include <sys/cdefs.h>
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:

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

20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.c 187946 2009-01-31 10:48:02Z bz $");
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.c 191154 2009-04-16 22:04:07Z kmacy $");
29
30#include "opt_inet.h"
31#include "opt_inet6.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/malloc.h>
36#include <sys/mbuf.h>

--- 61 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
29
30#include "opt_inet.h"
31#include "opt_inet6.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/malloc.h>
36#include <sys/mbuf.h>

--- 61 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 ---