Deleted Added
full compact
in6.c (286577) in6.c (286616)
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 286577 2015-08-10 12:03:59Z melifaro $");
64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 286616 2015-08-11 05:51:00Z melifaro $");
65
66#include "opt_compat.h"
67#include "opt_inet.h"
68#include "opt_inet6.h"
69
70#include <sys/param.h>
71#include <sys/eventhandler.h>
72#include <sys/errno.h>

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

2194static inline struct llentry *
2195in6_lltable_find_dst(struct lltable *llt, const struct in6_addr *dst)
2196{
2197 struct llentry *lle;
2198 struct llentries *lleh;
2199 const struct sockaddr_in6 *sin6;
2200 u_int hashidx;
2201
65
66#include "opt_compat.h"
67#include "opt_inet.h"
68#include "opt_inet6.h"
69
70#include <sys/param.h>
71#include <sys/eventhandler.h>
72#include <sys/errno.h>

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

2194static inline struct llentry *
2195in6_lltable_find_dst(struct lltable *llt, const struct in6_addr *dst)
2196{
2197 struct llentry *lle;
2198 struct llentries *lleh;
2199 const struct sockaddr_in6 *sin6;
2200 u_int hashidx;
2201
2202 hashidx = in6_lltable_hash_dst(dst, LLTBL_HASHTBL_SIZE);
2202 hashidx = in6_lltable_hash_dst(dst, llt->llt_hsize);
2203 lleh = &llt->lle_head[hashidx];
2204 LIST_FOREACH(lle, lleh, lle_next) {
2205 sin6 = (const struct sockaddr_in6 *)L3_CADDR(lle);
2206 if (lle->la_flags & LLE_DELETED)
2207 continue;
2208 if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, dst))
2209 break;
2210 }

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

2373 if (lle->la_flags & LLE_STATIC)
2374 ndpc.rtm.rtm_flags |= RTF_STATIC;
2375 ndpc.rtm.rtm_index = ifp->if_index;
2376 error = SYSCTL_OUT(wr, &ndpc, sizeof(ndpc));
2377
2378 return (error);
2379}
2380
2203 lleh = &llt->lle_head[hashidx];
2204 LIST_FOREACH(lle, lleh, lle_next) {
2205 sin6 = (const struct sockaddr_in6 *)L3_CADDR(lle);
2206 if (lle->la_flags & LLE_DELETED)
2207 continue;
2208 if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, dst))
2209 break;
2210 }

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

2373 if (lle->la_flags & LLE_STATIC)
2374 ndpc.rtm.rtm_flags |= RTF_STATIC;
2375 ndpc.rtm.rtm_index = ifp->if_index;
2376 error = SYSCTL_OUT(wr, &ndpc, sizeof(ndpc));
2377
2378 return (error);
2379}
2380
2381static struct lltable *
2382in6_lltattach(struct ifnet *ifp)
2383{
2384 struct lltable *llt;
2385
2386 llt = lltable_allocate_htbl(IN6_LLTBL_DEFAULT_HSIZE);
2387 llt->llt_af = AF_INET6;
2388 llt->llt_ifp = ifp;
2389
2390 llt->llt_lookup = in6_lltable_lookup;
2391 llt->llt_create = in6_lltable_create;
2392 llt->llt_delete = in6_lltable_delete;
2393 llt->llt_dump_entry = in6_lltable_dump_entry;
2394 llt->llt_hash = in6_lltable_hash;
2395 llt->llt_fill_sa_entry = in6_lltable_fill_sa_entry;
2396 llt->llt_free_entry = in6_lltable_free_entry;
2397 llt->llt_match_prefix = in6_lltable_match_prefix;
2398 lltable_link(llt);
2399
2400 return (llt);
2401}
2402
2381void *
2382in6_domifattach(struct ifnet *ifp)
2383{
2384 struct in6_ifextra *ext;
2385
2386 /* There are not IPv6-capable interfaces. */
2387 switch (ifp->if_type) {
2388 case IFT_PFLOG:

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

2401 ext->icmp6_ifstat = malloc(sizeof(counter_u64_t) *
2402 sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_IFADDR,
2403 M_WAITOK);
2404 COUNTER_ARRAY_ALLOC(ext->icmp6_ifstat,
2405 sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_WAITOK);
2406
2407 ext->nd_ifinfo = nd6_ifattach(ifp);
2408 ext->scope6_id = scope6_ifattach(ifp);
2403void *
2404in6_domifattach(struct ifnet *ifp)
2405{
2406 struct in6_ifextra *ext;
2407
2408 /* There are not IPv6-capable interfaces. */
2409 switch (ifp->if_type) {
2410 case IFT_PFLOG:

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

2423 ext->icmp6_ifstat = malloc(sizeof(counter_u64_t) *
2424 sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_IFADDR,
2425 M_WAITOK);
2426 COUNTER_ARRAY_ALLOC(ext->icmp6_ifstat,
2427 sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_WAITOK);
2428
2429 ext->nd_ifinfo = nd6_ifattach(ifp);
2430 ext->scope6_id = scope6_ifattach(ifp);
2409 ext->lltable = lltable_init(ifp, AF_INET6);
2410 if (ext->lltable != NULL) {
2411 ext->lltable->llt_lookup = in6_lltable_lookup;
2412 ext->lltable->llt_create = in6_lltable_create;
2413 ext->lltable->llt_delete = in6_lltable_delete;
2414 ext->lltable->llt_dump_entry = in6_lltable_dump_entry;
2415 ext->lltable->llt_hash = in6_lltable_hash;
2416 ext->lltable->llt_fill_sa_entry = in6_lltable_fill_sa_entry;
2417 ext->lltable->llt_free_entry = in6_lltable_free_entry;
2418 ext->lltable->llt_match_prefix = in6_lltable_match_prefix;
2419 }
2431 ext->lltable = in6_lltattach(ifp);
2420
2421 ext->mld_ifinfo = mld_domifattach(ifp);
2422
2423 return ext;
2424}
2425
2426int
2427in6_domifmtu(struct ifnet *ifp)

--- 81 unchanged lines hidden ---
2432
2433 ext->mld_ifinfo = mld_domifattach(ifp);
2434
2435 return ext;
2436}
2437
2438int
2439in6_domifmtu(struct ifnet *ifp)

--- 81 unchanged lines hidden ---