Deleted Added
full compact
in6.c (198418) in6.c (201282)
1/*-
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)in.c 8.2 (Berkeley) 11/15/93
61 */
62
63#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)in.c 8.2 (Berkeley) 11/15/93
61 */
62
63#include <sys/cdefs.h>
64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 198418 2009-10-23 18:27:34Z qingli $");
64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 201282 2009-12-30 21:35:34Z qingli $");
65
66#include "opt_inet.h"
67#include "opt_inet6.h"
68
69#include <sys/param.h>
70#include <sys/errno.h>
71#include <sys/jail.h>
72#include <sys/malloc.h>

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

1195 ifa_ref(ifa0);
1196 IF_ADDR_UNLOCK(ifp);
1197
1198 /*
1199 * Remove the loopback route to the interface address.
1200 * The check for the current setting of "nd6_useloopback"
1201 * is not needed.
1202 */
65
66#include "opt_inet.h"
67#include "opt_inet6.h"
68
69#include <sys/param.h>
70#include <sys/errno.h>
71#include <sys/jail.h>
72#include <sys/malloc.h>

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

1195 ifa_ref(ifa0);
1196 IF_ADDR_UNLOCK(ifp);
1197
1198 /*
1199 * Remove the loopback route to the interface address.
1200 * The check for the current setting of "nd6_useloopback"
1201 * is not needed.
1202 */
1203 error = ifa_del_loopback_route((struct ifaddr *)ia,
1204 (struct sockaddr *)&ia->ia_addr);
1203 if (ia->ia_flags & IFA_RTSELF) {
1204 error = ifa_del_loopback_route((struct ifaddr *)ia,
1205 (struct sockaddr *)&ia->ia_addr);
1206 if (error == 0)
1207 ia->ia_flags &= ~IFA_RTSELF;
1208 }
1205
1206 /* stop DAD processing */
1207 nd6_dad_stop(ifa);
1208
1209 IF_AFDATA_LOCK(ifp);
1210 lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR),
1211 (struct sockaddr *)&ia->ia_addr);
1212 IF_AFDATA_UNLOCK(ifp);

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

1757 /*
1758 * add a loopback route to self
1759 */
1760 if (!(ia->ia_flags & IFA_ROUTE)
1761 && (V_nd6_useloopback
1762 || (ifp->if_flags & IFF_LOOPBACK))) {
1763 error = ifa_add_loopback_route((struct ifaddr *)ia,
1764 (struct sockaddr *)&ia->ia_addr);
1209
1210 /* stop DAD processing */
1211 nd6_dad_stop(ifa);
1212
1213 IF_AFDATA_LOCK(ifp);
1214 lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR),
1215 (struct sockaddr *)&ia->ia_addr);
1216 IF_AFDATA_UNLOCK(ifp);

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

1761 /*
1762 * add a loopback route to self
1763 */
1764 if (!(ia->ia_flags & IFA_ROUTE)
1765 && (V_nd6_useloopback
1766 || (ifp->if_flags & IFF_LOOPBACK))) {
1767 error = ifa_add_loopback_route((struct ifaddr *)ia,
1768 (struct sockaddr *)&ia->ia_addr);
1769 if (error == 0)
1770 ia->ia_flags |= IFA_RTSELF;
1765 }
1766
1767 /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */
1768 if (newhost) {
1769 struct llentry *ln;
1770 struct rtentry rt;
1771 struct sockaddr_dl gateway;
1772 struct sockaddr_in6 mask, addr;

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

2342 LLE_WLOCK(lle);
2343 llentry_free(lle);
2344 }
2345 }
2346 }
2347}
2348
2349static int
1771 }
1772
1773 /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */
1774 if (newhost) {
1775 struct llentry *ln;
1776 struct rtentry rt;
1777 struct sockaddr_dl gateway;
1778 struct sockaddr_in6 mask, addr;

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

2348 LLE_WLOCK(lle);
2349 llentry_free(lle);
2350 }
2351 }
2352 }
2353}
2354
2355static int
2350in6_lltable_rtcheck(struct ifnet *ifp, const struct sockaddr *l3addr)
2356in6_lltable_rtcheck(struct ifnet *ifp,
2357 u_int flags,
2358 const struct sockaddr *l3addr)
2351{
2352 struct rtentry *rt;
2353 char ip6buf[INET6_ADDRSTRLEN];
2354
2355 KASSERT(l3addr->sa_family == AF_INET6,
2356 ("sin_family %d", l3addr->sa_family));
2357
2358 /* XXX rtalloc1 should take a const param */

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

2410 if (!(flags & LLE_CREATE))
2411 return (NULL);
2412 /*
2413 * A route that covers the given address must have
2414 * been installed 1st because we are doing a resolution,
2415 * verify this.
2416 */
2417 if (!(flags & LLE_IFADDR) &&
2359{
2360 struct rtentry *rt;
2361 char ip6buf[INET6_ADDRSTRLEN];
2362
2363 KASSERT(l3addr->sa_family == AF_INET6,
2364 ("sin_family %d", l3addr->sa_family));
2365
2366 /* XXX rtalloc1 should take a const param */

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

2418 if (!(flags & LLE_CREATE))
2419 return (NULL);
2420 /*
2421 * A route that covers the given address must have
2422 * been installed 1st because we are doing a resolution,
2423 * verify this.
2424 */
2425 if (!(flags & LLE_IFADDR) &&
2418 in6_lltable_rtcheck(ifp, l3addr) != 0)
2426 in6_lltable_rtcheck(ifp, flags, l3addr) != 0)
2419 return NULL;
2420
2421 lle = in6_lltable_new(l3addr, flags);
2422 if (lle == NULL) {
2423 log(LOG_INFO, "lla_lookup: new lle malloc failed\n");
2424 return NULL;
2425 }
2426 lle->la_flags = flags & ~LLE_CREATE;

--- 211 unchanged lines hidden ---
2427 return NULL;
2428
2429 lle = in6_lltable_new(l3addr, flags);
2430 if (lle == NULL) {
2431 log(LOG_INFO, "lla_lookup: new lle malloc failed\n");
2432 return NULL;
2433 }
2434 lle->la_flags = flags & ~LLE_CREATE;

--- 211 unchanged lines hidden ---